* Misc tweaks

- C API function print with warning colors
- split region/trace start/stop functions into regions.cpp file

* Config option for disabling perfetto annotations

* Missing checks in roctracer.cpp and sampling.cpp

* Verbose makefile in CI

* run-ci uses -VV

* Fix gcc-7 maybe-uninitialized warning

* Fix push/pop perfetto

- moving perfetto::EventContext was causing errors
Этот коммит содержится в:
Jonathan R. Madsen authored and GitHub committed 2022-11-16 09:48:15 -06:00
1 родитель 2135f82ab8
Коммит 2f16e2ecb1
13 files changed
+464 -220

No files matched your search

-127
Просмотреть файл
@@ -26,7 +26,6 @@
#include "api.hpp"
#include "common/setup.hpp"
#include "library/components/category_region.hpp"
#include "library/components/exit_gotcha.hpp"
#include "library/components/fork_gotcha.hpp"
#include "library/components/fwd.hpp"
@@ -152,132 +151,6 @@ using Device = critical_trace::Device;
using Phase = critical_trace::Phase;
} // namespace
//======================================================================================//
extern "C" void
omnitrace_push_trace_hidden(const char* name)
{
component::category_region<category::host>::start(name);
}
extern "C" void
omnitrace_pop_trace_hidden(const char* name)
{
component::category_region<category::host>::stop(name);
}
//======================================================================================//
///
///
///
//======================================================================================//
extern "C" void
omnitrace_push_region_hidden(const char* name)
{
component::category_region<category::user>::start(name);
}
extern "C" void
omnitrace_pop_region_hidden(const char* name)
{
component::category_region<category::user>::stop(name);
}
//======================================================================================//
///
///
///
//======================================================================================//
namespace omnitrace
{
namespace
{
template <size_t Idx, size_t... Tail>
void
invoke_category_region_start(omnitrace_category_t _category, const char* name,
omnitrace_annotation_t* _annotations,
size_t _annotation_count, std::index_sequence<Idx, Tail...>)
{
static_assert(Idx > OMNITRACE_CATEGORY_NONE && Idx < OMNITRACE_CATEGORY_LAST,
"Error! index sequence should only contain values which are greater "
"than OMNITRACE_CATEGORY_NONE and less than OMNITRACE_CATEGORY_LAST");
if(_category == Idx)
{
using category_type = category_type_id_t<Idx>;
component::category_region<category_type>::start(
name, [&](::perfetto::EventContext ctx) {
if(_annotations)
{
for(size_t i = 0; i < _annotation_count; ++i)
tracing::add_perfetto_annotation(ctx, _annotations[i]);
}
});
}
else
{
constexpr size_t remaining = sizeof...(Tail);
if constexpr(remaining > 0)
invoke_category_region_start(_category, name, _annotations, _annotation_count,
std::index_sequence<Tail...>{});
}
}
} // namespace
template <size_t Idx, size_t... Tail>
void
invoke_category_region_stop(omnitrace_category_t _category, const char* name,
omnitrace_annotation_t* _annotations,
size_t _annotation_count, std::index_sequence<Idx, Tail...>)
{
static_assert(Idx > OMNITRACE_CATEGORY_NONE && Idx < OMNITRACE_CATEGORY_LAST,
"Error! index sequence should only contain values which are greater "
"than OMNITRACE_CATEGORY_NONE and less than OMNITRACE_CATEGORY_LAST");
if(_category == Idx)
{
using category_type = category_type_id_t<Idx>;
component::category_region<category_type>::stop(
name, [&](::perfetto::EventContext ctx) {
if(_annotations)
{
for(size_t i = 0; i < _annotation_count; ++i)
tracing::add_perfetto_annotation(ctx, _annotations[i]);
}
});
}
else
{
constexpr size_t remaining = sizeof...(Tail);
if constexpr(remaining > 0)
invoke_category_region_stop(_category, name, _annotations, _annotation_count,
std::index_sequence<Tail...>{});
}
}
} // namespace omnitrace
extern "C" void
omnitrace_push_category_region_hidden(omnitrace_category_t _category, const char* name,
omnitrace_annotation_t* _annotations,
size_t _annotation_count)
{
invoke_category_region_start(
_category, name, _annotations, _annotation_count,
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
}
extern "C" void
omnitrace_pop_category_region_hidden(omnitrace_category_t _category, const char* name,
omnitrace_annotation_t* _annotations,
size_t _annotation_count)
{
invoke_category_region_stop(
_category, name, _annotations, _annotation_count,
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
}
//======================================================================================//
///
///