mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Adapted blinktree application to changes in MxTasking.
This commit is contained in:
@@ -195,7 +195,7 @@ public:
|
||||
return {count_operations,
|
||||
_current_phase,
|
||||
_current_iteration,
|
||||
_core_set.size(),
|
||||
mx::tasking::runtime::workers_count(),
|
||||
milliseconds,
|
||||
_perf.counter(),
|
||||
statistic_map(mx::tasking::profiling::Statistic::Executed),
|
||||
|
||||
@@ -79,15 +79,14 @@ private:
|
||||
class Fill_thread : public Genode::Thread
|
||||
{
|
||||
private:
|
||||
Genode::Mutex &_mutex;
|
||||
//Genode::Mutex &_mutex;
|
||||
const std::string &_fill_workload_file;
|
||||
bool (*parse)(std::ifstream &, std::vector<NumericTuple> &);
|
||||
NumericWorkloadSet &_workload_set;
|
||||
|
||||
public:
|
||||
Fill_thread(Libc::Env &env, Genode::Mutex &mutex, std::string fill_workload_name, bool (*parse)(std::ifstream&, std::vector<NumericTuple>&), NumericWorkloadSet &workload_set)
|
||||
: Genode::Thread(env, Name("btree::fill_thread"), 4*4096),
|
||||
_mutex(mutex), _fill_workload_file(fill_workload_name), _workload_set(workload_set)
|
||||
: Genode::Thread(env, Name("btree::fill_thread"), 4*4096), _fill_workload_file(fill_workload_name), _workload_set(workload_set)
|
||||
{
|
||||
this->parse = parse;
|
||||
}
|
||||
@@ -107,7 +106,6 @@ class Fill_thread : public Genode::Thread
|
||||
class Mixed_thread : public Genode::Thread
|
||||
{
|
||||
private:
|
||||
Genode::Mutex &_mutex;
|
||||
const std::string &_mixed_workload_file;
|
||||
bool (*parse)(std::ifstream &, std::vector<NumericTuple> &);
|
||||
NumericWorkloadSet &_workload_set;
|
||||
@@ -115,7 +113,7 @@ class Mixed_thread : public Genode::Thread
|
||||
public:
|
||||
Mixed_thread(Libc::Env &env, Genode::Mutex &mutex, std::string mixed_workload_name, bool (*parse)(std::ifstream&, std::vector<NumericTuple>&), NumericWorkloadSet &workload_set)
|
||||
: Genode::Thread(env, Name("btree::mixed_thread"), 4*4096),
|
||||
_mutex(mutex), _mixed_workload_file(mixed_workload_name), _workload_set(workload_set)
|
||||
_mixed_workload_file(mixed_workload_name), _workload_set(workload_set)
|
||||
{
|
||||
this->parse = parse;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ void Benchmark::requests_finished()
|
||||
|
||||
if (open_requests == 0U) // All request schedulers are done.
|
||||
{
|
||||
std::uint16_t core_id = mx::system::topology::core_id();
|
||||
std::uint16_t core_id = mx::tasking::runtime::my_channel();
|
||||
if (core_id != 0)
|
||||
{
|
||||
this->_open_requests++;
|
||||
@@ -138,9 +138,6 @@ void Benchmark::requests_finished()
|
||||
|
||||
//_end = Genode::Trace::timestamp();
|
||||
|
||||
//std::cout << result << std::endl;
|
||||
//if (mx::system::topology::core_id() == 0)
|
||||
//std::cout << result << "\t " << (_end - _start) << " cycles" << std::endl;
|
||||
std::cout << "core: " << mx::system::topology::core_id() << result.to_json().dump() << std::endl;
|
||||
|
||||
|
||||
@@ -219,6 +216,12 @@ void Benchmark::requests_finished()
|
||||
{
|
||||
this->_tree.reset(nullptr);
|
||||
}
|
||||
|
||||
auto *restart_task = mx::tasking::runtime::new_task<RestartTask>(0U, *this);
|
||||
restart_task->annotate(static_cast<mx::tasking::TaskInterface::channel>(0));
|
||||
mx::tasking::runtime::spawn(*restart_task, core_id);
|
||||
mx::tasking::runtime::resume();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,9 +53,6 @@ public:
|
||||
void start();
|
||||
|
||||
private:
|
||||
std::uint64_t _start;
|
||||
std::uint64_t _end;
|
||||
|
||||
// Collection of cores the benchmark should run on.
|
||||
benchmark::Cores _cores;
|
||||
|
||||
@@ -124,7 +121,7 @@ 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");
|
||||
Genode::log("Starting timer");
|
||||
_benchmark._chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(_benchmark._workload)), _benchmark._current_iteration + 1, _benchmark._cores.current());
|
||||
//_benchmark._start = Genode::Trace::timestamp();
|
||||
return mx::tasking::TaskResult::make_remove();
|
||||
@@ -146,4 +143,25 @@ class StopMeasurementTask : public mx::tasking::TaskInterface
|
||||
return mx::tasking::TaskResult::make_remove();
|
||||
}
|
||||
};
|
||||
|
||||
class RestartTask : public mx::tasking::TaskInterface
|
||||
{
|
||||
private:
|
||||
Benchmark &_benchmark;
|
||||
|
||||
public:
|
||||
constexpr RestartTask(Benchmark &benchmark) : _benchmark(benchmark) {}
|
||||
~RestartTask() override = default;
|
||||
|
||||
mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t channel_id) override
|
||||
{
|
||||
if (_benchmark.core_set()) {
|
||||
_benchmark.start();
|
||||
} else {
|
||||
Genode::log("Benchmark finished.");
|
||||
mx::tasking::runtime::stop();
|
||||
}
|
||||
return mx::tasking::TaskResult::make_remove();
|
||||
}
|
||||
};
|
||||
} // namespace application::blinktree_benchmark
|
||||
@@ -199,17 +199,21 @@ void Libc::Component::construct(Libc::Env &env) {
|
||||
|
||||
mx::system::Environment::set_env(&env);
|
||||
|
||||
auto sys_cores = mx::util::core_set::build(64);
|
||||
mx::system::Environment::set_cores(&sys_cores);
|
||||
|
||||
mx::memory::GlobalHeap::myself();
|
||||
std::uint16_t cores = env.cpu().affinity_space().total();
|
||||
std::uint16_t cores = 64;
|
||||
//env.cpu().affinity_space().total();
|
||||
|
||||
char cores_arg[10];
|
||||
sprintf(cores_arg, "%d", cores);
|
||||
|
||||
char *args[] = {"blinktree_benchmark", "-i", "6", "-pd", "3", "-p", cores_arg};
|
||||
char *args[] = {"blinktree_benchmark", "-i", "20", "--olfit", cores_arg};
|
||||
|
||||
Libc::with_libc([&]()
|
||||
{
|
||||
std::cout << "Starting B-link tree benchmark" << std::endl;
|
||||
bt_main(env, 7, args);
|
||||
bt_main(env, 5, args);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
{
|
||||
//std::cout << "Hello World" << std::endl;
|
||||
|
||||
Genode::log("Hello world");
|
||||
Genode::log("Hello world from channel ", channel_id);
|
||||
// Stop MxTasking runtime after this task.
|
||||
return mx::tasking::TaskResult::make_stop();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
//mx::system::Environment::env = &env;
|
||||
Genode::log("Initialized system environment for MxTasking");
|
||||
Genode::log("Running on core ", mx::system::topology::core_id());
|
||||
const auto cores = mx::util::core_set::build(1);
|
||||
const auto cores = mx::util::core_set::build(64);
|
||||
|
||||
std::vector<mx::tasking::TaskInterface *> tasks;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user