Latency measuring API

group ee_nvlatency_group

Defines an API for measuring latency in modules.

Defines

MAX_COMPONENT_LEN
nvds_enable_latency_measurement

Defines a pseudo-variable whose value is the return value of nvds_get_enable_latency_measurement().

It indicates whether latency measurement is enabled.

Typedefs

typedef struct _NvDsMetaCompLatency NvDsMetaCompLatency

Holds information about latency of the given component.

Functions

NvDsUserMeta *nvds_set_input_system_timestamp(GstBuffer *buffer, gchar *element_name)

Sets the system timestamp when the Gst Buffer arrives as input at the component.

Return

A pointer to a NvDsUserMeta structure which holds an NvDsMetaCompLatency as NvDsUserMeta.user_meta_data.

Parameters
  • [in] buffer: A pointer to the arriving Gst Buffer.

  • [in] element_name: A pointer to the name of the component for which latency is to be measured.

gboolean nvds_set_output_system_timestamp(GstBuffer *buffer, gchar *element_name)

Sets the system timestamp when a Gst Buffer that is pushed to the downstream component.

This is a corresponding function to nvds_set_input_system_timestamp().

Return

TRUE if the timestamp is attached successfully, or FALSE otherwise.

Parameters
  • [in] buffer: A pointer to a Gst Buffer to be pushed to the downstream component.

  • [in] element_name: A pointer to the name of the component for which latency is to be measured.

guint nvds_measure_buffer_latency(GstBuffer *buf, NvDsFrameLatencyInfo *latency_info)

Measures the latency of all frames present in the current batch.

The latency is computed from decoder input up to the point this API is called. You can install the probe on either pad of the component and call this function to measure the latency.

Parameters
  • [in] buf: A pointer to a Gst Buffer to which NvDsBatchMeta is attached as metadata.

  • [out] latency_info: A pointer to an NvDsFrameLatencyInfo structure allocated for a batch of this size. The function fills it with information about all of the sources.

gboolean nvds_get_enable_latency_measurement(void)

Indicates whether the environment variable NVDS_ENABLE_LATENCY_MEASUREMENT is exported.

Return

True if the environment variable is exported, or false otherwise.

struct _NvDsMetaCompLatency
#include <nvds_latency_meta.h>

Holds information about latency of the given component.

struct NvDsFrameLatencyInfo
#include <nvds_latency_meta.h>

Holds information about the latency of a given frame.