diff --git a/gen/nvml/nvml.yml b/gen/nvml/nvml.yml index de1dcf9..e375797 100644 --- a/gen/nvml/nvml.yml +++ b/gen/nvml/nvml.yml @@ -67,6 +67,7 @@ TRANSLATOR: - {action: replace, from: "^Device$", to: "nvmlDevice"} - {action: replace, from: "^Unit$", to: "nvmlUnit"} - {action: replace, from: "^EventSet$", to: "nvmlEventSet"} + - {action: replace, from: "^GpmSample$", to: "nvmlGpmSample"} - {action: replace, from: "^ComputeInstance$", to: "nvmlComputeInstance"} - {action: replace, from: "^GpuInstance$", to: "nvmlGpuInstance"} - {action: replace, from: "^VgpuInstance$", to: "nvmlVgpuInstance"} diff --git a/pkg/nvml/api.go b/pkg/nvml/api.go index e7ca6cc..1398213 100644 --- a/pkg/nvml/api.go +++ b/pkg/nvml/api.go @@ -576,6 +576,12 @@ type EventSet interface { Free() Return } +type GpmSample interface { + Free() Return + Get(Device Device) Return + MigGet(Device Device, GpuInstanceId int) Return +} + type Unit interface { GetUnitInfo() (UnitInfo, Return) GetLedState() (LedState, Return) diff --git a/pkg/nvml/gpm.go b/pkg/nvml/gpm.go index a52e426..a0a74cf 100644 --- a/pkg/nvml/gpm.go +++ b/pkg/nvml/gpm.go @@ -34,16 +34,16 @@ func (l *library) GpmMetricsGet(MetricsGet *GpmMetricsGetType) Return { // nvml.GpmSampleFree() func (l *library) GpmSampleFree(GpmSample GpmSample) Return { - return nvmlGpmSampleFree(GpmSample) + return GpmSample.Free() } -func (GpmSample GpmSample) Free() Return { - return GpmSampleFree(GpmSample) +func (GpmSample nvmlGpmSample) Free() Return { + return nvmlGpmSampleFree(GpmSample) } // nvml.GpmSampleAlloc() func (l *library) GpmSampleAlloc() (GpmSample, Return) { - var GpmSample GpmSample + var GpmSample nvmlGpmSample ret := nvmlGpmSampleAlloc(&GpmSample) return GpmSample, ret } @@ -57,7 +57,7 @@ func (Device nvmlDevice) GpmSampleGet(GpmSample GpmSample) Return { return GpmSample.Get(Device) } -func (GpmSample GpmSample) Get(Device Device) Return { +func (GpmSample nvmlGpmSample) Get(Device Device) Return { return nvmlGpmSampleGet(Device.(nvmlDevice), GpmSample) } @@ -101,6 +101,6 @@ func (Device nvmlDevice) GpmMigSampleGet(GpuInstanceId int, GpmSample GpmSample) return GpmSample.MigGet(Device, GpuInstanceId) } -func (GpmSample GpmSample) MigGet(Device Device, GpuInstanceId int) Return { +func (GpmSample nvmlGpmSample) MigGet(Device Device, GpuInstanceId int) Return { return nvmlGpmMigSampleGet(Device.(nvmlDevice), uint32(GpuInstanceId), GpmSample) } diff --git a/pkg/nvml/nvml.go b/pkg/nvml/nvml.go index a5810aa..2cdcf53 100644 --- a/pkg/nvml/nvml.go +++ b/pkg/nvml/nvml.go @@ -2696,36 +2696,36 @@ func nvmlGpmMetricsGet(MetricsGet *GpmMetricsGetType) Return { } // nvmlGpmSampleFree function as declared in nvml/nvml.h -func nvmlGpmSampleFree(GpmSample GpmSample) Return { - cGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&GpmSample)), cgoAllocsUnknown - __ret := C.nvmlGpmSampleFree(cGpmSample) +func nvmlGpmSampleFree(nvmlGpmSample nvmlGpmSample) Return { + cnvmlGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&nvmlGpmSample)), cgoAllocsUnknown + __ret := C.nvmlGpmSampleFree(cnvmlGpmSample) __v := (Return)(__ret) return __v } // nvmlGpmSampleAlloc function as declared in nvml/nvml.h -func nvmlGpmSampleAlloc(GpmSample *GpmSample) Return { - cGpmSample, _ := (*C.nvmlGpmSample_t)(unsafe.Pointer(GpmSample)), cgoAllocsUnknown - __ret := C.nvmlGpmSampleAlloc(cGpmSample) +func nvmlGpmSampleAlloc(nvmlGpmSample *nvmlGpmSample) Return { + cnvmlGpmSample, _ := (*C.nvmlGpmSample_t)(unsafe.Pointer(nvmlGpmSample)), cgoAllocsUnknown + __ret := C.nvmlGpmSampleAlloc(cnvmlGpmSample) __v := (Return)(__ret) return __v } // nvmlGpmSampleGet function as declared in nvml/nvml.h -func nvmlGpmSampleGet(nvmlDevice nvmlDevice, GpmSample GpmSample) Return { +func nvmlGpmSampleGet(nvmlDevice nvmlDevice, nvmlGpmSample nvmlGpmSample) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown - cGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&GpmSample)), cgoAllocsUnknown - __ret := C.nvmlGpmSampleGet(cnvmlDevice, cGpmSample) + cnvmlGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&nvmlGpmSample)), cgoAllocsUnknown + __ret := C.nvmlGpmSampleGet(cnvmlDevice, cnvmlGpmSample) __v := (Return)(__ret) return __v } // nvmlGpmMigSampleGet function as declared in nvml/nvml.h -func nvmlGpmMigSampleGet(nvmlDevice nvmlDevice, GpuInstanceId uint32, GpmSample GpmSample) Return { +func nvmlGpmMigSampleGet(nvmlDevice nvmlDevice, GpuInstanceId uint32, nvmlGpmSample nvmlGpmSample) Return { cnvmlDevice, _ := *(*C.nvmlDevice_t)(unsafe.Pointer(&nvmlDevice)), cgoAllocsUnknown cGpuInstanceId, _ := (C.uint)(GpuInstanceId), cgoAllocsUnknown - cGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&GpmSample)), cgoAllocsUnknown - __ret := C.nvmlGpmMigSampleGet(cnvmlDevice, cGpuInstanceId, cGpmSample) + cnvmlGpmSample, _ := *(*C.nvmlGpmSample_t)(unsafe.Pointer(&nvmlGpmSample)), cgoAllocsUnknown + __ret := C.nvmlGpmMigSampleGet(cnvmlDevice, cGpuInstanceId, cnvmlGpmSample) __v := (Return)(__ret) return __v } diff --git a/pkg/nvml/types_gen.go b/pkg/nvml/types_gen.go index d492537..167fb79 100644 --- a/pkg/nvml/types_gen.go +++ b/pkg/nvml/types_gen.go @@ -548,7 +548,7 @@ type nvmlComputeInstance struct { Handle *_Ctype_struct_nvmlComputeInstance_st } -type GpmSample struct { +type nvmlGpmSample struct { Handle *_Ctype_struct_nvmlGpmSample_st } @@ -568,8 +568,8 @@ type GpmMetric struct { type GpmMetricsGetType struct { Version uint32 NumMetrics uint32 - Sample1 GpmSample - Sample2 GpmSample + Sample1 nvmlGpmSample + Sample2 nvmlGpmSample Metrics [98]GpmMetric }