rocprofiler-sdk/rocprofiler.h Source File

rocprofiler-sdk/rocprofiler.h Source File#

ROCprofiler-SDK developer API: rocprofiler-sdk/rocprofiler.h Source File
ROCprofiler-SDK developer API 1.0.0
ROCm Profiling API and tools
rocprofiler.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2023-2025 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#pragma once
24
25/**
26 *
27 * @file rocprofiler.h
28 * @brief ROCProfiler-SDK API interface.
29 *
30 * @mainpage ROCProfiler-SDK API Specification
31 *
32 * @section introduction Introduction
33 * ROCprofiler-SDK is a library that implements the profiling and performance monitoring
34 * capabilities for AMD's ROCm platform. It provides a comprehensive set of APIs for:
35 *
36 * - Hardware performance counters monitoring
37 * - PC sampling for kernel execution analysis
38 * - Buffer and callback-based tracing mechanisms
39 * - Device and dispatch counting services
40 * - External correlation tracking
41 * - HIP and HSA runtime profiling support
42 *
43 * The library is designed to help developers analyze and optimize the performance
44 * of applications running on AMD GPUs. It offers both low-level hardware access
45 * and high-level profiling abstractions to accommodate different profiling needs.
46 *
47 *
48 * \section compatibility Compatibility
49 * ROCprofiler-SDK is compatible with AMD ROCm platform and supports
50 * profiling of applications using HIP and HSA runtimes.
51 */
52
53#include <stddef.h>
54#include <stdint.h>
55
56#include "rocprofiler-sdk/defines.h"
57#include "rocprofiler-sdk/fwd.h"
58
59/**
60 * @defgroup VERSIONING_GROUP Library Versioning
61 * @brief Version information about the interface and the associated installed library.
62 *
63 * The semantic version of the interface following semver.org rules. A context
64 * that uses this interface is only compatible with the installed library if
65 * the major version numbers match and the interface minor version number is
66 * less than or equal to the installed library minor version number.
67 *
68 * @{
69 */
70
71#include "rocprofiler-sdk/version.h"
72
73ROCPROFILER_EXTERN_C_INIT
74
75/**
76 * @fn rocprofiler_status_t rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t*
77 * patch)
78 * @brief Query the version of the installed library.
79 *
80 * Returns the version of the rocprofiler-sdk library loaded at runtime. This can be used to check
81 * if the runtime version is equal to or compatible with the version of rocprofiler-sdk used during
82 * compilation time. This function can be invoked before tool initialization.
83 *
84 * @param [out] major The major version number is stored if non-NULL.
85 * @param [out] minor The minor version number is stored if non-NULL.
86 * @param [out] patch The patch version number is stored if non-NULL.
87 * @return ::rocprofiler_status_t
88 * @retval ::ROCPROFILER_STATUS_SUCCESS Always returned
89 */
91rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t* patch) ROCPROFILER_API;
92
93/**
94 * @brief Simplified alternative to ::rocprofiler_get_version
95 *
96 * Returns the version of the rocprofiler-sdk library loaded at runtime. This can be used to check
97 * if the runtime version is equal to or compatible with the version of rocprofiler-sdk used during
98 * compilation time. This function can be invoked before tool initialization.
99 *
100 * @param [out] info Pointer to version triplet struct which will be populated by the function call.
101 * @return ::rocprofiler_status_t
102 * @retval ::ROCPROFILER_STATUS_SUCCESS Always returned
103 */
106 ROCPROFILER_NONNULL(1);
107
108ROCPROFILER_EXTERN_C_FINI
109
110/** @} */
111
112#include "rocprofiler-sdk/agent.h"
113#include "rocprofiler-sdk/buffer.h"
114#include "rocprofiler-sdk/buffer_tracing.h"
115#include "rocprofiler-sdk/callback_tracing.h"
116#include "rocprofiler-sdk/context.h"
117#include "rocprofiler-sdk/counter_config.h"
118#include "rocprofiler-sdk/counters.h"
119#include "rocprofiler-sdk/device_counting_service.h"
120#include "rocprofiler-sdk/dispatch_counting_service.h"
121#include "rocprofiler-sdk/external_correlation.h"
122#include "rocprofiler-sdk/hip.h"
123#include "rocprofiler-sdk/hsa.h"
124#include "rocprofiler-sdk/intercept_table.h"
125#include "rocprofiler-sdk/internal_threading.h"
126#include "rocprofiler-sdk/marker.h"
127#include "rocprofiler-sdk/ompt.h"
128#include "rocprofiler-sdk/pc_sampling.h"
129#include "rocprofiler-sdk/rccl.h"
130#include "rocprofiler-sdk/rocdecode.h"
131#include "rocprofiler-sdk/rocjpeg.h"
132// #include "rocprofiler-sdk/spm.h"
133
134// subject to removal
135#include "rocprofiler-sdk/deprecated/profile_config.h"
136
137ROCPROFILER_EXTERN_C_INIT
138
139/**
140 * @defgroup MISCELLANEOUS_GROUP Miscellaneous Utility Functions
141 * @brief utility functions for library
142 * @{
143 */
144
145/**
146 * @fn rocprofiler_status_t rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts)
147 * @brief Get the timestamp value that rocprofiler uses
148 * @param [out] ts Output address of the rocprofiler timestamp value
149 * @return ::rocprofiler_status_t
150 * @retval ::ROCPROFILER_STATUS_SUCCESS Always returned
151 */
153rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts) ROCPROFILER_API ROCPROFILER_NONNULL(1);
154
155/**
156 * @fn rocprofiler_status_t rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid)
157 * @brief Get the identifier value of the current thread that is used by rocprofiler
158 * @param [out] tid Output address of the rocprofiler thread id value
159 * @return ::rocprofiler_status_t
160 * @retval ::ROCPROFILER_STATUS_SUCCESS Always returned
161 */
163rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid) ROCPROFILER_API ROCPROFILER_NONNULL(1);
164
165/**
166 * @fn const char* rocprofiler_get_status_name(rocprofiler_status_t status)
167 * @brief Return the string encoding of ::rocprofiler_status_t value
168 * @param [in] status error code value
169 * @return Will return a nullptr if invalid/unsupported ::rocprofiler_status_t value is provided.
170 */
171const char*
173
174/**
175 * @fn const char* rocprofiler_get_status_string(rocprofiler_status_t status)
176 * @brief Return the message associated with ::rocprofiler_status_t value
177 * @param [in] status error code value
178 * @return Will return a nullptr if invalid/unsupported ::rocprofiler_status_t value is provided.
179 */
180const char*
182
183/** @} */
184
185ROCPROFILER_EXTERN_C_FINI
rocprofiler_status_t
Status codes.
Definition fwd.h:49
uint64_t rocprofiler_thread_id_t
Thread ID. Value will be equivalent to syscall(__NR_gettid)
Definition fwd.h:507
uint64_t rocprofiler_timestamp_t
ROCProfiler Timestamp.
Definition fwd.h:502
Versioning info.
Definition fwd.h:590
const char * rocprofiler_get_status_name(rocprofiler_status_t status)
Return the string encoding of rocprofiler_status_t value.
rocprofiler_status_t rocprofiler_get_timestamp(rocprofiler_timestamp_t *ts)
Get the timestamp value that rocprofiler uses.
const char * rocprofiler_get_status_string(rocprofiler_status_t status)
Return the message associated with rocprofiler_status_t value.
rocprofiler_status_t rocprofiler_get_thread_id(rocprofiler_thread_id_t *tid)
Get the identifier value of the current thread that is used by rocprofiler.
rocprofiler_status_t rocprofiler_get_version_triplet(rocprofiler_version_triplet_t *info)
Simplified alternative to rocprofiler_get_version.
rocprofiler_status_t rocprofiler_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
Query the version of the installed library.