Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster start/boot up time #8

Closed
fweiss opened this issue Jul 3, 2024 · 7 comments
Closed

Faster start/boot up time #8

fweiss opened this issue Jul 3, 2024 · 7 comments

Comments

@fweiss
Copy link
Owner

fweiss commented Jul 3, 2024

It takes about 3.5 sec from power on to first display. Maybe we can get the display up faster. One theory is the BT code is coming up first, but hmm, there is a separate core for that. Compressing to bitmaps may also help.

Note there is a Profiler class that could help.

@fweiss
Copy link
Owner Author

fweiss commented Jul 5, 2024

Running profiler in main.cpp:mainTask(), with profiler.stopTask() right after badgeService.init();

I (1065) Profiler: started
I (1885) Profiler:  not started
I (3185) Profiler: samples: 1 run time: 853986 average (us): 853986

According to the profiler, the interval is 854 ms, but by the log timestamp it's 2,120 ms. The Profiler: not started is supposably from the AnimationProgram class.

See corrected profiler time below.

@fweiss
Copy link
Owner Author

fweiss commented Jul 5, 2024

Still not clear about the disparity betwen the log and the profiler timestamps.

Here's a rough breakout of the start up process times:

  • 384 boot
  • 975 system start to app_main
  • 750 motion
  • 1630 BT
    Total ~3739

Some ideas:

  • start animation task on core 1 before BT on core 0
  • start motion on low priority task or after animation task

This might shave 2 s off of startup to first display

@fweiss
Copy link
Owner Author

fweiss commented Jul 5, 2024

Corrected profile times, from start of app_main() to just after animator.start():

I (1005) Profiler: started
I (3425) BLEService: received add char event: 49
I (5005) Profiler: samples: 1 run time: 2452086 average (us): 2452086

So in this case, the disparity is:

  • 3425 log timestamp
  • 2452 profiler timestamp

Or 973 ms. This matches the system start time. Note that the profiler is started at 1005.

Note that the 5005 log timestamp is due to the profiler timer.

@fweiss
Copy link
Owner Author

fweiss commented Jul 7, 2024

Moved the bluetooth initialization just after profiler.stopTime() and just before the for(;;) in mainTask. This visually reduced start time from appox 3.5 s to 2.5 sec

I (3005) Profiler: samples: 1 run time: 867300 average (us): 867300

Profiler reduction from 2452 ms to 867 ms, saving 1585 ms.

@fweiss
Copy link
Owner Author

fweiss commented Jul 7, 2024

Moved the motion initialization just before the BT initialization. This reduced the apparent start time to just about 2 s.

I (3005) Profiler: samples: 1 run time: 107828 average (us): 107828

This is actually quite snappy. It's even apparently faster when booting up from battery via the switch, like just a bit over 1 s.

@fweiss
Copy link
Owner Author

fweiss commented Jul 7, 2024

Here's a revised rough breakout of the start up process times:

  • 385 boot
  • 590 system start to app_main()
  • 140 animation (including some BLEService)
  • 740 motion
  • 1150 nvs and efuse stuff
  • 280 BT register characteristics

Total 3285. Subtotal for animation 1115.

fweiss added a commit that referenced this issue Jul 8, 2024
@fweiss
Copy link
Owner Author

fweiss commented Jul 19, 2024

The improvement has been adequate to speed up the the development cycle time. Flashing is now the larger portion.

@fweiss fweiss closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant