MCPcopy Create free account
hub / github.com/begla/Intrinsic / parseBenchmark

Method parseBenchmark

IntrinsicCore/src/IntrinsicCoreGameStatesBenchmark.cpp:82–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80// <-
81
82void 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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected