From 749a0fbb5450084380bd041cbc1e7e4503d3941a Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 27 Jul 2021 23:28:01 +0900 Subject: [PATCH] example performance: improve to print average... --- src/examples/Performance.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/examples/Performance.cpp b/src/examples/Performance.cpp index cdbc9717..4e59e572 100644 --- a/src/examples/Performance.cpp +++ b/src/examples/Performance.cpp @@ -28,6 +28,7 @@ static tvg::Picture* pPicture = nullptr; static double updateTime = 0; +static double accumulateTime = 0; static uint cnt = 0; void tvgDrawCmds(tvg::Canvas* canvas) @@ -99,7 +100,11 @@ void drawSwView(void* data, Eo* obj) auto rasterTime = after - before; - printf("[%5d]: rendering = %fs\n", ++cnt, updateTime + rasterTime); + ++cnt; + + accumulateTime += (updateTime + rasterTime); + + printf("[%5d]: rendering = %fs, average = %fs\n", cnt, updateTime + rasterTime, accumulateTime / cnt); }