This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to measure the total latency?

Hi,

Can I use DVR RDK to measure total latency?

I can use VcapVenc_printStatistics to display below message:


CH | Bitrate (Kbps) | FPS | Key-frame FPS | Width (max/min) | Height (max/min) | Latency (max/min)|TimeStamp|Capture Timestamp
------------------------------------------------------------------------------------------------------------------------------
0 | 6329.59 | 30.0 | 3.8 | 1280 / 1280 | 720 / 720 | 31204 / 4095| 165396 | 165396
1 | 2186.74 | 30.0 | 3.7 | 640 / 640 | 360 / 360 | 31216 / 4095| 165396 | 165396

But I don't know the unit of latency. millisecond? microsecond?

And the Latency is encodetimestamp - timestamp(capture timestamp), does it mean the Latency is the time from capture link to encoder;s output?

or 

I need to use Vsys_printDetailedStatistics to get all message from M3 and sum all latency?

or I need add DEI latency + SCL latency + Enc latency (+capture + nsf+dup+merge, I don't know how to get these latency of link ) ?

Thanks

  • Full pipeline latency measurement from capture to the point encoded frame is received on A8 is supported in RDK 3.5 Unit of latency is ms.

  • Hi~ Badri

    Now i'm also measuring the total latency.  My chain is cap+sclr+nsf+encode. But I don't know what you have said in this post.

    Can I use the function Vsys_printDetailedStatistics() to get the info. what's the print info function name in HDVPSS?

    Is the print info "LATENCY MAX/MIN" is the true latency?  And the sum is the total latency?

    thx~

  • Are you using DVR RDK 3.5 ? If so measure total latency of cap+sclr+nsf+encode as below:

    1. Get encoded frame using Venc_getBitstreamBuffer(&fullBufList, 0);

    2.   VCODEC_BITSBUF_S *pBuf = &fullBufList.bitsBuf[i]     

          latency = Avsync_getWallTime() - (((UInt64)pBuf->upperTimeStamp << 32) |  (UInt64)pBuf->lowerTimeStamp);

    This will give total latency in msec from capture to when the frame is received using Venc_getBitstreamBuffer

  • Badri

    thanks for your reply

    But I'm using DVR RDK 3.0  .  can I get the lotal latency ?

  • Badri,

    I also want to know if I can just use the print info by  VcapVenc_printStatistics?

    Is the sum of the " Latency (MAX/MIN)" of each link a precise total latency?

  • On RDK 3.0 you will get approx. latency +-16ms since timestamp is not set by the capture driver at point of capture but instead set based on capture frame number which is not correct. Sum of latency should not be done. Latency at each link indicates latency from capture to that link. So if you have cap+nsf+scalar_enc latency of scaler includes latency of nsf also.Similarly enc latency includes scalar latency.

  • Badri

    below is my print info

     [m3vpss ]
     [m3vpss ]  *** Capture Driver Advanced Statistics ***
     [m3vpss ]
     [m3vpss ]  VIP Parser Reset Count : 0
     [m3vpss ]
     [m3vpss ]      |   Total    Even     Odd  Total  Even   Odd  Min /  Max  Min /  Max Dropped Fid Repeat Frame Error Y/C
     [m3vpss ]  CH  |  Fields  Fields  Fields    FPS   FPS   FPS       Width      Height  Fields      Count (Desc Error Y/C)
     [m3vpss ]  ------------------------------------------------------------------------------------------------------------
     [m3vpss ]  000 |  101869  101869       0     72    72     0 1922 / 1922 1080 / 1080      11          0 0/0 (0/0)
     [m3vpss ]
     [m3vpss ]  VIP Capture Port 0 | DescMissMatch1 = 0, DescMissMatch2 = 0 , DescMissMatch3 = 0
     [m3vpss ]
     [m3vpss ]  *** Capture List Manager Advanced Statistics ***
     [m3vpss ]
     [m3vpss ]  List Post Count        : 176837
     [m3vpss ]  List Stall Count       : 0
     [m3vpss ]  List Post Time (ms)    : Max = 0, Min = 0, Avg = 0, Total = 0
     [m3vpss ]  INTC Timeout Count     : (0, 0) (Min timeout value = 987, 991)
     [m3vpss ]  Descriptor miss found count : 0
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  VIP and VPDMA registers,
     [m3vpss ]  VIP0 : FIQ_STATUS  : 0x4810551c = 0x00004400
     [m3vpss ]  VIP1 : FIQ_STATUS  : 0x48105a1c = 0x00000000
     [m3vpss ]  VPDMA: LIST_BUSY   : 0x4810d00c = 0x00020000
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  1480578: CAPTURE: Fields = 101858 (fps = 72, CPU Load = 0)
     [m3vpss ]  1480578: CAPTURE: Num Resets = 0 (Avg 0 ms per reset)
     [m3vpss ]  1480579: SYSTEM  : FREE SPACE : System Heap      = 183328 B, Mbx = 10238 msgs)
     [m3vpss ]  1480579: SYSTEM  : FREE SPACE : SR0 Heap         = 4450048 B (4 MB)
     [m3vpss ]  1480579: SYSTEM  : FREE SPACE : Frame Buffer     = 135377792 B (129 MB)
     [m3vpss ]  1480579: SYSTEM  : FREE SPACE : Bitstream Buffer = 86836096 B (82 MB)
     [m3vpss ]
     [m3vpss ]  *** [Scalar0   ] SCLR Statistics ***
     [m3vpss ]
     [m3vpss ]  Elasped Time           : 1415 secs
     [m3vpss ]  Total Fields Processed : 101858
     [m3vpss ]  Total Fields FPS       : 249 FPS
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  CH  | In Recv In Reject In Process Out Skip Out User Out Latency
     [m3vpss ]  Num | FPS     FPS       FPS        FPS    FPS   Skip FPS Min / Max
     [m3vpss ]  ---------------------------------------------------------------------
     [m3vpss ]    0 |      71         0         71  71        0        0   4   9
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  *** [NSF0] NSF Statistics ***
     [m3vpss ]
     [m3vpss ]  Elasped Time           : 1415 secs
     [m3vpss ]  Total Fields Processed : 101858
     [m3vpss ]  Total Fields FPS       : 368 FPS
     [m3vpss ]
     [m3vpss ]
     [m3vpss ]  CH  | In Recv In Reject In Process Out User Out Out
     [m3vpss ]  Num | FPS     FPS       FPS        FPS Skip FPS Skip FPS
     [m3vpss ]  ------------------------------------------------
     [m3vpss ]    0 |      71         0         71  71        0        0
     [m3vpss ]
     [m3vpss ]  1480583: SYSTEM  : FREE SPACE : Tiler Buffer     = 55 B (0 MB)  - TILER OFF
     [m3vpss ]  1482251: DISPLAY: HDDAC(BP0) : 71 fps, Latency (Min / Max) = ( 0 / 14 ), Callback Interval (Min / Max) = ( 13 / 14 )
     !!!
     [m3vpss ]  1482251: DISPLAY: UNDERFLOW COUNT: HDMI(BP0) 102009, HDDAC(BP0) 0, DVO2(BP1) 102009, SDDAC(SEC1) 189995
     [m3vpss ]  1482251: SYSTEM  : FREE SPACE : System Heap      = 183328 B, Mbx = 10239 msgs)
     [m3vpss ]  1482251: SYSTEM  : FREE SPACE : SR0 Heap         = 4450048 B (4 MB)
     [m3vpss ]  1482251: SYSTEM  : FREE SPACE : Frame Buffer     = 135377792 B (129 MB)
     [m3vpss ]  1482252: SYSTEM  : FREE SPACE : Bitstream Buffer = 86836096 B (82 MB)
     [m3vpss ]  1482252: SYSTEM  : FREE SPACE : Tiler Buffer     = 55 B (0 MB)  - TILER OFF
    Failed video writing buffer
     [m3video]      1485587: HDVICP-ID:0
     [m3video] All percentage figures are based off totalElapsedTime
     [m3video]               totalAcquire2wait :0 %
     [m3video]               totalWait2Isr :28 %
     [m3video]               totalIsr2Done :0 %
     [m3video]               totalWait2Done :28 %
     [m3video]               totalDone2Release :0 %
     [m3video]               totalAcquire2Release :28 %
     [m3video]               totalAcq2acqDelay :71 %
     [m3video]               totalElapsedTime in msec : 1419652
     [m3video]               numAccessCnt: 1226604
     [m3video]              IVA-FPS :     864
     [m3video]              Average time spent per frame in microsec:     323
     [m3video]      1485588: HDVICP-ID:1
     [m3video] All percentage figures are based off totalElapsedTime
     [m3video]               totalAcquire2wait :0 %
     [m3video]               totalWait2Isr :0 %
     [m3video]               totalIsr2Done :0 %
     [m3video]               totalWait2Done :0 %
     [m3video]               totalDone2Release :0 %
     [m3video]               totalAcquire2Release :0 %
     [m3video]               totalAcq2acqDelay :0 %
     [m3video]               totalElapsedTime in msec :       0
     [m3video]               numAccessCnt:       0
     [m3video]              IVA-FPS :       0
     [m3video]              Average time spent per frame in microsec:       0
     [m3video]      1485589: HDVICP-ID:2
     [m3video] All percentage figures are based off totalElapsedTime
     [m3video]               totalAcquire2wait :0 %
     [m3video]               totalWait2Isr :0 %
     [m3video]               totalIsr2Done :0 %
     [m3video]               totalWait2Done :0 %
     [m3video]               totalDone2Release :0 %
     [m3video]               totalAcquire2Release :0 %
     [m3video]               totalAcq2acqDelay :0 %
     [m3video]               totalElapsedTime in msec :       0
     [m3video]               numAccessCnt:       0
     [m3video]              IVA-FPS :       0
     [m3video]              Average time spent per frame in microsec:       0
     [m3video]
     [m3video]  *** ENCODE Statistics ***
     [m3video]
     [m3video]  Elasped Time           : 1419 secs
     [m3video]
     [m3video]
     [m3video]  CH  | In Recv In Skip In User  Out Latency
     [m3video]  Num | FPS     FPS     Skip FPS FPS Min / Max
     [m3video]  --------------------------------------------
     [m3video]    0 |      72       0        0  72  12 /  20
     [m3video]
     [m3video] Multi Channel Encode Average Submit Batch Size
     [m3video] Max Submit Batch Size : 24
     [m3video] IVAHD_0 Average Batch Size : 1
     [m3video] IVAHD_0 Max achieved Batch Size : 1
     [m3video]
     [m3video] Multi Channel Encode Batch break Stats
     [m3video] Total Number of Batches created: 102213
     [m3video] All numbers are based off total number of Batches created
     [m3video]       Batch breaks due to batch sizeexceeding limit: 0 %
     [m3video]       Batch breaks due to ReqObj Que being empty: 100 %
     [m3video]       Batch breaks due to changed resolution class: 0 %
     [m3video]       Batch breaks due to interlace and progressivecontent mix: 0 %
     [m3video]       Batch breaks due to channel repeat: 0 %
     [m3video]       Batch breaks due to different codec: 0 %
     [m3vpss ]
     [m3vpss ]  1487259: LOAD: CPU: 14.0% HWI: 2.6%, SWI:1.7%
     [m3vpss ]
     [m3vpss ]  1487259: LOAD: TSK: IPC_OUT_M30         : 1.8%
     [m3vpss ]  1487259: LOAD: TSK: CAPTURE             : 0.8%
     [m3vpss ]  1487259: LOAD: TSK: NSF0                : 1.4%
     [m3vpss ]  1487260: LOAD: TSK: DISPLAY0            : 1.1%
     [m3vpss ]  1487260: LOAD: TSK: DUP0                : 0.4%
     [m3vpss ]  1487260: LOAD: TSK: Scalar0             : 1.8%
     [m3vpss ]  1487260: LOAD: TSK: MISC                : 2.4%
     [m3vpss ]
     [m3video]
     [m3video]  1487678: LOAD: CPU: 8.3% HWI: 1.0%, SWI:1.0%
     [m3video]
     [m3video]  1487679: LOAD: TSK: IPC_IN_M30          : 0.6%
     [m3video]  1487679: LOAD: TSK: IPC_BITS_OUT0       : 1.0%
     [m3video]  1487679: LOAD: TSK: ENC0                : 1.8%
     [m3video]  1487679: LOAD: TSK: ENC_PROCESS_TSK_0   : 2.5%
     [m3video]  1487679: LOAD: TSK: MISC                : 0.4%
     [m3video]
     [c6xdsp ]
     [c6xdsp ]  1150785: LOAD: CPU: 0.2% HWI: 0.0%, SWI:0.0%
     [c6xdsp ]
     [c6xdsp ]  1150785: LOAD: TSK: MISC                : 0.2%
     [c6xdsp ]
     *** Encode Bitstream Received Statistics ***
     Elased time = 1707.2 secs
     CH | Bitrate (Kbps) | FPS | Key-frame FPS | Width (max/min) | Height (max/min) | Latency (max/min)
     --------------------------------------------------------------------------------------------------
      0 |        3824.81 | 60.0 |           2.0 |   720 /    720 |    576 /    576  |     20 /     12


    according what you have said, I think my total latency is 20/12 .is this correct?
    I still don't know a clear method to get my total latency using DVRRDK 3.0

    appreciated for your reply
  • Badri,

    1.   I don't konw the meaning of  "Latency at each link indicates latency from capture to that link. So if you have cap+nsf+scalar_enc latency of scaler includes latency of nsf also.Similarly enc latency includes scalar latency." upstaris I have posted my cap info . The nsf latency is 13/14. But the dis latency is 12/20. and it doesn't "include".

    2. as you have said before, I still can use the "

    1. Get encoded frame using Venc_getBitstreamBuffer(&fullBufList, 0);
    2. VCODEC_BITSBUF_S *pBuf = &fullBufList.bitsBuf[i]
    latency = Avsync_getWallTime() - (((UInt64)pBuf->upperTimeStamp << 32) | (UInt64)pBuf->lowerTimeStamp);"

    but I don't know how to use definitely. where should I add these sentences. Could you point it in detail?

    Thx

  • From the logs the latency in your case is Cap -> Encode Min = 12ms , Max = 20 ms latency. To receive the frame on A8 there could be additional 8ms latency so total latency in your case is 20/28 ms. 

  • Badri,

    Thank you for your reply. 

    And I also want to know my "cap+sclr+nsf" latency.

    the print info said " 1482251: DISPLAY: HDDAC(BP0) : 71 fps, Latency (Min / Max) = ( 0 / 14 ), Callback Interval (Min / Max) = ( 13 / 14 )"

    Is my "cap+sclr+nsf" latency 13/14(min/max)? 

    regards,

    oguri

  • Cap+sclr+nsf latency is

    Minimum = 4 to 10 ms

    Max = 9 to 18 ms.