develop/projects/rocprofiler-systems/source/lib/rocprof-sys-common-api/rocprofiler-systems/annotation.h Source File

develop/projects/rocprofiler-systems/source/lib/rocprof-sys-common-api/rocprofiler-systems/annotation.h Source File#

rocprofiler-systems: develop/projects/rocprofiler-systems/source/lib/rocprof-sys-common-api/rocprofiler-systems/annotation.h Source File
annotation.h
Go to the documentation of this file.
1 // Copyright (c) Advanced Micro Devices, Inc.
2 // SPDX-License-Identifier: MIT
3 
4 #ifndef ROCPROFSYS_ANNOTATION_H_
5 #define ROCPROFSYS_ANNOTATION_H_
6 
7 #include <stdint.h>
8 
9 #if defined(__cplusplus)
10 extern "C"
11 {
12 #endif
13 
14  /// @enum ROCPROFSYS_ANNOTATION_TYPE
15  /// @brief Identifier for the data type of the annotation.
16  /// if the data type is not a pointer, pass the address of
17  /// data.
18  /// @typedef ROCPROFSYS_ANNOTATION_TYPE rocprofsys_annotation_type_t
19  // C-style enum/typedef for C ABI compatibility
20  // NOLINTNEXTLINE(cppcoreguidelines-use-enum-class,modernize-use-using)
22  {
23  // Do not use first enum value
25  // arrange these in the order most likely to
26  // be used since they have to be iterated over
58  // the value of below enum is used for iterating
59  // over the enum in C++ templates. It MUST
60  // be the last enumerated id
63 
64  /// @struct rocprofsys_annotation
65  /// @brief A struct containing annotation data to be included in the perfetto trace.
66  ///
67  /// @code{.cpp}
68  /// #include <cstddef>
69  /// #include <cstdint>
70  ///
71  /// double
72  /// compute_residual(size_t n, double* data);
73  ///
74  /// double
75  /// compute(size_t n, double* data, size_t nitr, double tolerance)
76  /// {
77  /// size_t iteration = 0;
78  /// double residual = tolerance;
79  /// rocprofsys_annotation_t _annotations[] = {
80  /// { "iteration", ROCPROFSYS_VALUE_SIZE_T, &iteration },
81  /// { "residual", ROCPROFSYS_VALUE_FLOAT64, &residual },
82  /// };
83  ///
84  /// for(iteration = 0; iteration < nitr; ++iteration)
85  /// {
86  /// rocprofsys_push_category_region(ROCPROFSYS_CATEGORY_USER, "compute",
87  /// _annotations, 2);
88  ///
89  /// residual = compute_residual(n, data);
90  ///
91  /// rocprofsys_pop_category_region(ROCPROFSYS_CATEGORY_USER, "compute",
92  /// _annotations, 2);
93  /// }
94  ///
95  /// return residual;
96  /// }
97  /// @endcode
98  /// @typedef rocprofsys_annotation rocprofsys_annotation_t
99  // NOLINTNEXTLINE(modernize-use-using) -- C-style typedef for C ABI compatibility
100  typedef struct rocprofsys_annotation
101  {
102  /// label for annotation
103  const char* name;
104  /// rocprofsys_annotation_type_t
105  uintptr_t type;
106  /// data to annotate
107  void* value;
109 
110 #if defined(__cplusplus)
111 }
112 #endif
113 
114 #endif // ROCPROFSYS_ANNOTATION_H_
struct rocprofsys_annotation rocprofsys_annotation_t
const char * name
label for annotation
Definition: annotation.h:103
enum ROCPROFSYS_ANNOTATION_TYPE rocprofsys_annotation_type_t
void * value
data to annotate
Definition: annotation.h:107
unsigned long type
rocprofsys_annotation_type_t
Definition: annotation.h:105
ROCPROFSYS_ANNOTATION_TYPE
Identifier for the data type of the annotation. if the data type is not a pointer,...
Definition: annotation.h:22
@ ROCPROFSYS_INT32
Definition: annotation.h:44
@ ROCPROFSYS_FP64
Definition: annotation.h:39
@ ROCPROFSYS_UINT64
Definition: annotation.h:35
@ ROCPROFSYS_VOID_P
Definition: annotation.h:41
@ ROCPROFSYS_VALUE_FLOAT32
Definition: annotation.h:49
@ ROCPROFSYS_VALUE_UINT16
Definition: annotation.h:55
@ ROCPROFSYS_SIZE_T
Definition: annotation.h:30
@ ROCPROFSYS_UINT32
Definition: annotation.h:47
@ ROCPROFSYS_VALUE_NONE
Definition: annotation.h:24
@ ROCPROFSYS_VALUE_FLOAT64
Definition: annotation.h:37
@ ROCPROFSYS_UINT16
Definition: annotation.h:56
@ ROCPROFSYS_FP32
Definition: annotation.h:51
@ ROCPROFSYS_U32
Definition: annotation.h:48
@ ROCPROFSYS_VALUE_CSTR
Definition: annotation.h:27
@ ROCPROFSYS_VALUE_UINT64
Definition: annotation.h:34
@ ROCPROFSYS_U64
Definition: annotation.h:36
@ ROCPROFSYS_VALUE_INT64
Definition: annotation.h:31
@ ROCPROFSYS_FLOAT64
Definition: annotation.h:38
@ ROCPROFSYS_VALUE_LAST
Definition: annotation.h:61
@ ROCPROFSYS_VALUE_UINT32
Definition: annotation.h:46
@ ROCPROFSYS_INT16
Definition: annotation.h:53
@ ROCPROFSYS_VALUE_SIZE_T
Definition: annotation.h:29
@ ROCPROFSYS_VALUE_VOID_P
Definition: annotation.h:40
@ ROCPROFSYS_I64
Definition: annotation.h:33
@ ROCPROFSYS_U16
Definition: annotation.h:57
@ ROCPROFSYS_STRING
Definition: annotation.h:28
@ ROCPROFSYS_FLOAT32
Definition: annotation.h:50
@ ROCPROFSYS_I32
Definition: annotation.h:45
@ ROCPROFSYS_VALUE_INT32
Definition: annotation.h:43
@ ROCPROFSYS_PTR
Definition: annotation.h:42
@ ROCPROFSYS_I16
Definition: annotation.h:54
@ ROCPROFSYS_INT64
Definition: annotation.h:32
@ ROCPROFSYS_VALUE_INT16
Definition: annotation.h:52
A struct containing annotation data to be included in the perfetto trace.
Definition: annotation.h:101