latest/source/lib/omnitrace-user/omnitrace/categories.h Source File

latest/source/lib/omnitrace-user/omnitrace/categories.h Source File#

omnitrace: latest/source/lib/omnitrace-user/omnitrace/categories.h Source File
categories.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 
23 #ifndef OMNITRACE_CATEGORIES_H_
24 #define OMNITRACE_CATEGORIES_H_
25 
26 #include <stddef.h>
27 #include <stdint.h>
28 
29 #if defined(__cplusplus)
30 extern "C"
31 {
32 #endif
33 
34  /// @typedef omnitrace_category_t
35  /// @brief Identifier for categories
36  ///
37  typedef enum OMNITRACE_CATEGORIES
38  {
39  // Do not use first enum value
41  // arrange these in the order most likely to
42  // be used since they have to be iterated over
86  // the value of below enum is used for iterating
87  // over the enum in C++ templates. It MUST
88  // be the last enumerated id
90 
91  /// @enum OMNITRACE_ANNOTATION_TYPE
92  /// @brief Identifier for the data type of the annotation.
93  /// if the data type is not a pointer, pass the address of
94  /// data.
95  /// @typedef OMNITRACE_ANNOTATION_TYPE omnitrace_annotation_type_t
97  {
98  // Do not use first enum value
100  // arrange these in the order most likely to
101  // be used since they have to be iterated over
133  // the value of below enum is used for iterating
134  // over the enum in C++ templates. It MUST
135  // be the last enumerated id
138 
139  /// @struct omnitrace_annotation
140  /// @brief A struct containing annotation data to be included in the perfetto trace.
141  ///
142  /// @code{.cpp}
143  /// #include <cstddef>
144  /// #include <cstdint>
145  ///
146  /// double
147  /// compute_residual(size_t n, double* data);
148  ///
149  /// double
150  /// compute(size_t n, double* data, size_t nitr, double tolerance)
151  /// {
152  /// omnitrace_annotation_t _annotations[] = {
153  /// { "iteration", OMNITRACE_VALUE_SIZE_T, nullptr },
154  /// { "residual", OMNITRACE_VALUE_FLOAT64, nullptr },
155  /// { "data", OMNITRACE_VALUE_PTR, data },
156  /// { "size", OMNITRACE_VALUE_SIZE_T, &n },
157  /// { "tolerance", OMNITRACE_VALUE_FLOAT64, &tolerance },
158  /// nullptr
159  /// };
160  ///
161  /// double residual = tolerance;
162  /// for(size_t i = 0; i < nitr; ++i)
163  /// {
164  /// omnitrace_user_push_annotated_region("compute", &_annotations);
165  ///
166  /// residual = compute_residual(n, data);
167  ///
168  /// _annotations[0].value = &i;
169  /// _annotations[1].value = &residual;
170  /// omnitrace_user_pop_annotated_region("compute", &_annotations);
171  /// }
172  ///
173  /// return residual;
174  /// }
175  /// @endcode
176  /// @typedef omnitrace_annotation omnitrace_annotation_t
177  typedef struct omnitrace_annotation
178  {
179  /// label for annotation
180  const char* name;
181  /// omnitrace_annotation_type_t
182  uintptr_t type;
183  /// data to annotate
184  void* value;
186 
187 #if defined(__cplusplus)
188 }
189 #endif
190 
191 #endif // OMNITRACE_TYPES_H_
enum OMNITRACE_ANNOTATION_TYPE omnitrace_annotation_type_t
OMNITRACE_ANNOTATION_TYPE
Identifier for the data type of the annotation. if the data type is not a pointer,...
Definition: categories.h:97
@ OMNITRACE_FLOAT64
Definition: categories.h:113
@ OMNITRACE_INT16
Definition: categories.h:128
@ OMNITRACE_VOID_P
Definition: categories.h:116
@ OMNITRACE_FP32
Definition: categories.h:126
@ OMNITRACE_SIZE_T
Definition: categories.h:105
@ OMNITRACE_I32
Definition: categories.h:120
@ OMNITRACE_U16
Definition: categories.h:132
@ OMNITRACE_UINT64
Definition: categories.h:110
@ OMNITRACE_FLOAT32
Definition: categories.h:125
@ OMNITRACE_VALUE_INT64
Definition: categories.h:106
@ OMNITRACE_VALUE_VOID_P
Definition: categories.h:115
@ OMNITRACE_VALUE_FLOAT32
Definition: categories.h:124
@ OMNITRACE_UINT32
Definition: categories.h:122
@ OMNITRACE_VALUE_UINT16
Definition: categories.h:130
@ OMNITRACE_VALUE_FLOAT64
Definition: categories.h:112
@ OMNITRACE_VALUE_INT32
Definition: categories.h:118
@ OMNITRACE_UINT16
Definition: categories.h:131
@ OMNITRACE_VALUE_INT16
Definition: categories.h:127
@ OMNITRACE_STRING
Definition: categories.h:103
@ OMNITRACE_PTR
Definition: categories.h:117
@ OMNITRACE_VALUE_LAST
Definition: categories.h:136
@ OMNITRACE_FP64
Definition: categories.h:114
@ OMNITRACE_INT32
Definition: categories.h:119
@ OMNITRACE_U32
Definition: categories.h:123
@ OMNITRACE_VALUE_UINT32
Definition: categories.h:121
@ OMNITRACE_VALUE_SIZE_T
Definition: categories.h:104
@ OMNITRACE_VALUE_UINT64
Definition: categories.h:109
@ OMNITRACE_I16
Definition: categories.h:129
@ OMNITRACE_VALUE_CSTR
Definition: categories.h:102
@ OMNITRACE_VALUE_NONE
Definition: categories.h:99
@ OMNITRACE_U64
Definition: categories.h:111
@ OMNITRACE_INT64
Definition: categories.h:107
@ OMNITRACE_I64
Definition: categories.h:108
enum OMNITRACE_CATEGORIES omnitrace_category_t
Identifier for categories.
const char * name
label for annotation
Definition: categories.h:180
void * value
data to annotate
Definition: categories.h:184
OMNITRACE_CATEGORIES
Definition: categories.h:38
@ OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH
Definition: categories.h:71
@ OMNITRACE_CATEGORY_HOST
Definition: categories.h:45
@ OMNITRACE_CATEGORY_ROCM_SMI_BUSY
Definition: categories.h:52
@ OMNITRACE_CATEGORY_ROCM_HSA
Definition: categories.h:49
@ OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT
Definition: categories.h:72
@ OMNITRACE_CATEGORY_CAUSAL
Definition: categories.h:66
@ OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME
Definition: categories.h:74
@ OMNITRACE_CATEGORY_THREAD_PAGE_FAULT
Definition: categories.h:77
@ OMNITRACE_CATEGORY_THREAD_WALL_TIME
Definition: categories.h:75
@ OMNITRACE_CATEGORY_NUMA
Definition: categories.h:82
@ OMNITRACE_CATEGORY_PTHREAD
Definition: categories.h:60
@ OMNITRACE_CATEGORY_LAST
Definition: categories.h:85
@ OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE
Definition: categories.h:55
@ OMNITRACE_CATEGORY_ROCM_SMI_TEMP
Definition: categories.h:53
@ OMNITRACE_CATEGORY_USER
Definition: categories.h:44
@ OMNITRACE_CATEGORY_TIMER_SAMPLING
Definition: categories.h:83
@ OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER
Definition: categories.h:81
@ OMNITRACE_CATEGORY_ROCM_SMI_POWER
Definition: categories.h:54
@ OMNITRACE_CATEGORY_THREAD_CPU_TIME
Definition: categories.h:76
@ OMNITRACE_CATEGORY_ROCTRACER
Definition: categories.h:57
@ OMNITRACE_CATEGORY_PYTHON
Definition: categories.h:43
@ OMNITRACE_CATEGORY_ROCM_HIP
Definition: categories.h:48
@ OMNITRACE_CATEGORY_PROCESS_VIRT
Definition: categories.h:69
@ OMNITRACE_CATEGORY_ROCM_SMI
Definition: categories.h:51
@ OMNITRACE_CATEGORY_MPI
Definition: categories.h:62
@ OMNITRACE_CATEGORY_NONE
Definition: categories.h:40
@ OMNITRACE_CATEGORY_ROCPROFILER
Definition: categories.h:58
@ OMNITRACE_CATEGORY_ROCM_RCCL
Definition: categories.h:56
@ OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY
Definition: categories.h:78
@ OMNITRACE_CATEGORY_CPU_FREQ
Definition: categories.h:67
@ OMNITRACE_CATEGORY_ROCM_ROCTX
Definition: categories.h:50
@ OMNITRACE_CATEGORY_DEVICE_HIP
Definition: categories.h:46
@ OMNITRACE_CATEGORY_PROCESS_PEAK
Definition: categories.h:70
@ OMNITRACE_CATEGORY_OMPT
Definition: categories.h:63
@ OMNITRACE_CATEGORY_SAMPLING
Definition: categories.h:59
@ OMNITRACE_CATEGORY_COMM_DATA
Definition: categories.h:65
@ OMNITRACE_CATEGORY_KOKKOS
Definition: categories.h:61
@ OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER
Definition: categories.h:80
@ OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH
Definition: categories.h:79
@ OMNITRACE_CATEGORY_DEVICE_HSA
Definition: categories.h:47
@ OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME
Definition: categories.h:73
@ OMNITRACE_CATEGORY_PROCESS_PAGE
Definition: categories.h:68
@ OMNITRACE_CATEGORY_PROCESS_SAMPLING
Definition: categories.h:64
@ OMNITRACE_CATEGORY_OVERFLOW_SAMPLING
Definition: categories.h:84
unsigned long type
omnitrace_annotation_type_t
Definition: categories.h:182
struct omnitrace_annotation omnitrace_annotation_t
A struct containing annotation data to be included in the perfetto trace.
Definition: categories.h:178