File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,14 @@ from within operator kernels and other TFLite Micro routines.
23
23
24
24
## API
25
25
26
- The MicroInterpreter class constructor contains and optional profiler argument.
26
+ The MicroInterpreter class constructor contains an optional profiler argument.
27
27
This profiler must be an instance of the tflite::Profiler class, and should
28
28
implement the BeginEvent and EndEvent methods. There is a default implementation
29
29
in tensorflow/lite/micro/micro_profiler.cc which can be used for most purposes.
30
30
31
+ The best practice for profiling across multiple invocations is to reset or call
32
+ ` ClearEvents() ` in between invocations.
33
+
31
34
## Per-Op Profiling
32
35
33
36
There is a feature in the MicroInterpreter to enable per-op profiling. To enable
Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ namespace tflite {
26
26
27
27
uint32_t MicroProfiler::BeginEvent (const char * tag) {
28
28
if (num_events_ == kMaxEvents ) {
29
- num_events_ = 0 ;
29
+ MicroPrintf (
30
+ " MicroProfiler errored out because total number of events exceeded the "
31
+ " maximum of %d." ,
32
+ kMaxEvents );
33
+ TFLITE_ASSERT_FALSE;
30
34
}
31
35
32
36
tags_[num_events_] = tag;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class MicroProfiler : public MicroProfilerInterface {
69
69
// Maximum number of events that this class can keep track of. If we call
70
70
// AddEvent more than kMaxEvents number of times, then the oldest event's
71
71
// profiling information will be overwritten.
72
- static constexpr int kMaxEvents = 1024 ;
72
+ static constexpr int kMaxEvents = 4096 ;
73
73
74
74
const char * tags_[kMaxEvents ];
75
75
uint32_t start_ticks_[kMaxEvents ];
You can’t perform that action at this time.
0 commit comments