-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcpuset.go
38 lines (32 loc) · 862 Bytes
/
cpuset.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// +build !windows
package hwloc
//#cgo LDFLAGS: -lhwloc
//#cgo LDFLAGS: -static -static-libgcc
// #include <stdint.h>
// #include <hwloc.h>
import "C"
// HwlocCPUSet A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.
/*
* It may be consulted and modified with the bitmap API as any
* ::hwloc_bitmap_t (see hwloc/bitmap.h).
*
* Each bit may be converted into a PU object using
* hwloc_get_pu_obj_by_os_index().
*/
type HwlocCPUSet struct {
BitMap
}
// NewCPUSet create a HwlocCPUSet instance based on hwloc_cpuset_t
func NewCPUSet(cpuset C.hwloc_cpuset_t) *HwlocCPUSet {
var bm = NewBitmap(cpuset)
return &HwlocCPUSet{
BitMap: bm,
}
}
func (set HwlocCPUSet) hwloc_cpuset_t() C.hwloc_cpuset_t {
return set.BitMap.bm
}
// Destroy free the HwlocCPUSet object
func (set HwlocCPUSet) Destroy() {
set.BitMap.Destroy()
}