File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 8
8
9
9
#include < catch2/catch_test_macros.hpp>
10
10
11
- inline thread_local bool entered = false ;
11
+ inline thread_local const char * current_nvtx_range_name = nullptr ;
12
12
13
13
struct NestedNVTXRangeGuard
14
14
{
@@ -18,24 +18,22 @@ struct NestedNVTXRangeGuard
18
18
explicit NestedNVTXRangeGuard (const char * name)
19
19
: inside_cub_range(strstr(name, " cub::" ) == name)
20
20
{
21
- UNSCOPED_INFO (" Entering NVTX range " << name);
22
21
if (inside_cub_range)
23
22
{
24
- if (entered )
23
+ if (current_nvtx_range_name )
25
24
{
26
- FAIL (" Nested NVTX range detected" );
25
+ FAIL (" Nested NVTX range detected. Entered " << current_nvtx_range_name << " . Now entering " << name );
27
26
}
28
- entered = true ;
27
+ current_nvtx_range_name = name ;
29
28
}
30
29
}
31
30
32
31
~NestedNVTXRangeGuard ()
33
32
{
34
33
if (inside_cub_range)
35
34
{
36
- entered = false ;
35
+ current_nvtx_range_name = nullptr ;
37
36
}
38
- UNSCOPED_INFO (" Leaving NVTX range" );
39
37
}
40
38
};
41
39
You can’t perform that action at this time.
0 commit comments