From 84a79c216876f4cafe2041762e33b2d47169af9e Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 10 Aug 2022 16:29:54 +0200 Subject: [PATCH] blinktree: Removed stdc++ I/O functions because they cannot be called from within a worker thread. --- .../blinktree_benchmark/benchmark.cpp | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp index 67dbd888a2..c081cc56f9 100644 --- a/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp +++ b/repos/mml/src/app/blinktree/blinktree_benchmark/benchmark.cpp @@ -1,9 +1,11 @@ #include "benchmark.h" #include #include +#include #include #include #include +#include using namespace application::blinktree_benchmark; @@ -71,10 +73,8 @@ void Benchmark::start() { mx::tasking::runtime::profile(this->profile_file_name()); } -#ifdef PERF_SUPPORT this->_chronometer.start(static_cast(static_cast(this->_workload)), this->_current_iteration + 1, this->_cores.current()); -#endif } const mx::util::core_set &Benchmark::core_set() @@ -113,15 +113,15 @@ void Benchmark::requests_finished() if (open_requests == 0U) // All request schedulers are done. { // Stop and print time (and performance counter). - //const auto result = this->_chronometer.stop(this->_workload.size()); + const auto result = this->_chronometer.stop(this->_workload.size()); mx::tasking::runtime::stop(); - //std::cout << result << std::endl; + Genode::log(result.core_count(), "\t", result.iteration(), "\t", result.phase(), "\t", result.time().count(), " ms\t", result.throughput(), " op/s"); // Dump results to file. - if (this->_result_file_name.empty() == false) + /*if (this->_result_file_name.empty() == false) { std::ofstream result_file_stream(this->_result_file_name, std::ofstream::app); - //result_file_stream << result.to_json().dump() << std::endl; + result_file_stream << result.to_json().dump() << std::endl; } // Dump statistics to file. @@ -131,11 +131,9 @@ void Benchmark::requests_finished() { std::ofstream statistic_file_stream(this->_statistic_file_name, std::ofstream::app); nlohmann::json statistic_json; -#ifdef PERF_SUPPORT statistic_json["iteration"] = result.iteration(); statistic_json["cores"] = result.core_count(); statistic_json["phase"] = result.phase(); -#endif statistic_json["scheduled"] = nlohmann::json(); statistic_json["scheduled-on-channel"] = nlohmann::json(); statistic_json["scheduled-off-channel"] = nlohmann::json(); @@ -147,7 +145,6 @@ void Benchmark::requests_finished() { const auto core_id = std::int32_t{this->_cores.current()[i]}; const auto core_id_string = std::to_string(core_id); -#ifdef PERF_SUPPORT statistic_json["scheduled"][core_id_string] = result.scheduled_tasks(core_id) / double(result.operation_count()); statistic_json["scheduled-on-core"][core_id_string] = @@ -162,12 +159,11 @@ void Benchmark::requests_finished() result.executed_writer_tasks(core_id) / double(result.operation_count()); statistic_json["fill"][core_id_string] = result.worker_fills(core_id) / double(result.operation_count()); -#endif } statistic_file_stream << statistic_json.dump(2) << std::endl; } - } + }*/ // Check and print the tree. if (this->_check_tree) @@ -184,11 +180,11 @@ void Benchmark::requests_finished() this->_workload == benchmark::phase::MIXED || this->_workload.empty(benchmark::phase::MIXED); // Dump the tree. - if (this->_tree_file_name.empty() == false && is_last_phase) + /*if (this->_tree_file_name.empty() == false && is_last_phase) { std::ofstream tree_file_stream(this->_tree_file_name); tree_file_stream << static_cast(*(this->_tree)).dump() << std::endl; - } + }*/ // Delete the tree to free the hole memory. if (is_last_phase)