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)
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
*/
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);
+
/** @} */
#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 */
}
#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.