aboutsummaryrefslogtreecommitdiff
path: root/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp')
-rw-r--r--lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
index 8e8dc0f..37bd868 100644
--- a/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
+++ b/lib/layer_by_layer_profiler/include/layer_by_layer_profiler.hpp
@@ -23,6 +23,7 @@
#include "tensorflow/lite/kernels/internal/compatibility.h"
#include <memory>
#include <pmu_ethosu.h>
+#include <vector>
// NOTE: This profiler only works on systems with 1 NPU due to the use of
// ethosu_reserve_driver().
@@ -30,22 +31,32 @@ namespace tflite {
class LayerByLayerProfiler : public MicroProfiler {
public:
enum Backend { PRINTF, EVENT_RECORDER };
- LayerByLayerProfiler(size_t max_events = 200,
- Backend backend = PRINTF,
- int32_t event_id = EventID(EventLevelError, EvtStatistics_No, EventRecordNone));
+ LayerByLayerProfiler(const std::vector<uint8_t> &event_config = {},
+ bool pmu_cycle_counter_enable = true,
+ size_t max_events = 200,
+ Backend backend = PRINTF,
+ int32_t event_id = EventID(EventLevelError, EvtStatistics_No, EventRecordNone));
uint32_t BeginEvent(const char *tag);
void EndEvent(uint32_t event_handle);
uint64_t GetTotalTicks() const;
void Log() const;
+ uint64_t GetPmuCycleCounterCount() const;
+ const std::vector<uint32_t> &GetPmuEventCount() const;
+
private:
- size_t max_events_;
std::unique_ptr<const char *[]> tags_;
std::unique_ptr<uint64_t[]> start_ticks_;
std::unique_ptr<uint64_t[]> end_ticks_;
- Backend backend_;
- int32_t event_id_;
+ std::vector<uint8_t> pmu_event_config;
+ std::vector<uint32_t> pmu_event_count;
+ bool pmu_cycle_counter_enable;
+ uint64_t pmu_cycle_counter_count;
+
+ size_t max_events_;
+ Backend backend;
+ int32_t event_id;
size_t num_events_;
TF_LITE_REMOVE_VIRTUAL_DELETE;