diff options
Diffstat (limited to 'include/perfetto/tracing/internal/track_event_internal.h')
-rw-r--r-- | include/perfetto/tracing/internal/track_event_internal.h | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/include/perfetto/tracing/internal/track_event_internal.h b/include/perfetto/tracing/internal/track_event_internal.h index d29303988..6de74ef22 100644 --- a/include/perfetto/tracing/internal/track_event_internal.h +++ b/include/perfetto/tracing/internal/track_event_internal.h @@ -20,10 +20,8 @@ #include "perfetto/base/flat_set.h" #include "perfetto/protozero/scattered_heap_buffer.h" #include "perfetto/tracing/core/forward_decls.h" -#include "perfetto/tracing/data_source.h" #include "perfetto/tracing/debug_annotation.h" #include "perfetto/tracing/trace_writer_base.h" -#include "perfetto/tracing/traced_value.h" #include "perfetto/tracing/track.h" #include "protos/perfetto/common/builtin_clock.pbzero.h" #include "protos/perfetto/trace/interned_data/interned_data.pbzero.h" @@ -33,7 +31,6 @@ namespace perfetto { class EventContext; -class TrackEventSessionObserver; struct Category; namespace protos { namespace gen { @@ -44,34 +41,15 @@ class DebugAnnotation; } // namespace pbzero } // namespace protos -// A callback interface for observing track event tracing sessions starting and -// stopping. See TrackEvent::{Add,Remove}SessionObserver. Note that all methods -// will be called on an internal Perfetto thread. -class PERFETTO_EXPORT TrackEventSessionObserver { - public: - virtual ~TrackEventSessionObserver(); - // Called when a track event tracing session is configured. Note tracing isn't - // active yet, so track events emitted here won't be recorded. See - // DataSourceBase::OnSetup. - virtual void OnSetup(const DataSourceBase::SetupArgs&); - // Called when a track event tracing session is started. It is possible to - // emit track events from this callback. - virtual void OnStart(const DataSourceBase::StartArgs&); - // Called when a track event tracing session is stopped. It is still possible - // to emit track events from this callback. - virtual void OnStop(const DataSourceBase::StopArgs&); -}; - namespace internal { class TrackEventCategoryRegistry; -class PERFETTO_EXPORT BaseTrackEventInternedDataIndex { +class BaseTrackEventInternedDataIndex { public: virtual ~BaseTrackEventInternedDataIndex(); #if PERFETTO_DCHECK_IS_ON() const char* type_id_ = nullptr; - const void* add_function_ptr_ = nullptr; #endif // PERFETTO_DCHECK_IS_ON() }; @@ -120,15 +98,11 @@ class PERFETTO_EXPORT TrackEventInternal { const TrackEventCategoryRegistry&, bool (*register_data_source)(const DataSourceDescriptor&)); - static bool AddSessionObserver(TrackEventSessionObserver*); - static void RemoveSessionObserver(TrackEventSessionObserver*); - static void EnableTracing(const TrackEventCategoryRegistry& registry, const protos::gen::TrackEventConfig& config, - const DataSourceBase::SetupArgs&); - static void OnStart(const DataSourceBase::StartArgs&); + uint32_t instance_index); static void DisableTracing(const TrackEventCategoryRegistry& registry, - const DataSourceBase::StopArgs&); + uint32_t instance_index); static bool IsCategoryEnabled(const TrackEventCategoryRegistry& registry, const protos::gen::TrackEventConfig& config, const Category& category); @@ -141,15 +115,12 @@ class PERFETTO_EXPORT TrackEventInternal { perfetto::protos::pbzero::TrackEvent::Type, uint64_t timestamp = GetTimeNs()); - static void ResetIncrementalState(TraceWriterBase*, uint64_t timestamp); - template <typename T> static void AddDebugAnnotation(perfetto::EventContext* event_ctx, const char* name, T&& value) { auto annotation = AddDebugAnnotation(event_ctx, name); - WriteIntoTracedValue(internal::CreateTracedValueFromProto(annotation), - std::forward<T>(value)); + WriteDebugAnnotation(annotation, value); } // If the given track hasn't been seen by the trace writer yet, write a @@ -179,7 +150,7 @@ class PERFETTO_EXPORT TrackEventInternal { // Get the clock used by GetTimeNs(). static constexpr protos::pbzero::BuiltinClock GetClockId() { -#if !PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) && \ +#if !PERFETTO_BUILDFLAG(PERFETTO_OS_MACOSX) && \ !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) return protos::pbzero::BUILTIN_CLOCK_BOOTTIME; #else @@ -187,12 +158,8 @@ class PERFETTO_EXPORT TrackEventInternal { #endif } - static int GetSessionCount(); - - // Represents the default track for the calling thread. - static const Track kDefaultTrack; - private: + static void ResetIncrementalState(TraceWriterBase*, uint64_t timestamp); static protozero::MessageHandle<protos::pbzero::TracePacket> NewTracePacket( TraceWriterBase*, uint64_t timestamp, @@ -201,8 +168,6 @@ class PERFETTO_EXPORT TrackEventInternal { static protos::pbzero::DebugAnnotation* AddDebugAnnotation( perfetto::EventContext*, const char* name); - - static std::atomic<int> session_count_; }; } // namespace internal |