summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/fiber/examples/numa/topology.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/fiber/examples/numa/topology.cpp')
-rw-r--r--src/boost/libs/fiber/examples/numa/topology.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/boost/libs/fiber/examples/numa/topology.cpp b/src/boost/libs/fiber/examples/numa/topology.cpp
new file mode 100644
index 00000000..9b85e3f4
--- /dev/null
+++ b/src/boost/libs/fiber/examples/numa/topology.cpp
@@ -0,0 +1,37 @@
+
+// Copyright Oliver Kowalke 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstdlib>
+#include <cstring>
+#include <exception>
+#include <iostream>
+#include <vector>
+
+#include <boost/assert.hpp>
+#include <boost/fiber/numa/topology.hpp>
+
+int main( int argc, char * argv[]) {
+ try {
+ std::vector< boost::fibers::numa::node > topo = boost::fibers::numa::topology();
+ for ( auto n : topo) {
+ std::cout << "node: " << n.id << " | ";
+ std::cout << "cpus: ";
+ for ( auto cpu_id : n.logical_cpus) {
+ std::cout << cpu_id << " ";
+ }
+ std::cout << "| distance: ";
+ for ( auto d : n.distance) {
+ std::cout << d << " ";
+ }
+ std::cout << std::endl;
+ }
+ std::cout << "done" << std::endl;
+ return EXIT_SUCCESS;
+ } catch ( std::exception const& ex) {
+ std::cerr << "exception: " << ex.what() << std::endl;
+ }
+ return EXIT_FAILURE;
+}