[SOLVED] How to measure/track execution time across pages?


I’m aware of


to track execution time, but how could I measure the time spent across pages?

Tried to put this kind of code in services but didn’t work out. For example, I want to know from app.component constructor to my first page constructor how much time is spent.

Thx in advance for your advices

https://ionicframework.com/docs/api/util/Events/ could probably help.

1 Like


In app.component:

constructor() {
    var bootTime = Date.now();
    platform.ready().then(() => {
          events.subscribe('app:boot', (time) => {
            console.log('App boot start: ', bootTime);
            console.log('App boot ready: ', readyTime);
            console.log('App boot done: ', time);
            console.log('Diff boot', time - bootTime);
            console.log('Diff ready', time - readyTime);

in my first page:

 ionViewDidLoad() {
     events.publish('app:boot', Date.now());

P.S.: I updated the solution because I thought it’s interesting to have the difference between the boot time and the app ready time

1 Like

Thanks for sharing the solution!

1 Like