-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dwightman/dcgm1972' into 'master'
DCGM-1972 - enable dcgm-exporter check for DCP metric compatibilty See merge request nvidia/container-toolkit/gpu-monitoring-tools!41
- Loading branch information
Showing
6 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dcgm | ||
|
||
/* | ||
#include "dcgm_agent.h" | ||
#include "dcgm_structs.h" | ||
*/ | ||
import "C" | ||
import ( | ||
"fmt" | ||
"unsafe" | ||
) | ||
|
||
type MetricGroup struct { | ||
major uint | ||
minor uint | ||
fieldIds []uint | ||
} | ||
|
||
func getSupportedMetricGroups(grpid uint) (groups []MetricGroup, err error) { | ||
|
||
var groupInfo C.dcgmProfGetMetricGroups_t | ||
groupInfo.version = makeVersion2(unsafe.Sizeof(groupInfo)) | ||
groupInfo.groupId = C.ulong(grpid) | ||
|
||
result := C.dcgmProfGetSupportedMetricGroups(handle.handle, &groupInfo) | ||
|
||
if err = errorString(result); err != nil { | ||
return groups, fmt.Errorf("Error getting supported metrics: %s", err) | ||
} | ||
|
||
var count = uint(groupInfo.numMetricGroups) | ||
|
||
for i := uint(0); i < count; i++ { | ||
var group MetricGroup | ||
group.major = uint(groupInfo.metricGroups[i].majorId) | ||
group.minor = uint(groupInfo.metricGroups[i].minorId) | ||
|
||
var fieldCount = uint(groupInfo.metricGroups[i].numFieldIds) | ||
|
||
for j := uint(0); j < fieldCount; j++ { | ||
group.fieldIds = append(group.fieldIds, uint(groupInfo.metricGroups[i].fieldIds[j])) | ||
} | ||
groups = append(groups, group) | ||
} | ||
|
||
return groups, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters