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

Method readDatabase

tutorials/verify/verify.cpp:453–478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451 }
452
453 double VerifyApplication::Benchmark::readDatabase(VerifyApplication* state)
454 {
455 std::fstream db;
456 FileName base = state->database+FileName(name);
457 db.open(base.addExt(".txt"), std::fstream::in);
458 double start_value = higher_is_better ? double(neg_inf) : double(pos_inf);
459 if (!db.is_open()) return start_value;
460
461 double bestAvg = start_value;
462 while (true)
463 {
464 std::string line; std::getline(db,line);
465 if (db.eof()) break;
466 if (line == "") { bestAvg = start_value; continue; }
467 std::stringstream linestream(line);
468 std::string hash; linestream >> hash;
469 double avg; linestream >> avg;
470 if (higher_is_better) {
471 if (avg > bestAvg) bestAvg = avg;
472 } else {
473 if (avg < bestAvg) bestAvg = avg;
474 }
475 }
476 db.close();
477 return bestAvg;
478 }
479
480 void VerifyApplication::Benchmark::updateDatabase(VerifyApplication* state, Statistics stat, double bestAvg)
481 {

Callers

nothing calls this directly

Calls 4

FileNameClass · 0.85
addExtMethod · 0.80
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected