aboutsummaryrefslogtreecommitdiff
path: root/tests/framework/instruments/SchedulerTimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/framework/instruments/SchedulerTimer.cpp')
-rw-r--r--tests/framework/instruments/SchedulerTimer.cpp52
1 files changed, 47 insertions, 5 deletions
diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp
index c31cd42d19..35f960d368 100644
--- a/tests/framework/instruments/SchedulerTimer.cpp
+++ b/tests/framework/instruments/SchedulerTimer.cpp
@@ -26,6 +26,7 @@
#include "Instruments.h"
#include "WallClockTimer.h"
#include "arm_compute/core/CPP/ICPPKernel.h"
+#include "arm_compute/graph/DataLayerVisitor.h"
#include "arm_compute/graph/INode.h"
#include "support/Cast.h"
@@ -53,8 +54,10 @@ class Interceptor final : public IScheduler
{
public:
/** Default constructor. */
- Interceptor(std::list<struct SchedulerClock<output_timestamps>::kernel_info> &kernels, IScheduler &real_scheduler, ScaleFactor scale_factor)
- : _kernels(kernels), _real_scheduler(real_scheduler), _timer(scale_factor), _prefix()
+ Interceptor(std::list<struct SchedulerClock<output_timestamps>::kernel_info> &kernels,
+ std::map<std::string, SchedulerTimer::LayerData> &layers, IScheduler &real_scheduler,
+ ScaleFactor scale_factor)
+ : _kernels(kernels), _layer_data_map(layers), _real_scheduler(real_scheduler), _timer(scale_factor), _prefix()
{
}
@@ -126,6 +129,7 @@ protected:
private:
std::list<struct SchedulerClock<output_timestamps>::kernel_info> &_kernels;
+ std::map<std::string, SchedulerTimer::LayerData> &_layer_data_map;
IScheduler &_real_scheduler;
WallClock<output_timestamps> _timer;
std::string _prefix;
@@ -133,7 +137,8 @@ private:
template <bool output_timestamps>
SchedulerClock<output_timestamps>::SchedulerClock(ScaleFactor scale_factor)
- : _kernels(), _real_scheduler(nullptr), _real_scheduler_type(), _real_graph_function(nullptr), _scale_factor(scale_factor), _interceptor(nullptr), _scheduler_users()
+ : _kernels(), _layer_data_map(), _real_scheduler(nullptr), _real_scheduler_type(), _real_graph_function(nullptr),
+ _scale_factor(scale_factor), _interceptor(nullptr), _scheduler_users()
{
if(instruments_info != nullptr)
{
@@ -156,6 +161,13 @@ void SchedulerClock<output_timestamps>::test_start()
if(task.node != nullptr && !task.node->name().empty())
{
scheduler->set_prefix(task.node->name() + "/");
+
+ if(_layer_data_map.find(task.node->name()) == _layer_data_map.end())
+ {
+ arm_compute::graph::DataLayerVisitor dlv = {};
+ task.node->accept(dlv);
+ _layer_data_map[task.node->name()] = dlv.layer_data();
+ }
}
else
{
@@ -177,7 +189,7 @@ void SchedulerClock<output_timestamps>::test_start()
if(_real_scheduler_type != Scheduler::Type::CUSTOM)
{
_real_scheduler = &Scheduler::get();
- _interceptor = std::make_shared<Interceptor<output_timestamps>>(_kernels, *_real_scheduler, _scale_factor);
+ _interceptor = std::make_shared<Interceptor<output_timestamps>>(_kernels, _layer_data_map, *_real_scheduler, _scale_factor);
Scheduler::set(std::static_pointer_cast<IScheduler>(_interceptor));
graph::TaskExecutor::get().execute_function = task_interceptor;
@@ -188,7 +200,7 @@ void SchedulerClock<output_timestamps>::test_start()
{
if(user != nullptr && user->scheduler() != nullptr)
{
- user->intercept_scheduler(std::make_unique<Interceptor<output_timestamps>>(_kernels, *user->scheduler(), _scale_factor));
+ user->intercept_scheduler(std::make_unique<Interceptor<output_timestamps>>(_kernels, _layer_data_map, *user->scheduler(), _scale_factor));
}
});
}
@@ -257,6 +269,36 @@ Instrument::MeasurementsMap SchedulerClock<output_timestamps>::measurements() co
return measurements;
}
+template <bool output_timestamps>
+std::string SchedulerClock<output_timestamps>::instrument_header() const
+{
+ std::string output{""};
+ output += R"("layer_data" : {)";
+ for(auto i_it = _layer_data_map.cbegin(), i_end = _layer_data_map.cend(); i_it != i_end; ++i_it)
+ {
+ output += "\"" + i_it->first + "\" : {";
+ if(i_it->second.size() != 0)
+ {
+ // Print for each entry in layer
+ for(auto entry_it = i_it->second.cbegin(), entry_end = i_it->second.cend(); entry_it != entry_end; ++entry_it)
+ {
+ output += "\"" + entry_it->first + "\" : \"" + entry_it->second + "\"";
+ if(std::next(entry_it) != entry_end)
+ {
+ output += ",";
+ }
+ }
+ }
+ output += "}";
+ if(std::next(i_it) != i_end)
+ {
+ output += ",";
+ }
+ }
+ output += "}";
+ return output;
+}
+
} // namespace framework
} // namespace test
} // namespace arm_compute