develop/projects/rocprofiler-systems/source/lib/rocprof-sys-causal-api/rocprofiler-systems/causal.h Source File

develop/projects/rocprofiler-systems/source/lib/rocprof-sys-causal-api/rocprofiler-systems/causal.h Source File#

rocprofiler-systems: develop/projects/rocprofiler-systems/source/lib/rocprof-sys-causal-api/rocprofiler-systems/causal.h Source File
causal.h
Go to the documentation of this file.
1 // Copyright (c) Advanced Micro Devices, Inc.
2 // SPDX-License-Identifier: MIT
3 
4 /** @file causal.h */
5 
6 #ifndef ROCPROFSYS_CAUSAL_H_
7 #define ROCPROFSYS_CAUSAL_H_
8 
9 /**
10  * @defgroup ROCPROFSYS_CAUSAL_GROUP ROCm Systems Profiler Causal Profiling Defines
11  *
12  * @{
13  */
14 
15 #if !defined(ROCPROFSYS_CAUSAL_ENABLED)
16 /** Preprocessor switch to enable/disable instrumentation for causal profiling */
17 # define ROCPROFSYS_CAUSAL_ENABLED 1
18 #endif
19 
20 #if ROCPROFSYS_CAUSAL_ENABLED > 0
21 # include <rocprofiler-systems/causal_api.h> // NOLINT(misc-include-cleaner)
22 
23 # if !defined(ROCPROFSYS_CAUSAL_LABEL)
24 /** @cond ROCPROFSYS_HIDDEN_DEFINES */
25 # define ROCPROFSYS_CAUSAL_STR2(x) #x
26 # define ROCPROFSYS_CAUSAL_STR(x) ROCPROFSYS_CAUSAL_STR2(x)
27 /** @endcond */
28 /** Default label for a causal progress point */
29 # define ROCPROFSYS_CAUSAL_LABEL __FILE__ ":" ROCPROFSYS_CAUSAL_STR(__LINE__)
30 # endif
31 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS)
32 /** Adds a throughput progress point with label `<file>:<line>` */
33 # define ROCPROFSYS_CAUSAL_PROGRESS \
34  rocprofsys_causal_progress(ROCPROFSYS_CAUSAL_LABEL);
35 # endif
36 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED)
37 /** Adds a throughput progress point with user defined label. Each instance should use a
38  * unique label. */
39 # define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL) rocprofsys_causal_progress(LABEL);
40 # endif
41 # if !defined(ROCPROFSYS_CAUSAL_BEGIN)
42 /** Starts a latency progress point (region of interest) with user defined label. Each
43  * instance should use a unique label. */
44 # define ROCPROFSYS_CAUSAL_BEGIN(LABEL) rocprofsys_causal_begin(LABEL);
45 # endif
46 # if !defined(ROCPROFSYS_CAUSAL_END)
47 /** End the latency progress point (region of interest) for the matching user defined
48  * label. */
49 # define ROCPROFSYS_CAUSAL_END(LABEL) rocprofsys_causal_end(LABEL);
50 # endif
51 #else
52 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS)
53 # define ROCPROFSYS_CAUSAL_PROGRESS
54 # endif
55 # if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED)
56 # define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL)
57 # endif
58 # if !defined(ROCPROFSYS_CAUSAL_BEGIN)
59 # define ROCPROFSYS_CAUSAL_BEGIN(LABEL)
60 # endif
61 # if !defined(ROCPROFSYS_CAUSAL_END)
62 # define ROCPROFSYS_CAUSAL_END(LABEL)
63 # endif
64 #endif
65 
66 /** @} */
67 
68 #endif // ROCPROFSYS_CAUSAL_H_