#ifndef INCLUDE_PERFETTO_TRACING_INTERNAL_TRACK_EVENT_DATA_SOURCE_H_
#define INCLUDE_PERFETTO_TRACING_INTERNAL_TRACK_EVENT_DATA_SOURCE_H_
#include "perfetto/base/compiler.h"
#include "perfetto/base/template_util.h"
#include "perfetto/protozero/message_handle.h"
#include "perfetto/tracing/core/data_source_config.h"
#include "perfetto/tracing/data_source.h"
#include "perfetto/tracing/event_context.h"
#include "perfetto/tracing/internal/track_event_internal.h"
#include "perfetto/tracing/internal/track_event_legacy.h"
#include "perfetto/tracing/internal/write_track_event_args.h"
#include "perfetto/tracing/track.h"
#include "perfetto/tracing/track_event_category_registry.h"
#include "protos/perfetto/common/builtin_clock.pbzero.h"
#include "protos/perfetto/config/track_event/track_event_config.gen.h"
#include "protos/perfetto/trace/track_event/track_event.pbzero.h"
#include <type_traits>
namespace perfetto {
namespace {
class StopArgsImpl : public DataSourceBase::StopArgs { … };
}
template <typename T>
struct TraceTimestampTraits;
template <>
struct TraceTimestampTraits<uint64_t> { … };
template <>
struct TraceTimestampTraits<TraceTimestamp> { … };
namespace internal {
namespace {
template <typename T>
static constexpr bool IsValidTrack() { … }
template <typename T>
static constexpr bool IsValidNormalTrack() { … }
template <
typename T,
typename CanBeConvertedToNsCheck =
decltype(::perfetto::TraceTimestampTraits<typename base::remove_cvref_t<
T>>::ConvertTimestampToTraceTimeNs(std::declval<T>())),
typename NotTrackCheck =
typename std::enable_if<!IsValidNormalTrack<T>()>::type,
typename NotLambdaCheck =
typename std::enable_if<!IsValidTraceLambda<T>()>::type>
static constexpr bool IsValidTimestamp() { … }
void_t;
template <typename T, typename = void>
struct IsValidEventNameType
: std::is_same<perfetto::DynamicString, typename std::decay<T>::type> { … };
IsValidEventNameType<T, void_t<decltype(GetStaticString(std::declval<T>()))>>;
template <typename T>
inline void ValidateEventNameType() { … }
inline bool UnorderedEqual(std::vector<std::string> vec1,
std::vector<std::string> vec2) { … }
}
inline ::perfetto::DynamicString DecayEventNameType(
::perfetto::DynamicString name) { … }
inline ::perfetto::StaticString DecayEventNameType(
::perfetto::StaticString name) { … }
inline ::perfetto::StaticString DecayEventNameType(const char* name) { … }
template <typename CategoryType>
struct CategoryTraits { … };
template <>
struct CategoryTraits<size_t> { … };
struct TrackEventDataSourceTraits : public perfetto::DefaultDataSourceTraits { … };
template <typename DerivedDataSource,
const TrackEventCategoryRegistry* Registry>
class TrackEventDataSource
: public DataSource<DerivedDataSource, TrackEventDataSourceTraits> { … };
}
}
#endif