| 80 | // <- |
| 81 | |
| 82 | void Benchmark::parseBenchmark(rapidjson::Document& p_BenchmarkDesc) |
| 83 | { |
| 84 | const _INTR_STRING& worldFilePath = World::_filePath; |
| 85 | |
| 86 | _INTR_STRING worldFileName, worldFileExtension; |
| 87 | StringUtil::extractFileNameAndExtension(worldFilePath, worldFileName, |
| 88 | worldFileExtension); |
| 89 | |
| 90 | // Parse benchmark |
| 91 | _INTR_STRING filePath = "worlds/" + worldFileName + ".benchmark.json"; |
| 92 | |
| 93 | { |
| 94 | FILE* fp = fopen(filePath.c_str(), "rb"); |
| 95 | |
| 96 | if (fp == nullptr) |
| 97 | { |
| 98 | _INTR_LOG_ERROR("Failed to load benchmark from file '%s'...", |
| 99 | filePath.c_str()); |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | char* readBuffer = (char*)Memory::Tlsf::MainAllocator::allocate(65536u); |
| 104 | { |
| 105 | rapidjson::FileReadStream is(fp, readBuffer, 65536u); |
| 106 | p_BenchmarkDesc.ParseStream(is); |
| 107 | fclose(fp); |
| 108 | } |
| 109 | Memory::Tlsf::MainAllocator::free(readBuffer); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | // <- |
| 114 |
nothing calls this directly
no test coverage detected