topology.hpp 943 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright Oliver Kowalke 2017.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_FIBERS_NUMA_TOPOLOGY_H
  6. #define BOOST_FIBERS_NUMA_TOPOLOGY_H
  7. #include <cstdint>
  8. #include <set>
  9. #include <vector>
  10. #include <boost/config.hpp>
  11. #include <boost/fiber/detail/config.hpp>
  12. #ifdef BOOST_HAS_ABI_HEADERS
  13. # include BOOST_ABI_PREFIX
  14. #endif
  15. namespace boost {
  16. namespace fibers {
  17. namespace numa {
  18. struct node {
  19. std::uint32_t id;
  20. std::set< std::uint32_t > logical_cpus;
  21. std::vector< std::uint32_t > distance;
  22. };
  23. inline
  24. bool operator<( node const& lhs, node const& rhs) noexcept {
  25. return lhs.id < rhs.id;
  26. }
  27. BOOST_FIBERS_DECL
  28. std::vector< node > topology();
  29. }}}
  30. #ifdef BOOST_HAS_ABI_HEADERS
  31. # include BOOST_ABI_SUFFIX
  32. #endif
  33. #endif // BOOST_FIBERS_NUMA_TOPOLOGY_H