18 #ifndef ION_PROFILE_TRACERECORDER_H_
19 #define ION_PROFILE_TRACERECORDER_H_
23 #include <unordered_map>
25 #include "base/integral_types.h"
32 #include "third_party/jsoncpp/include/json/json.h"
37 class CallTraceManager;
46 : id(id), time_micros(time_micros) {}
89 const std::string&
name,
90 const std::string&
value);
121 uint32 timestamp,
const char*
name,
const char*
value);
141 void DumpTrace(std::string* output, uint32 string_index_offset)
const;
155 static size_t s_default_buffer_size_;
158 static bool s_reserve_buffer_;
162 uint32 GetStringIndex(
const std::string&
str);
167 std::string GetStringArg(
size_t index,
int arg_index,
173 std::unique_ptr<TimelineEvent> GetTimelineEvent(
190 std::unordered_map<std::string, uint32> string_buffer_;
199 std::string thread_name_;
204 uint32 current_frame_number_;
210 #endif // ION_PROFILE_TRACERECORDER_H_
uint32 GetCurrentFrameNumber() const
Returns the frame number of the current frame scope, or 0 (and a warning message) if TraceRecorder is...
void AnnotateCurrentScopeAtTime(uint32 timestamp, const std::string &name, const std::string &value)
Same as AnnotateCurrentScope, but with specified timestamp.
void EnterTimeRange(uint32 unique_id, const char *name, const char *value)
Records the start of a time range event.
static size_t GetDefaultBufferSize()
Manipulate the default buffer size in bytes used for future instantiations.
void AnnotateCurrentScope(const std::string &name, const std::string &value)
Attaches data to the current scope, which will be visible on mouse-over.
static void SetDefaultBufferSize(size_t s)
Class for recording frame events.
void SetThreadName(const std::string &name)
Sets a name for the thread that this recorder is tracing.
static void SetReserveBuffer(bool reserve)
size_t GetNumTraces() const
Returns the total number of recorded trace events.
void EnterScopeAtTime(uint32 timestamp, int event_id)
Same as EnterScope, but with specified timestamp.
TraceRecorder(CallTraceManager *manager)
void AddTraceToTimelineNode(TimelineNode *root) const
Adds all events in the trace as a sub-tree under the passed in root node.
static bool GetReserveBuffer()
Maniupulate whether or not to reserve the full buffer size immediately for future instantiations...
void LeaveScope()
Leaves the current (most recent) scope.
void CreateTimeStampAtTime(uint32 timestamp, const char *name, const char *value)
Same as CreateTimeStamp, but with specified timestamp.
void CreateTimeStamp(const char *name, const char *value)
Records a timeStamp event.
Allocatable is an abstract base class for classes whose memory is managed by an Allocator.
void DumpStrings(std::vector< std::string > *table) const
Dumps the strings one by one to a string table.
void LeaveFrame()
Records a frame exit event for the current frame index.
Copyright 2016 Google Inc.
base::CircularBuffer< uint32 > TraceBuffer
void LeaveTimeRange(uint32 id)
Records the end of a time range event for the specified unique id.
std::unordered_map< uint32, std::string > IndexToStringMap
void EnterScope(int event_id)
Queries and records the event corresponding to the provided event_id.
void DumpTrace(std::string *output, uint32 string_index_offset) const
Appends a binary dump of the trace to the output string.
void EnterFrame(uint32 frame_number)
Records a frame enter event with a specified frame index.
pthread_t ThreadId
Defines a type that can be used to identify a thread.
bool IsInFrameScope() const
Returns if the TraceRecorder is currently in a frame scope.
Manages call trace recording for visualization in Web Tracing Framework (WTF) format.
const ion::port::ThreadId & GetThreadId() const
Returns the ID of the thread that this recorder is tracing.
std::string GetThreadName() const
Returns the name for the thread that this recorder is tracing.
void LeaveScopeAtTime(uint32 timestamp)
Same as LeaveScope, but with specified timestamp.