glmark2代码分析3(计分方式)
·
计分方式
glmark2的得分计是每个用例的平均帧率之和:
打印位置:/home/work/develop/glmark2/src/main.cpp:
125 Log::info("=======================================================\n");
126: Log::info(" glmark2 Score: %u \n", loop->score());
127 Log::info("=======================================================\n");
MainLoop::score()中返回最终的得分,benchmark的平均得分
if (benchmarks_run_)
return score_ / benchmarks_run_;
else
return score_;
MainLoop::step() 中计算执行成功的benmark个数和scene score之和,step在main中定义为死循环while (loop->step());
score_ += scene_->average_fps();
benchmarks_run_++;
函数Scene::average_fps()中计算改scene的平均帧率
double elapsed_time = lastUpdateTime_ - startTime_;
return currentFrame_ / elapsed_time;
每次循环调用的更新函数Scene::update()中对lastUpdateTime_和currentFrame_进行更新。
double current_time = Util::get_timestamp_us() / 1000000.0;
currentFrame_++;
lastUpdateTime_ = current_time;
在Scene::setup()中初始化开始时间和帧数。
currentFrame_ = 0;
startTime_ = Util::get_timestamp_us() / 1000000.0;
lastUpdateTime_ = startTime_;
更多推荐


所有评论(0)