Added powerdraw
This commit is contained in:
parent
9c3d7cfd77
commit
b7d5827374
@ -18,7 +18,7 @@ import (
|
||||
func metrics(response http.ResponseWriter, request *http.Request) {
|
||||
out, err := exec.Command(
|
||||
"nvidia-smi",
|
||||
"--query-gpu=name,index,temperature.gpu,utilization.gpu,utilization.memory,memory.total,memory.free,memory.used,ecc.errors.uncorrected.aggregate.total,ecc.errors.uncorrected.volatile.total",
|
||||
"--query-gpu=name,index,temperature.gpu,utilization.gpu,utilization.memory,memory.total,memory.free,memory.used,ecc.errors.uncorrected.aggregate.total,ecc.errors.uncorrected.volatile.total,power.draw",
|
||||
"--format=csv,noheader,nounits").Output()
|
||||
|
||||
if err != nil {
|
||||
@ -37,16 +37,17 @@ func metrics(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
metricList := []string{
|
||||
"temperature.gpu", "utilization.gpu",
|
||||
"utilization.memory", "memory.total", "memory.free", "memory.used", "eccerrorsaggregate.total", "eccuncorrectedvolatile.total"}
|
||||
"utilization.memory", "memory.total", "memory.free", "memory.used", "eccerrorsaggregate.total", "eccuncorrectedvolatile.total", "power.draw"}
|
||||
|
||||
result := ""
|
||||
max_id := ""
|
||||
for _, row := range records {
|
||||
name := fmt.Sprintf("%s[%s]", row[0], row[1])
|
||||
for idx, value := range row[2:] {
|
||||
metric := strings.Replace(metricList[idx], ".", "_", -1)
|
||||
result = fmt.Sprintf(
|
||||
"%s%s{gpu=\"%s\"} %s\n", result,
|
||||
metricList[idx], name, value)
|
||||
metric, name, value)
|
||||
max_id = row[1]
|
||||
}
|
||||
deviceCount := 0
|
||||
@ -57,7 +58,7 @@ func metrics(response http.ResponseWriter, request *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
fmt.Fprintf(response, strings.Replace(result, ".", "_", -1))
|
||||
fmt.Fprintf(response, result)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
Loading…
Reference in New Issue
Block a user