/
system_power_statistics_mode.go
38 lines (32 loc) · 1.15 KB
/
system_power_statistics_mode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package dcmi
import (
"fmt"
)
// SystemPowerStatisticsMode represents whether enhanced system power statistics
// are in use.
type SystemPowerStatisticsMode uint8
const (
// SystemPowerStatisticsModeNormal means no rolling average time period can
// be specified in the Get Power Reading command. This is the only option
// supported by v1.0.
SystemPowerStatisticsModeNormal SystemPowerStatisticsMode = 0x01
// SystemPowerStatisticsModeEnhanced means one of the rolling average time
// periods returned in the Get DCMI Capabilities Info response can be sent
// to the BMC, and the corresponding readings will be returned. This is less
// useful when constantly polling BMCs for the current reading.
SystemPowerStatisticsModeEnhanced SystemPowerStatisticsMode = 0x02
)
// Description returns a human-friendly name for the mode.
func (s SystemPowerStatisticsMode) Description() string {
switch s {
case SystemPowerStatisticsModeNormal:
return "Normal"
case SystemPowerStatisticsModeEnhanced:
return "Enhanced"
default:
return "Unknown"
}
}
func (s SystemPowerStatisticsMode) String() string {
return fmt.Sprintf("%v(%v)", uint8(s), s.Description())
}