From 6abd8065390d96c7145f2f89bd9163613dba6fa2 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 5 Sep 2016 20:25:55 +0200 Subject: [PATCH] gsdx perf: print frame time distribution --- plugins/GSdx/GSDeviceOGL.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 6a7d8441ab..27bb0aeea5 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -191,12 +191,25 @@ void GSDeviceOGL::GenerateProfilerData() for (auto t : times) sd += pow(t-mean, 2); sd = sqrt(sd / frames); + uint32 time_repartition[16] = {0}; + for (auto t : times) { + uint32 slot = (uint32)(t/2.0); + if (slot >= countof(time_repartition)) { + slot = countof(time_repartition) - 1; + } + time_repartition[slot]++; + } + fprintf(stderr, "\nPerformance Profile for %.0f frames:\n", frames); fprintf(stderr, "Min %4.2f ms\t(%4.2f fps)\n", *minmax_time.first, 1000.0 / *minmax_time.first); fprintf(stderr, "Mean %4.2f ms\t(%4.2f fps)\n", mean, 1000.0 / mean); fprintf(stderr, "Max %4.2f ms\t(%4.2f fps)\n", *minmax_time.second, 1000.0 / *minmax_time.second); fprintf(stderr, "SD %4.2f ms\n", sd); fprintf(stderr, "\n"); + fprintf(stderr, "Frame Repartition\n"); + for (uint32 i = 0; i < countof(time_repartition); i ++) { + fprintf(stderr, "%3u ms => %3u ms\t%4u\n", 2 * i, 2 * (i+1), time_repartition[i]); + } FILE* csv = fopen("GSdx_profile.csv", "w"); if (csv) {