File: BenchmarkResult.cpp

package info (click to toggle)
vecgeom 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,928 kB
  • sloc: cpp: 88,717; ansic: 6,894; python: 1,035; sh: 582; sql: 538; makefile: 29
file content (34 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/// \file BenchmarkResult.cpp
/// \author Johannes de Fine Licht (johannes.definelicht@cern.ch)

#include "VecGeomBenchmark/BenchmarkResult.h"

namespace vecgeom {

char const *const BenchmarkResult::fgLibraryLabels[] = {"Specialized", "Vectorized", "Unspecialized", "CUDA",
                                                        "USolids",     "ROOT",       "CUDAMemory",    "Geant4"};

char const *const BenchmarkResult::fgMethodLabels[] = {"Contains",   "Inside",        "DistanceToIn",
                                                       "SafetyToIn", "DistanceToOut", "SafetyToOut"};

void BenchmarkResult::WriteCsvHeader(std::ostream &os)
{
  os << "elapsed,method,library,repetitions,volumes,points,bias\n";
}

void BenchmarkResult::WriteToCsv(std::ostream &os)
{
  os << elapsed << "," << fgMethodLabels[method] << "," << fgLibraryLabels[library] << "," << repetitions << ","
     << volumes << "," << points << "," << bias << "\n";
}

std::ostream &operator<<(std::ostream &os, BenchmarkResult const &benchmark)
{
  os << benchmark.elapsed << "s | " << BenchmarkResult::fgMethodLabels[benchmark.method] << " for "
     << BenchmarkResult::fgLibraryLabels[benchmark.library] << ", using " << benchmark.volumes << " volumes and "
     << benchmark.points << " points for " << benchmark.repetitions << " repetitions with a " << benchmark.bias
     << " bias.\n";
  return os;
}

} // End namespace vecgeom