rocprofiler-sdk/context.h Source File

rocprofiler-sdk/context.h Source File#

Rocprofiler SDK Developer API: rocprofiler-sdk/context.h Source File
Rocprofiler SDK Developer API 0.5.0
ROCm Profiling API and tools
context.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
26#include <rocprofiler-sdk/fwd.h>
27
28ROCPROFILER_EXTERN_C_INIT
29
30/**
31 * @defgroup CONTEXT_OPERATIONS Context Handling
32 * @brief Associate services with a handle. This handle is used to activate/deactivate the services
33 * during the application runtime.
34 *
35 * @{
36 */
37
38/**
39 * The NULL Context handle.
40 */
41#define ROCPROFILER_CONTEXT_NONE ROCPROFILER_HANDLE_LITERAL(rocprofiler_context_id_t, UINT64_MAX)
42
43/**
44 * @brief Create context.
45 *
46 * @param [out] context_id Context identifier
47 * @return ::rocprofiler_status_t
48 */
51 ROCPROFILER_NONNULL(1);
52
53/**
54 * @brief Start context.
55 *
56 * @param [in] context_id Identifier for context to be activated
57 * @return ::rocprofiler_status_t
58 */
61
62/**
63 * @brief Stop context.
64 *
65 * @param [in] context_id Identifier for context to be deactivated
66 * @return ::rocprofiler_status_t
67 */
70
71/**
72 * @brief Query whether context is currently active.
73 *
74 * @param [in] context_id Context identifier for the query
75 * @param [out] status If context is active, this will be a nonzero value
76 * @return ::rocprofiler_status_t
77 * @retval ::ROCPROFILER_STATUS_SUCCESS The input context id identified a registered context
78 * @retval ::ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND The input context id did not identify a
79 * registered context
80 */
82rocprofiler_context_is_active(rocprofiler_context_id_t context_id, int* status) ROCPROFILER_API
83 ROCPROFILER_NONNULL(2);
84
85/**
86 * @brief Query whether the context is valid
87 *
88 * @param [in] context_id Context identifier for the query
89 * @param [out] status If context is invalid, this will be a nonzero value
90 * @return ::rocprofiler_status_t
91 */
93rocprofiler_context_is_valid(rocprofiler_context_id_t context_id, int* status) ROCPROFILER_API
94 ROCPROFILER_NONNULL(2);
95
96/** @} */
97
98ROCPROFILER_EXTERN_C_FINI
rocprofiler_status_t
Status codes.
Definition fwd.h:55
Context ID.
Definition fwd.h:502
rocprofiler_status_t rocprofiler_start_context(rocprofiler_context_id_t context_id)
Start context.
rocprofiler_status_t rocprofiler_create_context(rocprofiler_context_id_t *context_id)
Create context.
rocprofiler_status_t rocprofiler_context_is_active(rocprofiler_context_id_t context_id, int *status)
Query whether context is currently active.
rocprofiler_status_t rocprofiler_context_is_valid(rocprofiler_context_id_t context_id, int *status)
Query whether the context is valid.
rocprofiler_status_t rocprofiler_stop_context(rocprofiler_context_id_t context_id)
Stop context.