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.4.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 */
49rocprofiler_status_t ROCPROFILER_API
50rocprofiler_create_context(rocprofiler_context_id_t* context_id) ROCPROFILER_NONNULL(1);
51
52/**
53 * @brief Start context.
54 *
55 * @param [in] context_id Identifier for context to be activated
56 * @return ::rocprofiler_status_t
57 */
58rocprofiler_status_t ROCPROFILER_API
60
61/**
62 * @brief Stop context.
63 *
64 * @param [in] context_id Identifier for context to be deactivated
65 * @return ::rocprofiler_status_t
66 */
67rocprofiler_status_t ROCPROFILER_API
69
70/**
71 * @brief Query whether context is currently active.
72 *
73 * @param [in] context_id Context identifier for the query
74 * @param [out] status If context is active, this will be a nonzero value
75 * @return ::rocprofiler_status_t
76 * @retval ::ROCPROFILER_STATUS_SUCCESS The input context id identified a registered context
77 * @retval ::ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND The input context id did not identify a
78 * registered context
79 */
80rocprofiler_status_t ROCPROFILER_API
82 ROCPROFILER_NONNULL(2);
83
84/**
85 * @brief Query whether the context is valid
86 *
87 * @param [in] context_id Context identifier for the query
88 * @param [out] status If context is invalid, this will be a nonzero value
89 * @return ::rocprofiler_status_t
90 */
91rocprofiler_status_t ROCPROFILER_API
93 ROCPROFILER_NONNULL(2);
94
95/** @} */
96
97ROCPROFILER_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.