OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
benchmarks.GoogleBenchmark Class Reference
+ Inheritance diagram for benchmarks.GoogleBenchmark:
+ Collaboration diagram for benchmarks.GoogleBenchmark:

Public Member Functions

def aggregateBenchmarks
 
def run
 

Static Public Attributes

 external = True
 
string description = 'Google Benchmark'
 

Detailed Description

Run google benchmarks and publish them to the network conbench server.

Definition at line 33 of file benchmarks.py.

Member Function Documentation

def benchmarks.GoogleBenchmark.aggregateBenchmarks (   self,
  benchmarks 
)

Definition at line 39 of file benchmarks.py.

References File_Namespace.append(), and benchmarks.conversionFactor().

Referenced by benchmarks.GoogleBenchmark.run().

39 
40  def aggregateBenchmarks(self, benchmarks):
41  aggregates = {}
42  for benchmark in benchmarks:
43  if 'aggregate_name' not in benchmark:
44  aggregate = aggregates.get(benchmark['name'])
45  if aggregate == None:
46  aggregates[benchmark['name']] = {
47  'data': [ benchmark['real_time'] ],
48  'unit': benchmark['time_unit'] }
49  else:
50  conversion_factor = conversionFactor(aggregate['unit'], benchmark['time_unit'])
51  aggregate['data'].append(conversion_factor * benchmark['real_time'])
52  return aggregates
def conversionFactor
Definition: benchmarks.py:27
size_t append(FILE *f, const size_t size, const int8_t *buf)
Appends the specified number of bytes to the end of the file f from buf.
Definition: File.cpp:158

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def benchmarks.GoogleBenchmark.run (   self,
  name,
  kwargs 
)

Definition at line 53 of file benchmarks.py.

References benchmarks.GoogleBenchmark.aggregateBenchmarks(), and heavyai.open().

53 
54  def run(self, name, kwargs):
55  context = { 'benchmark_language': 'C++' }
56  commit = os.environ.get('GIT_COMMIT')
57  build_dir = '../../build-{0}'.format(commit)
58  benchmark_out = '{0}/{1}-{2}.json'.format(os.getcwd(), name, commit)
59 
60  command = ['./'+name, '--benchmark_repetitions=7', '--benchmark_out='+benchmark_out]
61  subprocess.run(command, cwd=build_dir+'/Tests')
62 
63  report = json.load(open(benchmark_out))
64  info = report['context']
65  info['branch'] = os.environ.get('GIT_BRANCH')
66  options = kwargs
67 
68  # Aggregate the benchmark_repetitions by benchmark name
69  aggregates = self.aggregateBenchmarks(report['benchmarks'])
70  for benchmark_name, result in aggregates.items():
71  # Different tags correspond to different 'Benchmarks' in conbench
72  tags = { 'benchmark_name': benchmark_name }
73  yield self.conbench.record(
74  result, name, context=context, options=options, output=result, tags=tags, info=info
75  )
int open(const char *path, int flags, int mode)
Definition: heavyai_fs.cpp:66

+ Here is the call graph for this function:

Member Data Documentation

string benchmarks.GoogleBenchmark.description = 'Google Benchmark'
static

Definition at line 37 of file benchmarks.py.

benchmarks.GoogleBenchmark.external = True
static

Definition at line 36 of file benchmarks.py.


The documentation for this class was generated from the following file: