From 44e48393665f5fdb0dbe93fdab5f9b94057ad658 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 1 Apr 2010 17:50:36 +0000 Subject: Fix test_boost boost handling. Also show the number of loops per second. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25429 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/CATEGORIES | 1 + apps/plugins/test_boost.c | 32 +++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES index f1e18832bc..f61ff9b69f 100644 --- a/apps/plugins/CATEGORIES +++ b/apps/plugins/CATEGORIES @@ -99,6 +99,7 @@ starfield,demos stats,apps stopwatch,apps sudoku,games +test_boost,apps test_codec,viewers test_disk,apps test_fps,apps diff --git a/apps/plugins/test_boost.c b/apps/plugins/test_boost.c index 0cd2696e33..cd38932b1b 100644 --- a/apps/plugins/test_boost.c +++ b/apps/plugins/test_boost.c @@ -29,32 +29,46 @@ enum plugin_status plugin_start(const void* parameter) bool done = false; bool boost = false; int count = 0; + int last_count = 0; + int last_tick = *rb->current_tick; + int per_sec = 0; rb->lcd_setfont(FONT_SYSFIXED); while (!done) { - char buf[32]; int j,x; for (j=1; j<100000; j++) x = j*11; - rb->lcd_clear_display(); - rb->snprintf(buf,sizeof buf, "%s %d",boost?"boost":"normal",count); - rb->lcd_putsxy(0, 0, buf); - rb->lcd_update(); + rb->screens[0]->clear_display(); + rb->screens[0]->putsf(0, 0, "%s: %d",boost?"boost":"normal",count); + if (TIME_AFTER(*rb->current_tick, last_tick+HZ)) + { + last_tick = *rb->current_tick; + per_sec = count-last_count; + last_count = count; + } + rb->screens[0]->putsf(0, 1, "loops/s: %d", per_sec); + rb->screens[0]->update(); count++; int button = rb->button_get(false); switch (button) { case BUTTON_UP: - boost = true; - rb->cpu_boost(boost); + if (!boost) + { + rb->cpu_boost(true); + boost = true; + } break; case BUTTON_DOWN: - boost = false; - rb->cpu_boost(boost); + if (boost) + { + rb->cpu_boost(false); + boost = false; + } break; case BUTTON_LEFT: -- cgit v1.2.3