]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
linux: export hwloc_linux_get_tid_last_cpu_location()
authorBrice Goglin <Brice.Goglin@inria.fr>
Wed, 18 Dec 2013 19:12:17 +0000 (20:12 +0100)
committerBrice Goglin <Brice.Goglin@inria.fr>
Wed, 18 Dec 2013 19:12:17 +0000 (20:12 +0100)
This is equivalent to hwloc_get_proc_last_cpu_location(THREAD) on Linux,
but it's better for clarity to have this Linux specific call as well
(and it was already implemented internally)

NEWS
include/hwloc/linux.h
include/hwloc/rename.h
src/topology-linux.c

diff --git a/NEWS b/NEWS
index 9ff170f80686b890db51417e340e8b86d6929849..5efc6d1cfcd5dfa95f4e1a9ae58540d595264e85 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,13 @@ bug fixes (and other actions) for each version of hwloc since version
 in v0.9.1).
 
 
+Version 1.9.0
+-------------
+* API
+  + Add hwloc_linux_get_tid_last_cpu_location() for retrieving the
+    last CPU where a Linux thread given by TID ran.
+
+
 Version 1.8.0
 -------------
 * New components
index 1df904651b698dc26ac551dffd882c0197139574..10769f072daf59ab1acaee563bea85a11d2aea39 100644 (file)
@@ -59,6 +59,13 @@ HWLOC_DECLSPEC int hwloc_linux_set_tid_cpubind(hwloc_topology_t topology, pid_t
  */
 HWLOC_DECLSPEC int hwloc_linux_get_tid_cpubind(hwloc_topology_t topology, pid_t tid, hwloc_cpuset_t set);
 
+/** \brief Get the last physical CPU where thread \p tid ran.
+ *
+ * \note This is equivalent to calling hwloc_get_proc_last_cpu_location() with
+ * HWLOC_CPUBIND_THREAD as flags.
+ */
+HWLOC_DECLSPEC int hwloc_linux_get_tid_last_cpu_location(hwloc_topology_t topology, pid_t tid, hwloc_bitmap_t set);
+
 /** @} */
 
 
index 382cee93af68e64db9538aa0e7031c7eee127ff6..6266264c1be02e01e6fed2cb18e2b528aaa4a559 100644 (file)
@@ -400,6 +400,7 @@ extern "C" {
 #define hwloc_linux_parse_cpumap_file HWLOC_NAME(linux_parse_cpumap_file)
 #define hwloc_linux_set_tid_cpubind HWLOC_NAME(linux_set_tid_cpubind)
 #define hwloc_linux_get_tid_cpubind HWLOC_NAME(linux_get_tid_cpubind)
+#define hwloc_linux_get_tid_last_cpu_location HWLOC_NAME(linux_get_tid_last_cpu_location)
 
 /* openfabrics-verbs.h */
 
index c88b1cd60c14e81231475550d5750e9ee20d1265..2841f23a2b0e5716a6337766e2876cc7c89694da 100644 (file)
@@ -974,7 +974,7 @@ hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_b
 }
 #endif /* HAVE_DECL_PTHREAD_GETAFFINITY_NP */
 
-static int
+int
 hwloc_linux_get_tid_last_cpu_location(hwloc_topology_t topology __hwloc_attribute_unused, pid_t tid, hwloc_bitmap_t set)
 {
   /* read /proc/pid/stat.