From f3bc6d6165ab24425589032bcd2762b3095b87dd Mon Sep 17 00:00:00 2001 From: Roz K Date: Sat, 17 Dec 2022 14:14:11 +0100 Subject: [PATCH] Update timings. --- game/game.py | 29 +++++++++++++++-------------- rk_island-profile.sh | 3 --- 2 files changed, 15 insertions(+), 17 deletions(-) delete mode 100755 rk_island-profile.sh diff --git a/game/game.py b/game/game.py index aafce7a..7293b8d 100644 --- a/game/game.py +++ b/game/game.py @@ -150,8 +150,8 @@ def main(): draw_avg = 0.0 perf_count = 0 try: - for x in range(10000): - current_time = time.monotonic() - start_time + for frame in range(10000): + current_time = 0 #time.monotonic() - start_time begin_frame() frame_begin = time.thread_time() @@ -219,15 +219,16 @@ def main(): frame_end = time.thread_time() end_frame() - draw_ms = draw_end - draw_begin - draw_min = min(draw_min, draw_ms) - draw_max = max(draw_max, draw_ms) - draw_avg += draw_ms - frame_ms = frame_end - frame_begin - frame_min = min(frame_min, frame_ms) - frame_max = max(frame_max, frame_ms) - frame_avg += frame_ms - perf_count += 1 + if frame > 0: + draw_ms = draw_end - draw_begin + draw_min = min(draw_min, draw_ms) + draw_max = max(draw_max, draw_ms) + draw_avg += draw_ms + frame_ms = frame_end - frame_begin + frame_min = min(frame_min, frame_ms) + frame_max = max(frame_max, frame_ms) + frame_avg += frame_ms + perf_count += 1 except KeyboardInterrupt: pass @@ -246,9 +247,9 @@ def main(): # lookat = vec3((0.0, 500.0, -500.0)) # for x in range(10000) # current_time = 0 - # Draw * 10000 : min = 0.11 , max = 1.87 , avg = 0.16 ms - # Draw * 10000 : min = 0.11 , max = 1.75 , avg = 0.17 ms - # Draw * 10000 : min = 0.11 , max = 1.84 , avg = 0.17 ms + # Draw * 9999 : min = 0.18 , max = 1.98 , avg = 0.24 ms + # Draw * 9999 : min = 0.21 , max = 2.19 , avg = 0.27 ms + # Draw * 9999 : min = 0.19 , max = 2.13 , avg = 0.25 ms print("Quitting...") del tests_batch diff --git a/rk_island-profile.sh b/rk_island-profile.sh deleted file mode 100755 index 6482e55..0000000 --- a/rk_island-profile.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -me=$(whoami) -exec sudo /bin/nice --adjustment=-20 su $me -c "exec python3 -O rk_island.py"