Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
benchmark Namespace Reference

Functions

 match (bench, filt)
 
 GetBenchmarkFile (path)
 
 ReadBenchmarkList (mode, path, core)
 
 BuildOptions ()
 
 ProcessOptions (options)
 
 GetBuildRoot (mode, arch, sanitizer)
 
 GetDart (mode, arch, sanitizer)
 
 Main ()
 

Variables

 HOST_OS = utils.GuessOS()
 
 HOST_CPUS = utils.GuessCpus()
 

Function Documentation

◆ BuildOptions()

benchmark.BuildOptions ( )

Definition at line 47 of file benchmark.py.

47def BuildOptions():
48 result = optparse.OptionParser()
49 result.add_option(
50 "-m",
51 "--mode",
52 help='Build variants (comma-separated).',
53 metavar='[all,debug,release]',
54 default='release')
55 result.add_option(
56 "-v",
57 "--verbose",
58 help='Verbose output.',
59 default=False,
60 action="store_true")
61 result.add_option(
62 "-c",
63 "--core",
64 help='Run only core benchmarks.',
65 default=False,
66 action="store_true")
67 result.add_option(
68 "--arch",
69 help='Target architectures (comma-separated).',
70 metavar='[all,ia32,x64,simarm,arm,dartc]',
72 result.add_option(
73 "--executable",
74 help='Virtual machine to execute.',
75 metavar='[dart, (path to dart binary)]',
76 default=None)
77 result.add_option(
78 "-w",
79 "--warmup",
80 help='Only run the warmup period.',
81 default=False,
82 action="store_true")
83 return result
84
85
GuessArchitecture()
Definition utils.py:42

◆ GetBenchmarkFile()

benchmark.GetBenchmarkFile (   path)

Definition at line 31 of file benchmark.py.

31def GetBenchmarkFile(path):
32 benchmark_root_path = [dirname(sys.argv[0]), '..', '..'] + ['benchmarks']
33 return realpath(os.path.sep.join(benchmark_root_path + path))
34
35

◆ GetBuildRoot()

benchmark.GetBuildRoot (   mode,
  arch,
  sanitizer 
)

Definition at line 104 of file benchmark.py.

104def GetBuildRoot(mode, arch, sanitizer):
105 return utils.GetBuildRoot(HOST_OS, mode, arch, sanitizer)
106
107
GetBuildRoot(host_os, mode=None, arch=None, sanitizer=None)
Definition utils.py:143

◆ GetDart()

benchmark.GetDart (   mode,
  arch,
  sanitizer 
)

Definition at line 108 of file benchmark.py.

108def GetDart(mode, arch, sanitizer):
109 executable = [abspath(join(GetBuildRoot(mode, arch, sanitizer), 'dart'))]
110 return executable
111
112

◆ Main()

benchmark.Main ( )

Definition at line 113 of file benchmark.py.

113def Main():
114 # Parse the options.
115 parser = BuildOptions()
116 (options, args) = parser.parse_args()
117 if not ProcessOptions(options):
118 parser.print_help()
119 return 1
120
121 chosen_benchmarks = ReadBenchmarkList(options.mode, 'BENCHMARKS',
122 options.core)
123
124 # Use arguments to filter the benchmarks.
125 if len(args) > 0:
126 filt = [re.compile(x.lower()) for x in args]
127 chosen_benchmarks = [b for b in chosen_benchmarks if match(b[0], filt)]
128
129 for mode in options.mode:
130 for arch in options.arch:
131 if options.executable is None:
132 # Construct the path to the dart binary.
133 executable = GetDart(mode, arch)
134 else:
135 executable = [options.executable]
136 for benchmark, vmargs, progargs in chosen_benchmarks:
137 command = executable
138 command = command + [
139 GetBenchmarkFile([benchmark, 'dart', benchmark + '.dart']),
140 ]
141 if options.verbose:
142 print(' '.join(command))
143 subprocess.call(command)
144 return 0
145
146
static bool match(const char *needle, const char *haystack)
Definition DM.cpp:1132
void print(void *str)
Definition bridge.cpp:126

◆ match()

benchmark.match (   bench,
  filt 
)

Definition at line 23 of file benchmark.py.

23def match(bench, filt):
24 bench = bench.lower()
25 for element in filt:
26 if element.search(bench):
27 return True
28 return False
29
30

◆ ProcessOptions()

benchmark.ProcessOptions (   options)

Definition at line 86 of file benchmark.py.

86def ProcessOptions(options):
87 if options.arch == 'all':
88 options.arch = 'ia32,x64,simarm,dartc'
89 if options.mode == 'all':
90 options.mode = 'debug,release'
91 options.mode = options.mode.split(',')
92 options.arch = options.arch.split(',')
93 for mode in options.mode:
94 if not mode in ['debug', 'release']:
95 print("Unknown mode %s" % mode)
96 return False
97 for arch in options.arch:
98 if not arch in ['ia32', 'x64', 'simarm', 'arm', 'dartc']:
99 print("Unknown arch %s" % arch)
100 return False
101 return True
102
103

◆ ReadBenchmarkList()

benchmark.ReadBenchmarkList (   mode,
  path,
  core 
)

Definition at line 36 of file benchmark.py.

36def ReadBenchmarkList(mode, path, core):
37 filename = GetBenchmarkFile([path])
38 benchmarks = dict()
39 with open(filename) as infile:
40 exec(infile.read(), benchmarks)
41 if (mode == "release") and not core:
42 return benchmarks['SUPPORTED_BENCHMARKS']
43 else:
44 return benchmarks['SUPPORTED_CORE_BENCHMARKS']
45
46

Variable Documentation

◆ HOST_CPUS

benchmark.HOST_CPUS = utils.GuessCpus()

Definition at line 19 of file benchmark.py.

◆ HOST_OS

benchmark.HOST_OS = utils.GuessOS()

Definition at line 18 of file benchmark.py.