1
0
Fork 0
forked from len0rd/rockbox

test_gfx: Add benchmark for put_line().

Change-Id: I94cd5cec5ce169a4ddb60fcb3c09e2ffb50a3401
This commit is contained in:
Thomas Martitz 2014-01-07 14:06:26 +01:00
parent 5aa5a923f3
commit 2ef9aa51f3

View file

@ -399,6 +399,60 @@ static void time_text(void) /* tests mono_bitmap performance */
count1, count2, count3, count4);
}
static void time_put_line(void) /* tests put_line performance */
{
long time_start, time_end;
int count1, count2, count3, count4;
struct screen *display = rb->screens[SCREEN_MAIN];
const char fmt[] = "$iRockbox!";
rb->lcd_setfont(FONT_SYSFIXED);
count1 = count2 = count3 = count4 = 0;
struct line_desc desc = LINE_DESC_DEFINIT;
rb->sleep(0); /* sync to tick */
time_start = *rb->current_tick;
while((time_end = *rb->current_tick) - time_start < DURATION)
{
unsigned rnd = rand_table[count1++ & 0x3ff];
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
}
desc.style = STYLE_INVERT;
rb->sleep(0); /* sync to tick */
time_start = *rb->current_tick;
while((time_end = *rb->current_tick) - time_start < DURATION)
{
unsigned rnd = rand_table[count2++ & 0x3ff];
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
}
desc.style = STYLE_COLORBAR;
rb->sleep(0); /* sync to tick */
time_start = *rb->current_tick;
while((time_end = *rb->current_tick) - time_start < DURATION)
{
unsigned rnd = rand_table[count3++ & 0x3ff];
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
}
desc.style = STYLE_GRADIENT;
rb->sleep(0); /* sync to tick */
time_start = *rb->current_tick;
while((time_end = *rb->current_tick) - time_start < DURATION)
{
unsigned rnd = rand_table[count4++ & 0x3ff];
display->put_line((rnd >> 8) & 0x3f, rnd & 0x3f, &desc, fmt, Icon_Audio);
}
rb->fdprintf(log_fd, "\nput_line (lines (icon+text)/s): \n"
" default: %d\n"
" inverted: %d\n"
" colorbar: %d\n"
" gradient: %d\n",
count1, count2, count3, count4);
}
/* plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
@ -444,7 +498,7 @@ enum plugin_status plugin_start(const void* parameter)
backlight_ignore_timeout();
rb->splashf(0, "LCD driver performance test, please wait %d sec",
6*4*DURATION/HZ);
7*4*DURATION/HZ);
init_rand_table();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@ -457,6 +511,7 @@ enum plugin_status plugin_start(const void* parameter)
time_vline();
time_fillrect();
time_text();
time_put_line();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
if (*rb->cpu_frequency != cpu_freq)