MCPcopy Create free account
hub / github.com/RenderKit/embree / plot

Method plot

tutorials/verify/verify.cpp:7068–7105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7066
7067 template<typename Closure>
7068 void VerifyApplication::plot(std::vector<Ref<Benchmark>> benchmarks, const FileName outFileName, std::string xlabel, size_t startN, size_t endN, float f, size_t dn, const Closure& test)
7069 {
7070 std::fstream plot;
7071 plot.open(outFileName, std::fstream::out | std::fstream::trunc);
7072 plot << "set key inside right top vertical Right noreverse enhanced autotitles box linetype -1 linewidth 1.000" << std::endl;
7073 plot << "set samples 50, 50" << std::endl;
7074 plot << "set title \"" << outFileName.name() << "\"" << std::endl;
7075 plot << "set xlabel \"" + xlabel + "\"" << std::endl;
7076 if (f != 1.0f) plot << "set logscale x" << std::endl;
7077 if (benchmarks.size()) {
7078 plot << "set ylabel \"" << benchmarks[0]->unit << "\"" << std::endl;
7079 plot << "set yrange [0:]" << std::endl;
7080
7081 plot << "plot \\" << std::endl;
7082 for (size_t i=0; i<benchmarks.size(); i++) {
7083 plot << "\"" << outFileName.name() << "." << benchmarks[i]->name << ".txt\" using 1:2 title \"" << benchmarks[i]->name << "\" with lines";
7084 if (i != benchmarks.size()-1) plot << ",\\";
7085 plot << std::endl;
7086 }
7087 }
7088 plot << std::endl;
7089 plot.close();
7090
7091 for (auto benchmark : benchmarks)
7092 {
7093 std::fstream data;
7094 data.open(outFileName.name()+"."+benchmark->name+".txt", std::fstream::out | std::fstream::trunc);
7095 std::cout << benchmark->name << std::endl;
7096 for (size_t i=startN; i<=endN; i=size_t(i*f)+dn)
7097 {
7098 size_t N = i;
7099 Statistics stat = test(benchmark,N);
7100 data << " " << N << " " << stat.getAvg() << std::endl;
7101 std::cout<< " " << N << " " << stat.getAvg() << std::endl;
7102 }
7103 data.close();
7104 }
7105 }
7106
7107 int VerifyApplication::main(int argc, char** argv) try
7108 {

Callers

nothing calls this directly

Calls 5

openMethod · 0.45
nameMethod · 0.45
sizeMethod · 0.45
closeMethod · 0.45
getAvgMethod · 0.45

Tested by

no test coverage detected