forked from jaypipes/ghw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jaypipes#243 from fromanirh/snapshots-gpu
snapshot: collect data related to GPU devices
- Loading branch information
Showing
3 changed files
with
97 additions
and
38 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,33 @@ | ||
// | ||
// Use and distribution licensed under the Apache license version 2. | ||
// | ||
// See the COPYING file in the root project directory for full text. | ||
// | ||
|
||
package snapshot | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// ExpectedCloneGPUContent returns a slice of strings pertaining to the GPU devices ghw | ||
// cares about. We cannot use a static list because we want to grab only the first cardX data | ||
// (see comment in pkg/gpu/gpu_linux.go) | ||
// Additionally, we want to make sure to clone the backing device data. | ||
func ExpectedCloneGPUContent() []string { | ||
cardEntries := []string{ | ||
"device", | ||
} | ||
|
||
filterName := func(cardName string) bool { | ||
if !strings.HasPrefix(cardName, "card") { | ||
return false | ||
} | ||
if strings.ContainsRune(cardName, '-') { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
return cloneContentByClass("drm", cardEntries, filterName, filterNone) | ||
} |
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