androiddatetimestampadbdumpsys

unable to resolve timestamp in android framestats data


does anyone has any idea about framestats https://developer.android.com/tools/dumpsys#ui Question - While running framestats command I am getting some wierd timestamps Example Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted,DequeueBufferDuration,QueueBufferDuration,GpuCompleted, 1,146696088396343,146696571729686,9223372036854775807,0,146696581891073,146696581894611,146696581897880,146697072749611,146697073366726,146697078783572,146697079121803,146697080224149,146697082513226,0,524962,0, 1,146698922377875,146698922377875,9223372036854775807,0,146698923674840,146698923677994,146698923976609,146698949996725,146698950291379,146698950697879,146698950903148,146698957816571,146698961607994,3572884,579693,0, 1,146698938951344,146698938951344,9223372036854775807,0,146698953406302,146698953410763,146698954719917,146698973898109,146698974007302,146698974468955,146698975846379,146698985501379,146698989020840,5225577,1202039,0,

if you take example of this then 146696088396343ns is pointing to 2nd Jan 1970.

I am expecting if I convert 146696088396343ns timestamp. I should get some valid date


Solution

  • These timestamps are not meant to be directly converted to dates. They're MONOTONIC system clock data (see source code here). As reported in the document, this type of timestamp is recommended to calculate elapsed times.

    For instance, if you have this profile data for rendering a frame:

    Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted,DequeueBufferDuration,QueueBufferDuration,GpuCompleted,
    0,4947428577884,4947428577884,4947410644000,4947417134500,4947430768177,4947432698385,4947434430635,4947434503677,4947436475094,4947436682677,4947436721510,4947437213719,4947440847094,74292,192541,4947440671302,
    

    you can calculate the difference between GpuCompleted and IntendedVsync timestamps (4947440671302 - 4947428577884) and convert the result (12093418) to milliseconds (12.09ms). As you can see 12ms is below the 16ms threshold therefore the time taken to render the frame is considered ok and it is not a sign of lagging.

    Even though it is a bit old, this additional document should provide you more detailed explanations of the meaning of the other fields in the profile data.

    Happy profiling!