NVIDIA DeepStream SDK API Reference
9.2 Release
sources/libs/nvmultiobjecttracker/include/modules/utility/debug_common.hpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: Copyright (c) 2021-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
#ifndef DEBUG_COMMON_HPP_
19
#define DEBUG_COMMON_HPP_
20
21
#include <cstdlib>
22
#include <iostream>
23
#include <string>
24
#include <cassert>
25
26
#define CLOG(message) \
27
do { \
28
fprintf(stdout, "~~ CLOG[%s, %s() @line %d]: %s\n", __FILE__, __func__, __LINE__, message); \
29
} while (0)
30
31
#define MEAS_TIME(func, doPrint, name) \
32
do { \
33
if (doPrint) { \
34
auto timeStart = std::chrono::high_resolution_clock::now(); \
35
func; \
36
double timeUsed = std::chrono::duration<double>(std::chrono::high_resolution_clock::now()-timeStart).count() * 1e+3; \
37
fprintf(stdout, "~~ MEAS_TIME[%s]: %.2f ms\n", name, timeUsed); } \
38
else { func; } \
39
} while (0)
40
41
namespace
DEBUG_UTIL
42
{
43
50
template
<
typename
... Args >
51
std::string
to_string_fmt
(
const
char
*
format
, Args... args )
52
{
53
int
length
= std::snprintf(
nullptr
, 0,
format
, args... );
54
assert(
length
>= 0 );
55
56
char
* buf =
new
char
[
length
+ 1];
57
std::snprintf( buf,
length
+ 1,
format
, args... );
58
59
std::string str( buf );
60
delete
[] buf;
61
return
str;
62
}
63
64
}
65
66
#endif // DEBUG_COMMON_HPP_
DEBUG_UTIL::to_string_fmt
std::string to_string_fmt(const char *format, Args... args)
Format a string using printf-style arguments.
Definition:
sources/libs/nvmultiobjecttracker/include/modules/utility/debug_common.hpp:51
length
__host__ __device__ float length(float2 v)
Compute the Euclidean length of a vector.
Definition:
sources/libs/nvmultiobjecttracker/include/modules/cuDCFv2/helper_math.h:2721
DEBUG_UTIL
Definition:
sources/libs/nvmultiobjecttracker/include/modules/utility/debug_common.hpp:41
ds3d::v2xinfer::format
static std::string format(const char *fmt,...)
Definition:
sources/libs/ds3d/inference_custom_lib/ds3d_v2x_infer_custom_preprocess/tensor.hpp:31
Privacy Policy
|
Your Privacy Choices
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
NVIDIA Confidential | Subject to Change | For test and development only.
Wed Oct 28 2026 12:02:02 | PR-09318-R32