NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/service-maker/sources/modules/measure_latency_probe/measure_latency_probe.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #include <vector>
19 #include <iostream>
20 #include <chrono>
21 
22 #include "buffer_probe.hpp"
23 
24 
25 using namespace std;
26 
27 namespace deepstream {
28 
29 class NvDsMeasureLatency : public BufferProbe::IBufferObserver {
30  public:
31  virtual probeReturn handleBuffer(BufferProbe& probe, const Buffer& buffer) {
32  auto latency_info = buffer.measureLatency();
33  for (auto& latency : latency_info) {
34  cout << "Source id = " << latency.source_id
35  << " Frame_num = " << latency.frame_num
36  << " Frame latency = " << latency.latency << " (ms)"
37  << endl;
38  }
39  return probeReturn::Probe_Ok;
40  }
41 };
42 
43 }
deepstream::BufferProbe
Represent a custom object for the purpose of probing output buffers.
Definition: service-maker/includes/buffer_probe.hpp:63
deepstream::Buffer::measureLatency
std::vector< Latency > measureLatency() const
Return latency data of the buffer.
deepstream::probeReturn
probeReturn
Return values from user implemented probe interfaces.
Definition: service-maker/includes/buffer_probe.hpp:47
deepstream
Definition: service-maker/includes/buffer.hpp:38
deepstream::Buffer
Base class of a buffer.
Definition: service-maker/includes/buffer.hpp:51
std
Extensions to the C++ standard library.
Definition: includes/opentelemetry/nostd/string_view.h:212
deepstream::NvDsMeasureLatency::handleBuffer
virtual probeReturn handleBuffer(BufferProbe &probe, const Buffer &buffer)
Definition: 9.2/service-maker/sources/modules/measure_latency_probe/measure_latency_probe.hpp:31