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
|