latest/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h Source File

latest/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h Source File#

rocprofiler-systems: latest/source/lib/rocprof-sys-user/rocprofiler-systems/categories.h Source File
categories.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2022-2024 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 ROCPROFSYS_CATEGORIES_H_
24 #define ROCPROFSYS_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 rocprofsys_category_t
35  /// @brief Identifier for categories
36  ///
37  typedef enum ROCPROFSYS_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 ROCPROFSYS_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 ROCPROFSYS_ANNOTATION_TYPE rocprofsys_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 rocprofsys_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  /// rocprofsys_annotation_t _annotations[] = {
153  /// { "iteration", ROCPROFSYS_VALUE_SIZE_T, nullptr },
154  /// { "residual", ROCPROFSYS_VALUE_FLOAT64, nullptr },
155  /// { "data", ROCPROFSYS_VALUE_PTR, data },
156  /// { "size", ROCPROFSYS_VALUE_SIZE_T, &n },
157  /// { "tolerance", ROCPROFSYS_VALUE_FLOAT64, &tolerance },
158  /// nullptr
159  /// };
160  ///
161  /// double residual = tolerance;
162  /// for(size_t i = 0; i < nitr; ++i)
163  /// {
164  /// rocprofsys_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  /// rocprofsys_user_pop_annotated_region("compute", &_annotations);
171  /// }
172  ///
173  /// return residual;
174  /// }
175  /// @endcode
176  /// @typedef rocprofsys_annotation rocprofsys_annotation_t
177  typedef struct rocprofsys_annotation
178  {
179  /// label for annotation
180  const char* name;
181  /// rocprofsys_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 // ROCPROFSYS_TYPES_H_
struct rocprofsys_annotation rocprofsys_annotation_t
const char * name
label for annotation
Definition: categories.h:180
enum ROCPROFSYS_CATEGORIES rocprofsys_category_t
Identifier for categories.
ROCPROFSYS_CATEGORIES
Definition: categories.h:38
@ ROCPROFSYS_CATEGORY_THREAD_CPU_TIME
Definition: categories.h:76
@ ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER
Definition: categories.h:81
@ ROCPROFSYS_CATEGORY_ROCPROFILER
Definition: categories.h:58
@ ROCPROFSYS_CATEGORY_NONE
Definition: categories.h:40
@ ROCPROFSYS_CATEGORY_HOST
Definition: categories.h:45
@ ROCPROFSYS_CATEGORY_THREAD_PEAK_MEMORY
Definition: categories.h:78
@ ROCPROFSYS_CATEGORY_ROCM_SMI_POWER
Definition: categories.h:54
@ ROCPROFSYS_CATEGORY_ROCM_HIP
Definition: categories.h:48
@ ROCPROFSYS_CATEGORY_LAST
Definition: categories.h:85
@ ROCPROFSYS_CATEGORY_COMM_DATA
Definition: categories.h:65
@ ROCPROFSYS_CATEGORY_DEVICE_HSA
Definition: categories.h:47
@ ROCPROFSYS_CATEGORY_ROCM_HSA
Definition: categories.h:49
@ ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING
Definition: categories.h:84
@ ROCPROFSYS_CATEGORY_PROCESS_SAMPLING
Definition: categories.h:64
@ ROCPROFSYS_CATEGORY_PROCESS_PAGE_FAULT
Definition: categories.h:72
@ ROCPROFSYS_CATEGORY_DEVICE_HIP
Definition: categories.h:46
@ ROCPROFSYS_CATEGORY_PROCESS_VIRT
Definition: categories.h:69
@ ROCPROFSYS_CATEGORY_THREAD_WALL_TIME
Definition: categories.h:75
@ ROCPROFSYS_CATEGORY_ROCM_ROCTX
Definition: categories.h:50
@ ROCPROFSYS_CATEGORY_MPI
Definition: categories.h:62
@ ROCPROFSYS_CATEGORY_PROCESS_PAGE
Definition: categories.h:68
@ ROCPROFSYS_CATEGORY_SAMPLING
Definition: categories.h:59
@ ROCPROFSYS_CATEGORY_CAUSAL
Definition: categories.h:66
@ ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE
Definition: categories.h:55
@ ROCPROFSYS_CATEGORY_TIMER_SAMPLING
Definition: categories.h:83
@ ROCPROFSYS_CATEGORY_ROCM_RCCL
Definition: categories.h:56
@ ROCPROFSYS_CATEGORY_USER
Definition: categories.h:44
@ ROCPROFSYS_CATEGORY_OMPT
Definition: categories.h:63
@ ROCPROFSYS_CATEGORY_PTHREAD
Definition: categories.h:60
@ ROCPROFSYS_CATEGORY_KOKKOS
Definition: categories.h:61
@ ROCPROFSYS_CATEGORY_ROCTRACER
Definition: categories.h:57
@ ROCPROFSYS_CATEGORY_PYTHON
Definition: categories.h:43
@ ROCPROFSYS_CATEGORY_CPU_FREQ
Definition: categories.h:67
@ ROCPROFSYS_CATEGORY_PROCESS_KERNEL_MODE_TIME
Definition: categories.h:74
@ ROCPROFSYS_CATEGORY_THREAD_PAGE_FAULT
Definition: categories.h:77
@ ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY
Definition: categories.h:52
@ ROCPROFSYS_CATEGORY_ROCM_SMI
Definition: categories.h:51
@ ROCPROFSYS_CATEGORY_THREAD_CONTEXT_SWITCH
Definition: categories.h:79
@ ROCPROFSYS_CATEGORY_PROCESS_PEAK
Definition: categories.h:70
@ ROCPROFSYS_CATEGORY_PROCESS_USER_MODE_TIME
Definition: categories.h:73
@ ROCPROFSYS_CATEGORY_PROCESS_CONTEXT_SWITCH
Definition: categories.h:71
@ ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER
Definition: categories.h:80
@ ROCPROFSYS_CATEGORY_NUMA
Definition: categories.h:82
@ ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP
Definition: categories.h:53
enum ROCPROFSYS_ANNOTATION_TYPE rocprofsys_annotation_type_t
void * value
data to annotate
Definition: categories.h:184
unsigned long type
rocprofsys_annotation_type_t
Definition: categories.h:182
ROCPROFSYS_ANNOTATION_TYPE
Identifier for the data type of the annotation. if the data type is not a pointer,...
Definition: categories.h:97
@ ROCPROFSYS_INT32
Definition: categories.h:119
@ ROCPROFSYS_FP64
Definition: categories.h:114
@ ROCPROFSYS_UINT64
Definition: categories.h:110
@ ROCPROFSYS_VOID_P
Definition: categories.h:116
@ ROCPROFSYS_VALUE_FLOAT32
Definition: categories.h:124
@ ROCPROFSYS_VALUE_UINT16
Definition: categories.h:130
@ ROCPROFSYS_SIZE_T
Definition: categories.h:105
@ ROCPROFSYS_UINT32
Definition: categories.h:122
@ ROCPROFSYS_VALUE_NONE
Definition: categories.h:99
@ ROCPROFSYS_VALUE_FLOAT64
Definition: categories.h:112
@ ROCPROFSYS_UINT16
Definition: categories.h:131
@ ROCPROFSYS_FP32
Definition: categories.h:126
@ ROCPROFSYS_U32
Definition: categories.h:123
@ ROCPROFSYS_VALUE_CSTR
Definition: categories.h:102
@ ROCPROFSYS_VALUE_UINT64
Definition: categories.h:109
@ ROCPROFSYS_U64
Definition: categories.h:111
@ ROCPROFSYS_VALUE_INT64
Definition: categories.h:106
@ ROCPROFSYS_FLOAT64
Definition: categories.h:113
@ ROCPROFSYS_VALUE_LAST
Definition: categories.h:136
@ ROCPROFSYS_VALUE_UINT32
Definition: categories.h:121
@ ROCPROFSYS_INT16
Definition: categories.h:128
@ ROCPROFSYS_VALUE_SIZE_T
Definition: categories.h:104
@ ROCPROFSYS_VALUE_VOID_P
Definition: categories.h:115
@ ROCPROFSYS_I64
Definition: categories.h:108
@ ROCPROFSYS_U16
Definition: categories.h:132
@ ROCPROFSYS_STRING
Definition: categories.h:103
@ ROCPROFSYS_FLOAT32
Definition: categories.h:125
@ ROCPROFSYS_I32
Definition: categories.h:120
@ ROCPROFSYS_VALUE_INT32
Definition: categories.h:118
@ ROCPROFSYS_PTR
Definition: categories.h:117
@ ROCPROFSYS_I16
Definition: categories.h:129
@ ROCPROFSYS_INT64
Definition: categories.h:107
@ ROCPROFSYS_VALUE_INT16
Definition: categories.h:127
A struct containing annotation data to be included in the perfetto trace.
Definition: categories.h:178