In Android I could use profiler to have CPU line chart or something similar to Android chart like in below picture.
I have tried this CPU Profiler, but there is no such data. How to download such data to even make it in Excel? :)
If you are looking for how the CPU Profiler collects these data, here are the source code: cpu_usage_sampler.h and cpu_usage_sampler.cc. These code runs in a native process on Android devices as the shell user, so it may not be feasible to port them to run as a regular app.