Documentation
¶
Index ¶
- Constants
- type Interface
- type Option
- type Platform
- type PlatformResolver
- type PropertyExtractor
- type PropertyExtractorMock
- func (mock *PropertyExtractorMock) HasDXCore() (bool, string)
- func (mock *PropertyExtractorMock) HasDXCoreCalls() []struct{}
- func (mock *PropertyExtractorMock) HasNvml() (bool, string)
- func (mock *PropertyExtractorMock) HasNvmlCalls() []struct{}
- func (mock *PropertyExtractorMock) HasOnlyIntegratedGPUs() (bool, string)
- func (mock *PropertyExtractorMock) HasOnlyIntegratedGPUsCalls() []struct{}
- func (mock *PropertyExtractorMock) HasTegraFiles() (bool, string)
- func (mock *PropertyExtractorMock) HasTegraFilesCalls() []struct{}
- func (mock *PropertyExtractorMock) IsTegraSystem() (bool, string)
- func (mock *PropertyExtractorMock) IsTegraSystemCalls() []struct{}
- func (mock *PropertyExtractorMock) UsesOnlyNVGPUModule() (bool, string)
- func (mock *PropertyExtractorMock) UsesOnlyNVGPUModuleCalls() []struct{}
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
PlatformResolver
PropertyExtractor
}
Interface provides the API to the info package.
type Option ¶
type Option func(*options)
Option defines a function for passing options to the New() call.
func WithDeviceLib ¶ added in v0.4.0
WithDeviceLib sets the device library for the library.
func WithLogger ¶ added in v0.4.0
func WithLogger(logger basicLogger) Option
WithLogger sets the logger for the library.
func WithNvmlLib ¶ added in v0.4.0
WithNvmlLib sets the nvml library for the library.
func WithPlatform ¶ added in v0.4.0
WithPlatform provides an option to set the platform explicitly.
func WithPropertyExtractor ¶ added in v0.4.0
func WithPropertyExtractor(propertyExtractor PropertyExtractor) Option
WithPropertyExtractor provides an Option to set the PropertyExtractor interface implementation. This is predominantly used for testing.
type PlatformResolver ¶ added in v0.4.0
type PlatformResolver interface {
ResolvePlatform() Platform
}
PlatformResolver defines a function to resolve the current platform.
type PropertyExtractor ¶ added in v0.4.0
type PropertyExtractor interface {
HasDXCore() (bool, string)
HasNvml() (bool, string)
HasTegraFiles() (bool, string)
// Deprecated: Use HasTegraFiles instead.
IsTegraSystem() (bool, string)
// Deprecated: Use HasOnlyIntegratedGPUs
UsesOnlyNVGPUModule() (bool, string)
HasOnlyIntegratedGPUs() (bool, string)
}
PropertyExtractor provides a set of functions to query capabilities of the system.
type PropertyExtractorMock ¶ added in v0.4.0
type PropertyExtractorMock struct {
// HasDXCoreFunc mocks the HasDXCore method.
HasDXCoreFunc func() (bool, string)
// HasNvmlFunc mocks the HasNvml method.
HasNvmlFunc func() (bool, string)
// HasOnlyIntegratedGPUsFunc mocks the HasOnlyIntegratedGPUs method.
HasOnlyIntegratedGPUsFunc func() (bool, string)
// HasTegraFilesFunc mocks the HasTegraFiles method.
HasTegraFilesFunc func() (bool, string)
// IsTegraSystemFunc mocks the IsTegraSystem method.
IsTegraSystemFunc func() (bool, string)
// UsesOnlyNVGPUModuleFunc mocks the UsesOnlyNVGPUModule method.
UsesOnlyNVGPUModuleFunc func() (bool, string)
// contains filtered or unexported fields
}
PropertyExtractorMock is a mock implementation of PropertyExtractor.
func TestSomethingThatUsesPropertyExtractor(t *testing.T) {
// make and configure a mocked PropertyExtractor
mockedPropertyExtractor := &PropertyExtractorMock{
HasDXCoreFunc: func() (bool, string) {
panic("mock out the HasDXCore method")
},
HasNvmlFunc: func() (bool, string) {
panic("mock out the HasNvml method")
},
HasOnlyIntegratedGPUsFunc: func() (bool, string) {
panic("mock out the HasOnlyIntegratedGPUs method")
},
HasTegraFilesFunc: func() (bool, string) {
panic("mock out the HasTegraFiles method")
},
IsTegraSystemFunc: func() (bool, string) {
panic("mock out the IsTegraSystem method")
},
UsesOnlyNVGPUModuleFunc: func() (bool, string) {
panic("mock out the UsesOnlyNVGPUModule method")
},
}
// use mockedPropertyExtractor in code that requires PropertyExtractor
// and then make assertions.
}
func (*PropertyExtractorMock) HasDXCore ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasDXCore() (bool, string)
HasDXCore calls HasDXCoreFunc.
func (*PropertyExtractorMock) HasDXCoreCalls ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasDXCoreCalls() []struct { }
HasDXCoreCalls gets all the calls that were made to HasDXCore. Check the length with:
len(mockedPropertyExtractor.HasDXCoreCalls())
func (*PropertyExtractorMock) HasNvml ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasNvml() (bool, string)
HasNvml calls HasNvmlFunc.
func (*PropertyExtractorMock) HasNvmlCalls ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasNvmlCalls() []struct { }
HasNvmlCalls gets all the calls that were made to HasNvml. Check the length with:
len(mockedPropertyExtractor.HasNvmlCalls())
func (*PropertyExtractorMock) HasOnlyIntegratedGPUs ¶ added in v0.7.2
func (mock *PropertyExtractorMock) HasOnlyIntegratedGPUs() (bool, string)
HasOnlyIntegratedGPUs calls HasOnlyIntegratedGPUsFunc.
func (*PropertyExtractorMock) HasOnlyIntegratedGPUsCalls ¶ added in v0.7.2
func (mock *PropertyExtractorMock) HasOnlyIntegratedGPUsCalls() []struct { }
HasOnlyIntegratedGPUsCalls gets all the calls that were made to HasOnlyIntegratedGPUs. Check the length with:
len(mockedPropertyExtractor.HasOnlyIntegratedGPUsCalls())
func (*PropertyExtractorMock) HasTegraFiles ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasTegraFiles() (bool, string)
HasTegraFiles calls HasTegraFilesFunc.
func (*PropertyExtractorMock) HasTegraFilesCalls ¶ added in v0.4.0
func (mock *PropertyExtractorMock) HasTegraFilesCalls() []struct { }
HasTegraFilesCalls gets all the calls that were made to HasTegraFiles. Check the length with:
len(mockedPropertyExtractor.HasTegraFilesCalls())
func (*PropertyExtractorMock) IsTegraSystem ¶ added in v0.4.0
func (mock *PropertyExtractorMock) IsTegraSystem() (bool, string)
IsTegraSystem calls IsTegraSystemFunc.
func (*PropertyExtractorMock) IsTegraSystemCalls ¶ added in v0.4.0
func (mock *PropertyExtractorMock) IsTegraSystemCalls() []struct { }
IsTegraSystemCalls gets all the calls that were made to IsTegraSystem. Check the length with:
len(mockedPropertyExtractor.IsTegraSystemCalls())
func (*PropertyExtractorMock) UsesOnlyNVGPUModule ¶ added in v0.4.0
func (mock *PropertyExtractorMock) UsesOnlyNVGPUModule() (bool, string)
UsesOnlyNVGPUModule calls UsesOnlyNVGPUModuleFunc.
func (*PropertyExtractorMock) UsesOnlyNVGPUModuleCalls ¶ added in v0.4.0
func (mock *PropertyExtractorMock) UsesOnlyNVGPUModuleCalls() []struct { }
UsesOnlyNVGPUModuleCalls gets all the calls that were made to UsesOnlyNVGPUModule. Check the length with:
len(mockedPropertyExtractor.UsesOnlyNVGPUModuleCalls())