File: cpu_numa_info.cpp

package info (click to toggle)
bowtie 1.2.3+dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 16,888 kB
  • sloc: cpp: 35,784; perl: 5,903; ansic: 1,247; sh: 1,180; python: 487; makefile: 426
file content (9 lines) | stat: -rw-r--r-- 288 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
#include "cpu_numa_info.h"

/// Based on http://stackoverflow.com/questions/16862620/numa-get-current-node-core
void get_cpu_and_node_(int& cpu, int& node) {
	unsigned long a,d,c;
	__asm__ volatile("rdtscp" : "=a" (a), "=d" (d), "=c" (c));
	node = (c & 0xFFF000)>>12;
	cpu = c & 0xFFF;
}