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 0.4.0
ROCm Profiling API and tools
rocprofiler.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2023 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#include <stddef.h>
26#include <stdint.h>
27
29#include "rocprofiler-sdk/fwd.h"
30
31/**
32 * @defgroup VERSIONING_GROUP Library Versioning
33 * @brief Version information about the interface and the associated installed library.
34 *
35 * The semantic version of the interface following semver.org rules. A context
36 * that uses this interface is only compatible with the installed library if
37 * the major version numbers match and the interface minor version number is
38 * less than or equal to the installed library minor version number.
39 *
40 * @{
41 */
42
44
45ROCPROFILER_EXTERN_C_INIT
46
47/**
48 * @fn rocprofiler_status_t rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t*
49 * patch)
50 * @brief Query the version of the installed library.
51 *
52 * Return the version of the installed library. This can be used to check if
53 * it is compatible with this interface version. This function can be used
54 * even when the library is not initialized.
55 *
56 * @param [out] major The major version number is stored if non-NULL.
57 * @param [out] minor The minor version number is stored if non-NULL.
58 * @param [out] patch The patch version number is stored if non-NULL.
59 */
61rocprofiler_get_version(uint32_t* major, uint32_t* minor, uint32_t* patch) ROCPROFILER_API;
62
63ROCPROFILER_EXTERN_C_FINI
64
65/** @} */
66
76#include "rocprofiler-sdk/hip.h"
77#include "rocprofiler-sdk/hsa.h"
80// #include "rocprofiler-sdk/marker.h"
83// #include "rocprofiler-sdk/spm.h"
84
85ROCPROFILER_EXTERN_C_INIT
86
87/**
88 * @defgroup MISCELLANEOUS_GROUP Miscellaneous Utility Functions
89 *
90 * @{
91 */
92
93/**
94 * @fn rocprofiler_status_t rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts)
95 * @brief Get the timestamp value that rocprofiler uses
96 * @param [out] ts Output address of the rocprofiler timestamp value
97 */
99rocprofiler_get_timestamp(rocprofiler_timestamp_t* ts) ROCPROFILER_API ROCPROFILER_NONNULL(1);
100
101/**
102 * @fn rocprofiler_status_t rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid)
103 * @brief Get the identifier value of the current thread that is used by rocprofiler
104 * @param [out] tid Output address of the rocprofiler thread id value
105 */
107rocprofiler_get_thread_id(rocprofiler_thread_id_t* tid) ROCPROFILER_API ROCPROFILER_NONNULL(1);
108
109/**
110 * @fn const char* rocprofiler_get_status_name(rocprofiler_status_t status)
111 * @brief Return the string encoding of @ref rocprofiler_status_t value
112 * @param [in] status error code value
113 * @return Will return a nullptr if invalid/unsupported @ref rocprofiler_status_t value is provided.
114 */
115const char*
117
118/**
119 * @fn const char* rocprofiler_get_status_string(rocprofiler_status_t status)
120 * @brief Return the message associated with @ref rocprofiler_status_t value
121 * @param [in] status error code value
122 * @return Will return a nullptr if invalid/unsupported @ref rocprofiler_status_t value is provided.
123 */
124const char*
126
127/** @} */
128
129ROCPROFILER_EXTERN_C_FINI
rocprofiler_status_t
Status codes.
Definition fwd.h:55
uint64_t rocprofiler_thread_id_t
Thread ID. Value will be equivalent to syscall(__NR_gettid)
Definition fwd.h:439
uint64_t rocprofiler_timestamp_t
ROCProfiler Timestamp.
Definition fwd.h:429
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(uint32_t *major, uint32_t *minor, uint32_t *patch)
Query the version of the installed library.