How to get app startup time?

Hi,
Is there any API or module to get the time taken by the app to start or the application uptime ? I went thru the Docs but could not find anything helpful.
We are already calling reportFullyDrawnCallback when the app is ready. At the same point we need to know how much time it has been since the app was launched.

It would be helpful if you could point me to a doc or suggest any APIs to achieve this.

Thanks,
Chandra

@Chandraprakash_Sutha Have you tried Vega App KPI Visualizer mentioned here?

Hi, Yes I did.
KPIs are only available from either CLI or VS Code extensions (Please correct me if i am wrong). What I want is to get the measured app startup time or app’s uptime during runtime so i can share that over analytics.

One way to do this is to start store the time (epoch) when index.js runs and subtract it from the epoch when App.tsx is mounted and rendered for the first time. But I am not sure if kepler runs index.js as soon as the user opens the app (clicks on the app logo). Hence reaching out to you for a proper solution.

Hi @Chandraprakash_Sutha,

Thank you for the details. There are no APIs available for this purpose.

Could you please fill below details for a feature request?

App Name: Your App Name [e.g., Netflix]

App Link on Amazon Appstore (found through Developer Console > Actions column in App List > View on Amazon.com): Your App Link [e.g., Netflix - App on Amazon Appstore]

Is your feature request related to a problem?

(Write your answer here.)

Describe the solution you’d like

(Describe your proposed solution here.)

Is this a blocker? Describe alternatives you’ve considered

(Write your answer here.)

Additional context

(Write your answer here.)

Regards,
Siva

Hi, sure.

App Name: Your App Name [e.g., Netflix]

App Link on Amazon Appstore (found through Developer Console > Actions column in App List > View on Amazon.com): Your App Link [e.g., Netflix - App on Amazon Appstore]

Is your feature request related to a problem?

We want to measure the app launch/startup time and access that during runtime.

Describe the solution you’d like

If there is any API or module that can provide us with details like time till app startup.

Is this a blocker? Describe alternatives you’ve considered

Yes, this is a blocker for one of the feature.

Additional context

None.

Hi @Chandraprakash_Sutha,

Thank you. Could you please share any comparable solutions or implementations from other platforms and/or Fire OS?

Regards,
Siva

Sure.
For our android RN app we have a native module to handle this.
We store the epoch at time of creation of MainApplication class (inside its onCreate). We subtract that from the epoch at the time when application is ready (when homescreen has been rendered).

Hello! From what you describe above, sounds like you are trying to find out how long it would take to launch the app? If you have added reportFullyDrawnCallback, you can use TTFD described in Measure App KPIs | Design and Develop Vega Apps . Vega Studio will launch your app and then calculate the time from launching to the fully drawn marker (it is added when reportFullyDrawnCallback is called), close the app, and then display a summary on screen for you. This calculation is based on the trace markers recorded by a background service, there is no “Runtime API” that will be able to present or retrieve this time value while the app is still running.

But if you are actually looking for a way to calculate how much time has the app been running at runtime - we do not have a KPI nor API for this. You can easily calculate that in your app by adding a timer at the beginning of your app and then stop it around the same time where you call reportFullyDrawnCallback. Then you can either display the value on screen or send a metrics of your own to your backend.

Please let me know if this answers your question!

Hi, I am trying to do the latter.
I have a timer in my app to calculate the app run time. I am starting the timer when index.js runs for the first time and stopping it when app is fully loaded (app.tsx’s useEffect), but as i mentioned in my previous reply in this thread that I am not sure if kepler runs index.js as soon as the user opens the app (clicks on the app logo).

It depends on how you define “as soon as”. When user click on the icon, the UI layer has to pass the info to OS, then OS will use Life Cycle manager to launch your app, then index.js will be executed. The time from user clicking to launching your app is constant to Vega OS - meaning this part is the same for all the app. It should be a constant with the same device all the time.

So to measure meaningful value of individual app performance, the TTFD KPI (Time to fully drawn) is counting from launching your app (marker1) to the time that you call reportFullyDrawnCallback, which will put down a time stamp marker (marker2) in the trace file. Then KPI Vizualizer will calculate the time period from marker1 to marker2 and then report as TTFD.

This is what KPI Visualizer will do for you (from measure-kpis-in-vs-code):

  1. Start your app (you can select cold start or warm start)
  2. Once the app is fully loaded, close it
  3. Repeat several iterations, by default it is 3 but you can change to more
  4. Collect traces and then calculate TTFD for each iteration
  5. Show a summary for you

You can also use your way, it should give you almost the same value.