diff --git a/.travis.yml b/.travis.yml index d45dc3c..00df499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ go: - "1.8" - "1.9" - "1.10" + - "1.11" + - "1.12" script: - make presubmit diff --git a/bindings.go b/bindings.go index 8b14932..325c802 100644 --- a/bindings.go +++ b/bindings.go @@ -611,7 +611,7 @@ func (d Device) DecoderUtilization() (uint, uint, error) { // DeviceGetAccountingMode Queries process's accounting stats // @return mode Reference in which to return the current accounting mode -func (d Device) DeviceGetAccountingMode() (C.nvmlEnableState_t, error) { +func (d Device) AccountingMode() (C.nvmlEnableState_t, error) { var stats C.nvmlEnableState_t if C.nvmlHandle == nil { return stats, errLibraryNotLoaded @@ -623,7 +623,7 @@ func (d Device) DeviceGetAccountingMode() (C.nvmlEnableState_t, error) { // DeviceGetAccountingStats Queries process's accounting stats. // @param pid Process Id of the target process to query stats for // @return stats Reference in which to return the process's accounting stats -func (d Device) DeviceGetAccountingStats(pid uint) (C.nvmlAccountingStats_t, error) { +func (d Device) AccountingStats(pid uint) (C.nvmlAccountingStats_t, error) { var stats C.nvmlAccountingStats_t if C.nvmlHandle == nil { return stats, errLibraryNotLoaded @@ -636,7 +636,7 @@ func (d Device) DeviceGetAccountingStats(pid uint) (C.nvmlAccountingStats_t, err // @param count Maxnum pids // @return pids Pids result // @return count Queried pids num -func (d Device) DeviceGetAccountingPids(count uint) ([]C.uint, uint, error) { +func (d Device) AccountingPids(count uint) ([]C.uint, uint, error) { // init pids cCount := C.uint(count) if C.nvmlHandle == nil { @@ -658,7 +658,7 @@ func (d Device) DeviceGetAccountingPids(count uint) ([]C.uint, uint, error) { // DeviceGetAccountingBufferSize Returns the number of processes that the circular buffer with accounting pids can hold. // @return buffersize buffersize -func (d Device) DeviceGetAccountingBufferSize() (uint, error) { +func (d Device) AccountingBufferSize() (uint, error) { if C.nvmlHandle == nil { return 0, errLibraryNotLoaded } @@ -672,7 +672,7 @@ func (d Device) DeviceGetAccountingBufferSize() (uint, error) { // @param since The last query time for process // @return utilizations The utilizations for all process // @return processCount The queried utilizations -func (d Device) DeviceGetProcessUtilization(processCount uint, since time.Duration) ([]*Utilization, uint, error) { +func (d Device) ProcessUtilization(processCount uint, since time.Duration) ([]*Utilization, uint, error) { if C.nvmlHandle == nil { return nil, 0, errLibraryNotLoaded } diff --git a/cmd/example/example.go b/cmd/example/example.go index 34bae96..34283a7 100644 --- a/cmd/example/example.go +++ b/cmd/example/example.go @@ -138,28 +138,28 @@ func main() { } fmt.Printf("\tutilization.decoder: %d\n", decoderUtilization) - modeStats, err := dev.DeviceGetAccountingMode() + modeStats, err := dev.AccountingMode() if err != nil { fmt.Printf("\tdev.DeviceGetAccountingMode() error: %v\n", err) return } fmt.Printf("\taccounting.mode enable: %v\n", modeStats) - bufferSize, err := dev.DeviceGetAccountingBufferSize() + bufferSize, err := dev.AccountingBufferSize() if err != nil { fmt.Printf("\tdev.DeviceGetAccountingBufferSize() error: %v\n", err) return } fmt.Printf("\taccounting.buffersize: %d\n", bufferSize) - pids, count, err := dev.DeviceGetAccountingPids(bufferSize) + pids, count, err := dev.AccountingPids(bufferSize) if err != nil { fmt.Printf("\tdev.DeviceGetAccountingPids() error: %v\n", err) } else { fmt.Printf("\taccounting.pids.count: %v\n", count) for _, pid := range pids[:count] { fmt.Printf("\t\tPid: %v", pid) - stats, err := dev.DeviceGetAccountingStats(uint(pid)) + stats, err := dev.AccountingStats(uint(pid)) if err != nil { fmt.Printf("\tdev.DeviceGetAccountingStats() error: %v\n", err) } else { @@ -168,12 +168,12 @@ func main() { } } - utilizations, count, err := dev.DeviceGetProcessUtilization(bufferSize, 10 * time.Second) + utilizations, count, err := dev.ProcessUtilization(bufferSize, 10*time.Second) if err != nil { fmt.Printf("\tdev.DeviceGetProcessUtilization() error: %v\n", err) } else { fmt.Printf("\tProcess count: %v\n", count) - + utilizations = utilizations[:count] for _, sample := range utilizations { fmt.Printf("\t\tProcess: %v", sample.Pid)