moz.build |
|
575 |
Perfetto.cpp |
|
1155 |
Perfetto.h |
Perfetto Tracing:
This file provides an interface to the perfetto tracing API. The API from
the perfetto sdk can be used directly, but an additional set of macros
prefixed with PERFETTO_* have been defined to help minimize the use of
ifdef's.
The common perfetto macros require a category and name at the very least.
These must be static strings, or wrapped with perfetto::DynamicString if
dynamic. If the string is static, but provided through a runtime pointer,
then it must be wrapped with perfetto::StaticString.
You can also provide additional parameters such as a timestamp,
or a lambda to add additional information to the trace marker.
For more info, see https://perfetto.dev/docs/instrumentation/tracing-sdk
Examples:
// Add a trace event to measure work inside a block,
// using static strings only.
{
PERFETTO_TRACE_EVENT("js", "JS::RunScript");
run_script();
}
// Add a trace event to measure work inside a block,
// using a dynamic string.
void runScript(nsCString& scriptName)
{
PERFETTO_TRACE_EVENT("js", perfetto::DynamicString{scriptName.get()});
run_script();
}
// Add a trace event using a dynamic category and name.
void runScript(nsCString& categoryName, nsCString& scriptName)
{
perfetto::DynamicCategory category{category.get()};
PERFETTO_TRACE_EVENT(category, perfetto::DynamicString{scriptName.get()});
run_script();
}
// Add a trace event to measure two arbitrary points of code.
// Events in the same category must always be nested.
void startWork() {
PERFETTO_TRACE_EVENT_BEGIN("js", "StartWork");
...
PERFETTO_TRACE_EVENT_END("js");
}
// Create a trace marker for an event that has already occurred
// using previously saved timestamps.
void record_event(TimeStamp startTimeStamp, TimeStamp endTimeStamp)
{
PERFETTO_TRACE_EVENT_BEGIN("js", "Some Event", startTimeStamp);
PERFETTO_TRACE_EVENT_END("js", endTimeStamp);
}
|
12573 |
PerfStats.cpp |
|
9554 |
PerfStats.h |
|
6373 |