File: cpu_numa_info.cpp

package info (click to toggle)
bowtie 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,816 kB
  • sloc: cpp: 37,094; perl: 5,806; ansic: 1,474; sh: 1,197; python: 462; makefile: 419
file content (9 lines) | stat: -rw-r--r-- 288 bytes parent folder | download | duplicates (10)
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;
}