Support spaces in marker API labels
Created by: jrmadsen
- replaces "%s" with "%Nc" where N is set to one minus the size of the zeroed out.
- added printout of regiontag to not valid region description msg
Hey @TomTheBear I was using the marker API and was generating some strings dynamically in timemory along the lines of: "run/ex_cxx_overhead.cpp:314 [with timing = mode::manual]"
and was getting errors + a segfault at the end of the application like so:
Line 1:run/ex_cxx_overhead.cpp:314 [with timing = mode::none]-0
not a valid region description
Line 2:run/ex_cxx_overhead.cpp:314 [with timing = mode::manual]-0
not a valid region description
Line 3:run/ex_cxx_overhead.cpp:314 [with timing = mode::single]-0
not a valid region description
Line 4:run/ex_cxx_overhead.cpp:314 [with timing = mode::blank]-0
not a valid region description
Line 5:run/ex_cxx_overhead.cpp:314 [with timing = mode::blank_pointer]-0
not a valid region description
Line 6:run/ex_cxx_overhead.cpp:314 [with timing = mode::chained]-0
not a valid region description
Line 7:run/ex_cxx_overhead.cpp:314 [with timing = mode::basic]-0
not a valid region description
Line 8:run/ex_cxx_overhead.cpp:314 [with timing = mode::basic_pointer]-0
not a valid region description
Line 9:run/ex_cxx_overhead.cpp:314 [with timing = mode::invoke]-0
not a valid region description
Segmentation fault (core dumped)
Which was a bit opaque since the string looked correct. But then I added regiontag
to the "not a valid region description" message and realized what has happening with the spaces so I patched perfmon.c
and nvmon.c
to support spaces and I included that diagnostic as part of this PR since it was helpful.
If I were you, I'd verify my implementation... my C string manipulation skills are fairly rusty due to my predilection for C++ strings.