docs-6.3.1/source/lib/rocprof-sys-user/rocprofiler-systems/causal.h Source File

docs-6.3.1/source/lib/rocprof-sys-user/rocprofiler-systems/causal.h Source File#

rocprofiler-systems: docs-6.3.1/source/lib/rocprof-sys-user/rocprofiler-systems/causal.h Source File
causal.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 /** @file causal.h */
24 
25 #ifndef ROCPROFSYS_CAUSAL_H_
26 #define ROCPROFSYS_CAUSAL_H_
27 
28 /**
29  * @defgroup ROCPROFSYS_CASUAL_GROUP ROCm Systems Profiler Causal Profiling Defines
30  *
31  * @{
32  */
33 
34 #if !defined(ROCPROFSYS_CAUSAL_ENABLED)
35 /** Preprocessor switch to enable/disable instrumentation for causal profiling */
36 # define ROCPROFSYS_CAUSAL_ENABLED 1
37 #endif
38 
39 #if ROCPROFSYS_CAUSAL_ENABLED > 0
41 
42 # if !defined(ROCPROFSYS_CAUSAL_LABEL)
43 /** @cond ROCPROFSYS_HIDDEN_DEFINES */
44 # define ROCPROFSYS_CAUSAL_STR2(x) # x
45 # define ROCPROFSYS_CAUSAL_STR(x) ROCPROFSYS_CAUSAL_STR2(x)
46 /** @endcond */
47 /** Default label for a causal progress point */
48 # define ROCPROFSYS_CAUSAL_LABEL __FILE__ ":" ROCPROFSYS_CAUSAL_STR(__LINE__)
49 # endif
50 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS)
51 /** Adds a throughput progress point with label `<file>:<line>` */
52 # define ROCPROFSYS_CAUSAL_PROGRESS \
53  rocprofsys_user_progress(ROCPROFSYS_CAUSAL_LABEL);
54 # endif
55 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED)
56 /** Adds a throughput progress point with user defined label. Each instance should use a
57  * unique label. */
58 # define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL) rocprofsys_user_progress(LABEL);
59 # endif
60 # if !defined(ROCPROFSYS_CAUSAL_BEGIN)
61 /** Starts a latency progress point (region of interest) with user defined label. Each
62  * instance should use a unique label. */
63 # define ROCPROFSYS_CAUSAL_BEGIN(LABEL) rocprofsys_user_push_region(LABEL);
64 # endif
65 # if !defined(ROCPROFSYS_CAUSAL_END)
66 /** End the latency progress point (region of interest) for the matching user defined
67  * label. */
68 # define ROCPROFSYS_CAUSAL_END(LABEL) rocprofsys_user_pop_region(LABEL);
69 # endif
70 #else
71 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS)
72 # define ROCPROFSYS_CAUSAL_PROGRESS
73 # endif
74 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED)
75 # define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL)
76 # endif
77 # if !defined(ROCPROFSYS_CAUSAL_BEGIN)
78 # define ROCPROFSYS_CAUSAL_BEGIN(LABEL)
79 # endif
80 # if !defined(ROCPROFSYS_CAUSAL_END)
81 # define ROCPROFSYS_CAUSAL_END(LABEL)
82 # endif
83 #endif
84 
85 /** @} */
86 
87 #endif // ROCPROFSYS_CAUSAL_H_