diff --git a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp index d0c124e05e..80c4ef7c7e 100644 --- a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp +++ b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp @@ -22,16 +22,14 @@ Benchmark::Benchmark(Libc::Env &env, benchmark::Cores &&cores, const std::uint16 _result_file_name(std::move(result_file_name)), _statistic_file_name(std::move(statistic_file_name)), _tree_file_name(std::move(tree_file_name)), _profile(profile), _workload(env) { -#ifdef PERF_SUPPORT if (use_performance_counter) { this->_chronometer.add(benchmark::Perf::CYCLES); this->_chronometer.add(benchmark::Perf::INSTRUCTIONS); - this->_chronometer.add(benchmark::Perf::STALLS_MEM_ANY); + //this->_chronometer.add(benchmark::Perf::STALLS_MEM_ANY); this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_NTA); this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_WRITE); } -#endif std::cout << "core configuration: \n" << this->_cores.dump(2) << std::endl; this->_workload.build(fill_workload_file, mixed_workload_file); @@ -117,7 +115,18 @@ void Benchmark::requests_finished() if (open_requests == 0U) // All request schedulers are done. { + std::uint16_t core_id = mx::system::topology::core_id(); + if (core_id != 0) + { + this->_open_requests++; + auto *stop_task = mx::tasking::runtime::new_task(0U, *this); + stop_task->annotate(static_cast(0)); + mx::tasking::runtime::spawn(*stop_task, core_id); + return; + } + // Stop and print time (and performance counter). + //Genode::log("Stopping timer"); const auto result = this->_chronometer.stop(this->_workload.size()); mx::tasking::runtime::stop(); @@ -126,7 +135,7 @@ void Benchmark::requests_finished() //std::cout << result << std::endl; //if (mx::system::topology::core_id() == 0) //std::cout << result << "\t " << (_end - _start) << " cycles" << std::endl; - std::cout << result.to_json().dump() << std::endl; + std::cout << "core: " << mx::system::topology::core_id() << result.to_json().dump() << std::endl; // std::cout << result << std::endl; diff --git a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.h b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.h index 44f1cf9454..67cf8157da 100644 --- a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.h +++ b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.h @@ -110,6 +110,7 @@ private: [[nodiscard]] std::string profile_file_name() const; friend class StartMeasurementTask; + friend class StopMeasurementTask; }; class StartMeasurementTask : public mx::tasking::TaskInterface @@ -123,9 +124,26 @@ class StartMeasurementTask : public mx::tasking::TaskInterface mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t channel_id) override { + //Genode::log("Starting timer"); _benchmark._chronometer.start(static_cast(static_cast(_benchmark._workload)), _benchmark._current_iteration + 1, _benchmark._cores.current()); //_benchmark._start = Genode::Trace::timestamp(); return mx::tasking::TaskResult::make_remove(); } }; + +class StopMeasurementTask : public mx::tasking::TaskInterface +{ + private: + Benchmark &_benchmark; + + public: + constexpr StopMeasurementTask(Benchmark& benchmark) : _benchmark(benchmark) {} + ~StopMeasurementTask() override = default; + + mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t channel_id) override + { + _benchmark.requests_finished(); + return mx::tasking::TaskResult::make_remove(); + } +}; } // namespace application::blinktree_benchmark \ No newline at end of file