Commit 82386df3 authored by abmyii's avatar abmyii
Browse files

Add average fps calculation

parent 4cce69c6
......@@ -611,6 +611,8 @@ void do_screencast(EGLSetup const& egl_setup,
rfbRunEventLoop(rfbScreen,-1,TRUE);
fprintf(stderr, "Running vnc background loop...\n");
std::vector<double> fps_arr;
while (running)
{
auto time_point = std::chrono::steady_clock::now() + capture_period;
......@@ -620,6 +622,10 @@ void do_screencast(EGLSetup const& egl_setup,
auto finish = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = finish - start;
std::cout << "Elapsed time: " << elapsed.count() << " s, " << 1/elapsed.count() << " fps\n";
fps_arr.push_back(1/elapsed.count());
float average = accumulate(fps_arr.begin(), fps_arr.end(), 0.0)/fps_arr.size();
std::cout << "Average FPS: " << average << std::endl;
if (maxx/maxy != rfbScreen->width/rfbScreen->height) {
printf("Ratios don't match\n");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment