summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTorne Wuff <torne@wolfpuppy.org.uk>2010-04-01 16:27:21 +0000
committerTorne Wuff <torne@wolfpuppy.org.uk>2010-04-01 16:27:21 +0000
commit52e528e057d7fd8d55116edf40500e0c0b3b75e8 (patch)
tree651413bf0f31fc64baeef8b4063c697d5df07baa /apps
parentf376fd2f4aa9b27f2a6299177b4cc3c014da01f3 (diff)
downloadrockbox-52e528e057d7fd8d55116edf40500e0c0b3b75e8.tar.gz
rockbox-52e528e057d7fd8d55116edf40500e0c0b3b75e8.zip
Boot charting support.
Select (B)ootchart in advanced options in configure, and logf will record timings for various stages of boot, for performance comparisons. Format logged is: BC:>function_name,123,80 where 123 is the line number, 80 is the number of ticks since boot. This can be loaded as CSV into a spreadsheet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25426 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/theme_settings.c3
-rw-r--r--apps/main.c48
-rw-r--r--apps/settings.c28
3 files changed, 76 insertions, 3 deletions
diff --git a/apps/gui/theme_settings.c b/apps/gui/theme_settings.c
index 4ab18b53fe..086dff5385 100644
--- a/apps/gui/theme_settings.c
+++ b/apps/gui/theme_settings.c
@@ -33,6 +33,7 @@
33#include "skin_engine/skin_engine.h" 33#include "skin_engine/skin_engine.h"
34#include "skin_engine/skin_fonts.h" 34#include "skin_engine/skin_fonts.h"
35#include "statusbar-skinned.h" 35#include "statusbar-skinned.h"
36#include "bootchart.h"
36 37
37 38
38/* call this after loading a .wps/.rwps or other skin files, so that the 39/* call this after loading a .wps/.rwps or other skin files, so that the
@@ -73,6 +74,7 @@ void settings_apply_skins(void)
73#ifdef HAVE_REMOTE_LCD 74#ifdef HAVE_REMOTE_LCD
74 screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN; 75 screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
75#endif 76#endif
77 CHART2(">skin load ", skins[i].suffix);
76 if (skins[i].setting[0] && skins[i].setting[0] != '-') 78 if (skins[i].setting[0] && skins[i].setting[0] != '-')
77 { 79 {
78 snprintf(buf, sizeof buf, WPS_DIR "/%s.%s", 80 snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
@@ -83,6 +85,7 @@ void settings_apply_skins(void)
83 { 85 {
84 skins[i].loadfunc(screen, NULL, true); 86 skins[i].loadfunc(screen, NULL, true);
85 } 87 }
88 CHART2("<skin load ", skins[i].suffix);
86 } 89 }
87 viewportmanager_theme_changed(THEME_STATUSBAR); 90 viewportmanager_theme_changed(THEME_STATUSBAR);
88#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 91#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
diff --git a/apps/main.c b/apps/main.c
index 7c43c0c277..487848caaf 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -75,6 +75,7 @@
75#include "icon.h" 75#include "icon.h"
76#include "viewport.h" 76#include "viewport.h"
77#include "statusbar-skinned.h" 77#include "statusbar-skinned.h"
78#include "bootchart.h"
78 79
79#ifdef IPOD_ACCESSORY_PROTOCOL 80#ifdef IPOD_ACCESSORY_PROTOCOL
80#include "iap.h" 81#include "iap.h"
@@ -136,7 +137,9 @@ int main(void)
136#endif 137#endif
137{ 138{
138 int i; 139 int i;
140 CHART(">init");
139 init(); 141 init();
142 CHART("<init");
140 FOR_NB_SCREENS(i) 143 FOR_NB_SCREENS(i)
141 { 144 {
142 screens[i].clear_display(); 145 screens[i].clear_display();
@@ -167,6 +170,7 @@ int main(void)
167 global_status.last_volume_change = 0; 170 global_status.last_volume_change = 0;
168 /* no calls INIT_ATTR functions after this point anymore! 171 /* no calls INIT_ATTR functions after this point anymore!
169 * see definition of INIT_ATTR in config.h */ 172 * see definition of INIT_ATTR in config.h */
173 CHART(">root_menu");
170 root_menu(); 174 root_menu();
171} 175}
172 176
@@ -414,13 +418,18 @@ static void init(void)
414#ifdef CPU_ARM 418#ifdef CPU_ARM
415 enable_fiq(); 419 enable_fiq();
416#endif 420#endif
421 /* current_tick should be ticking by now */
422 CHART("ticking");
423
417 lcd_init(); 424 lcd_init();
418#ifdef HAVE_REMOTE_LCD 425#ifdef HAVE_REMOTE_LCD
419 lcd_remote_init(); 426 lcd_remote_init();
420#endif 427#endif
421 font_init(); 428 font_init();
422 429
430 CHART(">show_logo");
423 show_logo(); 431 show_logo();
432 CHART("<show_logo");
424 lang_init(core_language_builtin, language_strings, 433 lang_init(core_language_builtin, language_strings,
425 LANG_LAST_INDEX_IN_ARRAY); 434 LANG_LAST_INDEX_IN_ARRAY);
426 435
@@ -436,7 +445,9 @@ static void init(void)
436 rtc_init(); 445 rtc_init();
437#endif 446#endif
438#ifdef HAVE_RTC_RAM 447#ifdef HAVE_RTC_RAM
448 CHART(">settings_load(RTC)");
439 settings_load(SETTINGS_RTC); /* early load parts of global_settings */ 449 settings_load(SETTINGS_RTC); /* early load parts of global_settings */
450 CHART("<settings_load(RTC)");
440#endif 451#endif
441 452
442 adc_init(); 453 adc_init();
@@ -460,10 +471,18 @@ static void init(void)
460 471
461 /* Keep the order of this 3 (viewportmanager handles statusbars) 472 /* Keep the order of this 3 (viewportmanager handles statusbars)
462 * Must be done before any code uses the multi-screen API */ 473 * Must be done before any code uses the multi-screen API */
474 CHART(">gui_syncstatusbar_init");
463 gui_syncstatusbar_init(&statusbars); 475 gui_syncstatusbar_init(&statusbars);
476 CHART("<gui_syncstatusbar_init");
477 CHART(">sb_skin_init");
464 sb_skin_init(); 478 sb_skin_init();
479 CHART("<sb_skin_init");
480 CHART(">gui_sync_wps_init");
465 gui_sync_wps_init(); 481 gui_sync_wps_init();
482 CHART("<gui_sync_wps_init");
483 CHART(">viewportmanager_init");
466 viewportmanager_init(); 484 viewportmanager_init();
485 CHART("<viewportmanager_init");
467 486
468#if CONFIG_CHARGING && (CONFIG_CPU == SH7034) 487#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
469 /* charger_inserted() can't be used here because power_thread() 488 /* charger_inserted() can't be used here because power_thread()
@@ -483,7 +502,9 @@ static void init(void)
483 } 502 }
484#endif 503#endif
485 504
505 CHART(">storage_init");
486 rc = storage_init(); 506 rc = storage_init();
507 CHART("<storage_init");
487 if(rc) 508 if(rc)
488 { 509 {
489#ifdef HAVE_LCD_BITMAP 510#ifdef HAVE_LCD_BITMAP
@@ -498,7 +519,9 @@ static void init(void)
498 } 519 }
499 520
500#ifdef HAVE_EEPROM_SETTINGS 521#ifdef HAVE_EEPROM_SETTINGS
522 CHART(">eeprom_settings_init");
501 eeprom_settings_init(); 523 eeprom_settings_init();
524 CHART("<eeprom_settings_init");
502#endif 525#endif
503 526
504#ifndef HAVE_USBSTACK 527#ifndef HAVE_USBSTACK
@@ -527,7 +550,9 @@ static void init(void)
527 550
528 if (!mounted) 551 if (!mounted)
529 { 552 {
553 CHART(">disk_mount_all");
530 rc = disk_mount_all(); 554 rc = disk_mount_all();
555 CHART("<disk_mount_all");
531 if (rc<=0) 556 if (rc<=0)
532 { 557 {
533 lcd_clear_display(); 558 lcd_clear_display();
@@ -561,19 +586,32 @@ static void init(void)
561 } 586 }
562 else 587 else
563#endif 588#endif
589 {
590 CHART(">settings_load(ALL)");
564 settings_load(SETTINGS_ALL); 591 settings_load(SETTINGS_ALL);
592 CHART("<settings_load(ALL)");
593 }
565 594
566 if (init_dircache(true) < 0) 595 CHART(">init_dircache(true)");
596 rc = init_dircache(true);
597 CHART("<init_dircache(true");
598 if (rc < 0)
567 { 599 {
568#ifdef HAVE_TAGCACHE 600#ifdef HAVE_TAGCACHE
569 remove(TAGCACHE_STATEFILE); 601 remove(TAGCACHE_STATEFILE);
570#endif 602#endif
571 } 603 }
572 604
605 CHART(">settings_apply(true)");
573 settings_apply(true); 606 settings_apply(true);
607 CHART("<settings_apply(true)");
608 CHART(">init_dircache(false)");
574 init_dircache(false); 609 init_dircache(false);
610 CHART("<init_dircache(false)");
575#ifdef HAVE_TAGCACHE 611#ifdef HAVE_TAGCACHE
612 CHART(">init_tagcache");
576 init_tagcache(); 613 init_tagcache();
614 CHART("<init_tagcache");
577#endif 615#endif
578 616
579#ifdef HAVE_EEPROM_SETTINGS 617#ifdef HAVE_EEPROM_SETTINGS
@@ -581,7 +619,9 @@ static void init(void)
581 { 619 {
582 /* In case we crash. */ 620 /* In case we crash. */
583 firmware_settings.disk_clean = false; 621 firmware_settings.disk_clean = false;
622 CHART(">eeprom_settings_store");
584 eeprom_settings_store(); 623 eeprom_settings_store();
624 CHART("<eeprom_settings_store");
585 } 625 }
586#endif 626#endif
587 playlist_init(); 627 playlist_init();
@@ -614,7 +654,9 @@ static void init(void)
614 talk_init(); 654 talk_init();
615#endif /* CONFIG_CODEC != SWCODEC */ 655#endif /* CONFIG_CODEC != SWCODEC */
616 656
657 CHART(">audio_init");
617 audio_init(); 658 audio_init();
659 CHART("<audio_init");
618 660
619#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR) 661#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && !defined(SIMULATOR)
620 pcm_rec_init(); 662 pcm_rec_init();
@@ -636,9 +678,13 @@ static void init(void)
636 lineout_set(global_settings.lineout_active); 678 lineout_set(global_settings.lineout_active);
637#endif 679#endif
638#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN 680#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
681 CHART("<check_bootfile(false)");
639 check_bootfile(false); /* remember write time and filesize */ 682 check_bootfile(false); /* remember write time and filesize */
683 CHART(">check_bootfile(false)");
640#endif 684#endif
685 CHART("<settings_apply_skins");
641 settings_apply_skins(); 686 settings_apply_skins();
687 CHART(">settings_apply_skins");
642} 688}
643 689
644#ifdef CPU_PP 690#ifdef CPU_PP
diff --git a/apps/settings.c b/apps/settings.c
index 412bedc464..d5fd98e70a 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -70,6 +70,7 @@
70#include "skin_engine/skin_engine.h" 70#include "skin_engine/skin_engine.h"
71#include "viewport.h" 71#include "viewport.h"
72#include "statusbar-skinned.h" 72#include "statusbar-skinned.h"
73#include "bootchart.h"
73 74
74#if CONFIG_CODEC == MAS3507D 75#if CONFIG_CODEC == MAS3507D
75void dac_line_in(bool enable); 76void dac_line_in(bool enable);
@@ -745,6 +746,7 @@ void settings_apply(bool read_disk)
745{ 746{
746 747
747 char buf[64]; 748 char buf[64];
749 int rc;
748#if CONFIG_CODEC == SWCODEC 750#if CONFIG_CODEC == SWCODEC
749 int i; 751 int i;
750#endif 752#endif
@@ -841,7 +843,10 @@ void settings_apply(bool read_disk)
841 && global_settings.font_file[0] != '-') { 843 && global_settings.font_file[0] != '-') {
842 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", 844 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
843 global_settings.font_file); 845 global_settings.font_file);
844 if (font_load(NULL, buf) < 0) 846 CHART2(">font_load ", global_settings.font_file);
847 rc = font_load(NULL, buf);
848 CHART2("<font_load ", global_settings.font_file);
849 if (rc < 0)
845 font_reset(NULL); 850 font_reset(NULL);
846 } 851 }
847 else 852 else
@@ -851,7 +856,10 @@ void settings_apply(bool read_disk)
851 && global_settings.remote_font_file[0] != '-') { 856 && global_settings.remote_font_file[0] != '-') {
852 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", 857 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
853 global_settings.remote_font_file); 858 global_settings.remote_font_file);
854 if (font_load_remoteui(buf) < 0) 859 CHART2(">font_load_remoteui ", global_settings.remote_font_file);
860 rc = font_load_remoteui(buf);
861 CHART2("<font_load_remoteui ", global_settings.remote_font_file);
862 if (rc < 0)
855 font_load_remoteui(NULL); 863 font_load_remoteui(NULL);
856 } 864 }
857 else 865 else
@@ -860,7 +868,9 @@ void settings_apply(bool read_disk)
860 if ( global_settings.kbd_file[0]) { 868 if ( global_settings.kbd_file[0]) {
861 snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd", 869 snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
862 global_settings.kbd_file); 870 global_settings.kbd_file);
871 CHART(">load_kbd");
863 load_kbd(buf); 872 load_kbd(buf);
873 CHART("<load_kbd");
864 } 874 }
865 else 875 else
866 load_kbd(NULL); 876 load_kbd(NULL);
@@ -869,16 +879,26 @@ void settings_apply(bool read_disk)
869 if ( global_settings.lang_file[0]) { 879 if ( global_settings.lang_file[0]) {
870 snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", 880 snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
871 global_settings.lang_file); 881 global_settings.lang_file);
882 CHART(">lang_core_load");
872 lang_core_load(buf); 883 lang_core_load(buf);
884 CHART("<lang_core_load");
885 CHART(">talk_init");
873 talk_init(); /* use voice of same language */ 886 talk_init(); /* use voice of same language */
887 CHART("<talk_init");
874 } 888 }
875 889
876 /* load the icon set */ 890 /* load the icon set */
891 CHART(">icons_init");
877 icons_init(); 892 icons_init();
893 CHART("<icons_init");
878 894
879#ifdef HAVE_LCD_COLOR 895#ifdef HAVE_LCD_COLOR
880 if (global_settings.colors_file[0]) 896 if (global_settings.colors_file[0])
897 {
898 CHART(">read_color_theme_file");
881 read_color_theme_file(); 899 read_color_theme_file();
900 CHART("<read_color_theme_file");
901 }
882#endif 902#endif
883 } 903 }
884#ifdef HAVE_LCD_COLOR 904#ifdef HAVE_LCD_COLOR
@@ -901,7 +921,9 @@ void settings_apply(bool read_disk)
901 lcd_scroll_delay(global_settings.scroll_delay); 921 lcd_scroll_delay(global_settings.scroll_delay);
902 922
903 923
924 CHART(">set_codepage");
904 set_codepage(global_settings.default_codepage); 925 set_codepage(global_settings.default_codepage);
926 CHART("<set_codepage");
905 927
906#if CONFIG_CODEC == SWCODEC 928#if CONFIG_CODEC == SWCODEC
907#ifdef HAVE_CROSSFADE 929#ifdef HAVE_CROSSFADE
@@ -966,7 +988,9 @@ void settings_apply(bool read_disk)
966#endif 988#endif
967#ifdef HAVE_LCD_BITMAP 989#ifdef HAVE_LCD_BITMAP
968 /* already called with THEME_STATUSBAR in settings_apply_skins() */ 990 /* already called with THEME_STATUSBAR in settings_apply_skins() */
991 CHART(">viewportmanager_theme_changed");
969 viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE|THEME_BUTTONBAR); 992 viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE|THEME_BUTTONBAR);
993 CHART("<viewportmanager_theme_changed");
970#endif 994#endif
971} 995}
972 996