From: Marek Olšák <marek.ol...@amd.com> for easier data processing. --- tests/perf/common.c | 19 ------------------- tests/perf/common.h | 3 --- tests/perf/drawoverhead.c | 8 ++++---- 3 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/tests/perf/common.c b/tests/perf/common.c index e157d82c5..791b7f943 100644 --- a/tests/perf/common.c +++ b/tests/perf/common.c @@ -89,29 +89,10 @@ perf_measure_rate(perf_rate_func f) else break; prevRate = rate; } if (0) printf("%s returning iters %u rate %f\n", __FUNCTION__, subiters, rate); return rate; } - -/* Note static buffer, can only use once per printf. - */ -const char * -perf_human_float( double d ) -{ - static char buf[80]; - - if (d > 1000000000.0) - snprintf(buf, sizeof(buf), "%.2f billion", d / 1000000000.0); - else if (d > 1000000.0) - snprintf(buf, sizeof(buf), "%.2f million", d / 1000000.0); - else if (d > 1000.0) - snprintf(buf, sizeof(buf), "%.2f thousand", d / 1000.0); - else - snprintf(buf, sizeof(buf), "%.2f", d); - - return buf; -} diff --git a/tests/perf/common.h b/tests/perf/common.h index daa0d42ab..0da3b7b5f 100644 --- a/tests/perf/common.h +++ b/tests/perf/common.h @@ -20,15 +20,12 @@ */ #ifndef COMMON_H #define COMMON_H typedef void (*perf_rate_func)(unsigned count); double perf_measure_rate(perf_rate_func f); -const char * -perf_human_float( double d ); - #endif /* COMMON_H */ diff --git a/tests/perf/drawoverhead.c b/tests/perf/drawoverhead.c index 2bc04fabf..b30d7d46a 100644 --- a/tests/perf/drawoverhead.c +++ b/tests/perf/drawoverhead.c @@ -34,21 +34,20 @@ PIGLIT_GL_TEST_CONFIG_BEGIN for (int i = 1; i < argc; i++) { if (!strcmp(argv[i], "-compat")) { config.supports_gl_compat_version = 10; config.supports_gl_core_version = 0; is_compat = true; break; } } puts(config.supports_gl_core_version ? "Using Core profile." : "Using Compatibility profile."); - puts("Draw calls per second:"); config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL; PIGLIT_GL_TEST_CONFIG_END static GLuint prog[2], uniform_loc, tex[8], ubo[4], tbo[8]; static bool indexed; static GLenum enable_enum; @@ -638,33 +637,33 @@ perf_run(const char *call, unsigned num_vbos, unsigned num_ubos, unsigned num_textures, unsigned num_tbos, unsigned num_images, unsigned num_imgbos, const char *change, perf_rate_func f, double base_rate) { static unsigned test_index; test_index++; double rate = perf_measure_rate(f); double ratio = base_rate ? rate / base_rate : 1; - printf(" %3u: %s (%2u VBO, %u UBO, %2u %s) w/ %s change:%*s" - COLOR_CYAN "%s" COLOR_RESET " %s(%.1f%%)" COLOR_RESET "\n", + printf(" %3u, %s (%2u VBO| %u UBO| %2u %s) w/ %s change,%*s" + COLOR_CYAN "%5u" COLOR_RESET ", %s%.1f%%" COLOR_RESET "\n", test_index, call, num_vbos, num_ubos, num_textures ? num_textures : num_tbos ? num_tbos : num_images ? num_images : num_imgbos, num_textures ? "Tex" : num_tbos ? "TBO" : num_images ? "Img" : num_imgbos ? "ImB" : " ", change, MAX2(36 - (int)strlen(change) - (int)strlen(call), 0), "", - perf_human_float(rate), + (unsigned)(rate / 1000), base_rate == 0 ? COLOR_RESET : ratio > 0.7 ? COLOR_GREEN : ratio > 0.4 ? COLOR_YELLOW : COLOR_RED, 100 * ratio); return rate; } struct enable_state_t { GLenum enable; const char *name; @@ -818,16 +817,17 @@ perf_draw_variant(const char *call, bool is_indexed) enable_states[state].name, draw_state_change, base_rate); } } } /** Called from test harness/main */ enum piglit_result piglit_display(void) { + puts(" #, Test name , Thousands draws/s, Difference vs the 1st"); perf_draw_variant("DrawElements", true); perf_draw_variant("DrawArrays", false); exit(0); return PIGLIT_SKIP; } -- 2.17.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit