summaryrefslogtreecommitdiff
path: root/apps/main.c
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/main.c
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/main.c')
-rw-r--r--apps/main.c48
1 files changed, 47 insertions, 1 deletions
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