Skip to content

Commit

Permalink
Allow embedders to add events to the timeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde committed Feb 22, 2019
1 parent 3f0ce76 commit 105277a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions shell/platform/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "flutter/fml/make_copyable.h"
#include "flutter/fml/message_loop.h"
#include "flutter/fml/paths.h"
#include "flutter/fml/trace_event.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/switches.h"
#include "flutter/shell/platform/embedder/embedder.h"
Expand Down Expand Up @@ -801,3 +802,15 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction(
}
return kSuccess;
}

void FlutterEngineTraceEventDurationBegin(const char* name) {
fml::tracing::TraceEvent0("flutter", name);
}

void FlutterEngineTraceEventDurationEnd(const char* name) {
fml::tracing::TraceEventEnd(name);
}

void FlutterEngineTraceEventInstant(const char* name) {
fml::tracing::TraceEventInstant0("flutter", name);
}
22 changes: 22 additions & 0 deletions shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,28 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction(
const uint8_t* data,
size_t data_length);

// A profiling utility. Logs a trace duration begin event to the timeline. If
// the timeline is not available or disabled, this has no effect. Must be
// balanced with an duration end event (via
// |FlutterEngineTraceEventDurationEnd|) with the same name on the same thread.
// Can be called on any thread.
FLUTTER_EXPORT
void FlutterEngineTraceEventDurationBegin(const char* name);

// A profiling utility. Logs a trace duration end event to the timeline. If
// the timeline is not available or disabled, this has no effect. This call must
// be preceeded by a trace duration begin call (via
// FlutterEngineTraceEventDurationBegin) with the same name on the same thread.
// Can be called on any thread.
FLUTTER_EXPORT
void FlutterEngineTraceEventDurationEnd(const char* name);

// A profiling utility. Logs a trace duration instant event to the timeline. If
// the timeline is not available or disabled, this has no effect. Can be called
// on any thread.
FLUTTER_EXPORT
void FlutterEngineTraceEventInstant(const char* name);

#if defined(__cplusplus)
} // extern "C"
#endif
Expand Down

0 comments on commit 105277a

Please sign in to comment.