MicroProfiler creates a common way to gain fine-grained insight into runtime performance.
class MicroProfiler : public tflite::MicroProfilerInterfaceMicroProfiler creates a common way to gain fine-grained insight into runtime performance. Bottleck operators can be identified along with slow code sections. This can be used in conjunction with running the relevant micro benchmark to evaluate end-to-end performance.
tflite::MicroProfiler::MicroProfiler()virtual tflite::MicroProfiler::~MicroProfiler()BeginEvent
C++Marks the start of a new event and returns an event handle that can be used to mark the end of the event via EndEvent.
virtual uint32_t tflite::MicroProfiler::BeginEvent(const char *tag)Marks the start of a new event and returns an event handle that can be used to mark the end of the event via EndEvent. The lifetime of the tag parameter must exceed that of the MicroProfiler.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
tag | const char * | Required |
EndEvent
C++Marks the end of an event associated with eventhandle.
virtual void tflite::MicroProfiler::EndEvent(uint32_t event_handle)Marks the end of an event associated with event_handle. It is the responsibility of the caller to ensure than EndEvent is called once and only once per event_handle.
If EndEvent is called more than once for the same event_handle, the last call will be used as the end of event marker. If EndEvent is called 0 times for a particular event_handle, the duration of that event will be 0 ticks.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
event_handle | uint32_t | Required |
ClearEvents
C++Clears all the events that have been currently profiled.
void tflite::MicroProfiler::ClearEvents()Clears all the events that have been currently profiled.
Returns the sum of the ticks taken across all the events.
uint32_t tflite::MicroProfiler::GetTotalTicks() constReturns the sum of the ticks taken across all the events. This number is only meaningful if all of the events are disjoint (the end time of event[i] <= start time of event[i+1]).
Log
C++Prints the profiling information of each of the events in human readable form.
void tflite::MicroProfiler::Log() constPrints the profiling information of each of the events in human readable form.
LogCsv
C++Prints the profiling information of each of the events in CSV (Comma Separated Value) form.
void tflite::MicroProfiler::LogCsv() constPrints the profiling information of each of the events in CSV (Comma Separated Value) form.
Prints total ticks for each unique tag in CSV format.
void tflite::MicroProfiler::LogTicksPerTagCsv()Prints total ticks for each unique tag in CSV format. Output will have one row for each unique tag along with the total ticks summed across all events with that particular tag.