From bad3ae4bd09116c251ac09704560c6ea14a9d7b0 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 13 Oct 2022 16:11:47 +0200 Subject: [PATCH] Expanded thread playground scenario with topology session. --- repos/mml/run/thread_test.run | 6 +++++- repos/mml/src/app/thread_test/thread_test.cc | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/repos/mml/run/thread_test.run b/repos/mml/run/thread_test.run index 05aec30223..e1a38d50fa 100644 --- a/repos/mml/run/thread_test.run +++ b/repos/mml/run/thread_test.run @@ -15,10 +15,12 @@ install_config { + + @@ -29,6 +31,7 @@ install_config { + @@ -40,4 +43,5 @@ set boot_modules { core init timer vfs.lib.so ld.lib.so libm.lib.so libc.lib.so stdcxx.lib.so thread_test } build_boot_image $boot_modules -append qemu_args "-nographic -m 64" +append qemu_args "-nographic" +run_genode_until forever diff --git a/repos/mml/src/app/thread_test/thread_test.cc b/repos/mml/src/app/thread_test/thread_test.cc index 44b536721f..18ecad18f7 100644 --- a/repos/mml/src/app/thread_test/thread_test.cc +++ b/repos/mml/src/app/thread_test/thread_test.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -38,6 +39,7 @@ class Thread_test::Test_thread : public Thread auto end = _timer.elapsed_ms(); // auto end = std::chrono::steady_clock::now(); Genode::log("Thread ", _id, " woke up afer", (end-start), " ms."); + Genode::log("My affinities are ", this->affinity().xpos(), "x", this->affinity().ypos(), " node: ", _env.topo().node_affinity_of(this->affinity()).id(), " native region: ", _env.topo().node_affinity_of(this->affinity()).native_id()); } } }; @@ -56,6 +58,7 @@ public: { Affinity::Space space = env.cpu().affinity_space(); + Genode::log("Having ", env.topo().node_count(), " NUMA regions."); Genode::log("Size of Affinity space is ", space.total()); Genode::log("-----------------------------"); for (unsigned i = 1; i < space.total(); i++) @@ -73,6 +76,10 @@ public: _threads.insert(&thread->_list_element); } + + for (auto thread = _threads.first(); !thread; thread->next()) { + thread->object()->join(); + } /* Test, whether unique_ptrs work */ //auto unique_thread = std::unique_ptr(new (_heap) Test_thread(env, 255, env.cpu().affinity_space().location_of_index(0))); //unique_thread->start();