Measuring Latency while decoding

Hi, I am working with Jetson Xavier AGX on video processing. I have created a pipeline for decoding an .mp4 file and I want to measure the latency that is how many frames latency we are getting due to the decoding process. The pipeline that I am using is as follows:
gst-launch-1.0 filesrc location=sample.mp4 ! qtdemux ! h264parse ! nvv4l2decoder enable-max-performance=1 ! fakesink

What are the possible ways of measuring the latency ?

Hi,
There is no existing code for this. Since gst-v4l2 is open source, you can add prints in output plane and capture to show the time the h264 stream is fed and the time frame data is decoded.

For profiling fps we can use fpsdisplaysink. For latency, would need to do manual steps.

Or may try like this:
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL
If the network is stable, can check the latency in UDP streaming.