diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-04-08 10:27:34 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-04-08 10:27:34 +0000 |
commit | 151748e86eb2a24f08f200eb49cdc8739c7be9c4 (patch) | |
tree | 4cd55acc1d8441dd869300534107a00da2f86cdb /apps | |
parent | 4ac150e8d3549eb9c06fba71aca88337b59bf7eb (diff) | |
download | rockbox-151748e86eb2a24f08f200eb49cdc8739c7be9c4.tar.gz rockbox-151748e86eb2a24f08f200eb49cdc8739c7be9c4.zip |
Test plugin for measuring LCD update speed, for developers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9562 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/plugins/test_fps.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c new file mode 100755 index 0000000000..24dbcf8b2a --- /dev/null +++ b/apps/plugins/test_fps.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 Peter D'Hoye | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "plugin.h" | ||
20 | |||
21 | #ifdef HAVE_LCD_BITMAP | ||
22 | |||
23 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
24 | #define FPS_QUIT BUTTON_MENU | ||
25 | #else | ||
26 | #define FPS_QUIT BUTTON_OFF | ||
27 | #endif | ||
28 | |||
29 | PLUGIN_HEADER | ||
30 | |||
31 | static struct plugin_api* rb; | ||
32 | |||
33 | /* plugin entry point */ | ||
34 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
35 | { | ||
36 | char str[64]; /* text buffer */ | ||
37 | int time_start = 0; /* start tickcount */ | ||
38 | int frame_count = 0; /* frame counter */ | ||
39 | int part14_x = LCD_WIDTH/4; /* x-offset for 1/4 update test */ | ||
40 | int part14_w = LCD_WIDTH/2; /* x-size for 1/4 update test */ | ||
41 | int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */ | ||
42 | int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */ | ||
43 | |||
44 | /* standard stuff */ | ||
45 | (void)parameter; | ||
46 | rb = api; | ||
47 | |||
48 | rb->lcd_clear_display(); | ||
49 | rb->lcd_puts(0, 0, "FPS Measurements:"); | ||
50 | rb->lcd_update(); | ||
51 | |||
52 | /* TEST 1: FULL LCD UPDATE */ | ||
53 | frame_count = 0; | ||
54 | time_start = *rb->current_tick; | ||
55 | while(*rb->current_tick - time_start < 2*HZ) | ||
56 | { | ||
57 | rb->lcd_update(); | ||
58 | frame_count++; | ||
59 | } | ||
60 | |||
61 | rb->snprintf(str, sizeof(str), "1:1 = %d.%d (cpu = %d)", frame_count/2, | ||
62 | (frame_count%2)*5, *rb->cpu_frequency ); | ||
63 | rb->lcd_puts(0, 1, str); | ||
64 | rb->lcd_update(); | ||
65 | |||
66 | /* TEST 2: QUARTER LCD UPDATE */ | ||
67 | frame_count = 0; | ||
68 | time_start = *rb->current_tick; | ||
69 | while(*rb->current_tick - time_start < 2*HZ) | ||
70 | { | ||
71 | rb->lcd_update_rect(part14_x, part14_y, part14_w, part14_h); | ||
72 | frame_count++; | ||
73 | } | ||
74 | |||
75 | rb->snprintf(str, sizeof(str), "1:4 = %d.%d (cpu = %d)", frame_count/2, | ||
76 | (frame_count%2)*5, *rb->cpu_frequency ); | ||
77 | rb->lcd_puts(0, 2, str); | ||
78 | rb->lcd_update(); | ||
79 | |||
80 | /* wait until user closes plugin */ | ||
81 | while (rb->button_get(true) != FPS_QUIT); | ||
82 | |||
83 | return PLUGIN_OK; | ||
84 | } | ||
85 | #endif | ||