diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-04-01 17:50:36 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-04-01 17:50:36 +0000 |
commit | 44e48393665f5fdb0dbe93fdab5f9b94057ad658 (patch) | |
tree | dc0b5e16af81374a71d04a608414c9273b33e778 /apps | |
parent | eef7f343c24ecd4597f6fd7e9b16ea81d38dab52 (diff) | |
download | rockbox-44e48393665f5fdb0dbe93fdab5f9b94057ad658.tar.gz rockbox-44e48393665f5fdb0dbe93fdab5f9b94057ad658.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/CATEGORIES | 1 | ||||
-rw-r--r-- | 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 | |||
99 | stats,apps | 99 | stats,apps |
100 | stopwatch,apps | 100 | stopwatch,apps |
101 | sudoku,games | 101 | sudoku,games |
102 | test_boost,apps | ||
102 | test_codec,viewers | 103 | test_codec,viewers |
103 | test_disk,apps | 104 | test_disk,apps |
104 | test_fps,apps | 105 | 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) | |||
29 | bool done = false; | 29 | bool done = false; |
30 | bool boost = false; | 30 | bool boost = false; |
31 | int count = 0; | 31 | int count = 0; |
32 | int last_count = 0; | ||
33 | int last_tick = *rb->current_tick; | ||
34 | int per_sec = 0; | ||
32 | 35 | ||
33 | rb->lcd_setfont(FONT_SYSFIXED); | 36 | rb->lcd_setfont(FONT_SYSFIXED); |
34 | 37 | ||
35 | while (!done) | 38 | while (!done) |
36 | { | 39 | { |
37 | char buf[32]; | ||
38 | int j,x; | 40 | int j,x; |
39 | for (j=1; j<100000; j++) | 41 | for (j=1; j<100000; j++) |
40 | x = j*11; | 42 | x = j*11; |
41 | rb->lcd_clear_display(); | 43 | rb->screens[0]->clear_display(); |
42 | rb->snprintf(buf,sizeof buf, "%s %d",boost?"boost":"normal",count); | 44 | rb->screens[0]->putsf(0, 0, "%s: %d",boost?"boost":"normal",count); |
43 | rb->lcd_putsxy(0, 0, buf); | 45 | if (TIME_AFTER(*rb->current_tick, last_tick+HZ)) |
44 | rb->lcd_update(); | 46 | { |
47 | last_tick = *rb->current_tick; | ||
48 | per_sec = count-last_count; | ||
49 | last_count = count; | ||
50 | } | ||
51 | rb->screens[0]->putsf(0, 1, "loops/s: %d", per_sec); | ||
52 | rb->screens[0]->update(); | ||
45 | count++; | 53 | count++; |
46 | 54 | ||
47 | int button = rb->button_get(false); | 55 | int button = rb->button_get(false); |
48 | switch (button) | 56 | switch (button) |
49 | { | 57 | { |
50 | case BUTTON_UP: | 58 | case BUTTON_UP: |
51 | boost = true; | 59 | if (!boost) |
52 | rb->cpu_boost(boost); | 60 | { |
61 | rb->cpu_boost(true); | ||
62 | boost = true; | ||
63 | } | ||
53 | break; | 64 | break; |
54 | 65 | ||
55 | case BUTTON_DOWN: | 66 | case BUTTON_DOWN: |
56 | boost = false; | 67 | if (boost) |
57 | rb->cpu_boost(boost); | 68 | { |
69 | rb->cpu_boost(false); | ||
70 | boost = false; | ||
71 | } | ||
58 | break; | 72 | break; |
59 | 73 | ||
60 | case BUTTON_LEFT: | 74 | case BUTTON_LEFT: |