diff --git a/repos/ealanos/src/app/hello_world/main.cpp b/repos/ealanos/src/app/hello_world/main.cpp index 315e3ec62d..8b8cf6bda3 100644 --- a/repos/ealanos/src/app/hello_world/main.cpp +++ b/repos/ealanos/src/app/hello_world/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -11,39 +12,44 @@ public: constexpr HelloWorldTask() = default; ~HelloWorldTask() override = default; - mx::tasking::TaskResult execute(const std::uint16_t core_id) override + mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t) override { - std::cout << "Hello World" << std::endl; - + //std::cout << "Hello World from worker " << core_id << std::endl; + Genode::log("Hello world from worker ", core_id, " on CPU ", mx::system::topology::core_id()); // Stop MxTasking runtime after this task. - return mx::tasking::TaskResult::make_stop(core_id); + return mx::tasking::TaskResult::make_null(); } }; int mx_main(Libc::Env &env) { unsigned num_cores = env.cpu().affinity_space().total(); - // Define which cores will be used (1 core here). + // Define which cores will be used (1 core here). + + std::cout << "Creating coreset with " << num_cores << " cores" << std::endl; const auto cores = mx::util::core_set::build(num_cores, mx::util::core_set::NUMAAware); + std::cout << "Created coreset" << std::endl; { // Scope for the MxTasking runtime. std::size_t qouta = env.pd().avail_ram().value; std::cout << "Remaining memory quota " << qouta << std::endl; // Create a runtime for the given cores. - mx::tasking::runtime_guard _{env, true,cores}; + mx::tasking::runtime_guard _{env, false,cores}; std::cout << "MxTasking initialized." << std::endl; // Create an instance of the HelloWorldTask with the current core as first // parameter. The core is required for memory allocation. - auto *hello_world_task = mx::tasking::runtime::new_task(cores.front()); + for (const auto core : cores) { + auto *hello_world_task = mx::tasking::runtime::new_task(core); - std::cout << "task object is at " << static_cast(hello_world_task) << std::endl; - // Annotate the task to run on the first core. - hello_world_task->annotate(cores.front()); + std::cout << "task object is at " << static_cast(hello_world_task) << std::endl; + // Annotate the task to run on the first core. + hello_world_task->annotate(core); - // Schedule the task. - mx::tasking::runtime::spawn(*hello_world_task); + // Schedule the task. + mx::tasking::runtime::spawn(*hello_world_task); + } std::cout << "Remaining memory quota " << env.pd().avail_ram().value << std::endl; std::cout << "Consumed RAM qouta " << (qouta - env.pd().avail_ram().value) << std::endl; }