From 151748e86eb2a24f08f200eb49cdc8739c7be9c4 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 8 Apr 2006 10:27:34 +0000 Subject: Test plugin for measuring LCD update speed, for developers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9562 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/test_fps.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 apps/plugins/test_fps.c (limited to 'apps/plugins') 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 Peter D'Hoye + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "plugin.h" + +#ifdef HAVE_LCD_BITMAP + +#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) +#define FPS_QUIT BUTTON_MENU +#else +#define FPS_QUIT BUTTON_OFF +#endif + +PLUGIN_HEADER + +static struct plugin_api* rb; + +/* plugin entry point */ +enum plugin_status plugin_start(struct plugin_api* api, void* parameter) +{ + char str[64]; /* text buffer */ + int time_start = 0; /* start tickcount */ + int frame_count = 0; /* frame counter */ + int part14_x = LCD_WIDTH/4; /* x-offset for 1/4 update test */ + int part14_w = LCD_WIDTH/2; /* x-size for 1/4 update test */ + int part14_y = LCD_HEIGHT/4; /* y-offset for 1/4 update test */ + int part14_h = LCD_HEIGHT/2; /* y-size for 1/4 update test */ + + /* standard stuff */ + (void)parameter; + rb = api; + + rb->lcd_clear_display(); + rb->lcd_puts(0, 0, "FPS Measurements:"); + rb->lcd_update(); + + /* TEST 1: FULL LCD UPDATE */ + frame_count = 0; + time_start = *rb->current_tick; + while(*rb->current_tick - time_start < 2*HZ) + { + rb->lcd_update(); + frame_count++; + } + + rb->snprintf(str, sizeof(str), "1:1 = %d.%d (cpu = %d)", frame_count/2, + (frame_count%2)*5, *rb->cpu_frequency ); + rb->lcd_puts(0, 1, str); + rb->lcd_update(); + + /* TEST 2: QUARTER LCD UPDATE */ + frame_count = 0; + time_start = *rb->current_tick; + while(*rb->current_tick - time_start < 2*HZ) + { + rb->lcd_update_rect(part14_x, part14_y, part14_w, part14_h); + frame_count++; + } + + rb->snprintf(str, sizeof(str), "1:4 = %d.%d (cpu = %d)", frame_count/2, + (frame_count%2)*5, *rb->cpu_frequency ); + rb->lcd_puts(0, 2, str); + rb->lcd_update(); + + /* wait until user closes plugin */ + while (rb->button_get(true) != FPS_QUIT); + + return PLUGIN_OK; +} +#endif -- cgit v1.2.3