mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Merge latest fixed from develop
to main
(#85)
* InfiniBandCollector: Scale raw readings from octets to bytes * Fix clock frequency coming from LikwidCollector and update docs
This commit is contained in:
parent
3438972237
commit
5b6a2b9018
@ -19,8 +19,9 @@ import (
|
|||||||
const IB_BASEPATH = "/sys/class/infiniband/"
|
const IB_BASEPATH = "/sys/class/infiniband/"
|
||||||
|
|
||||||
type InfinibandCollectorMetric struct {
|
type InfinibandCollectorMetric struct {
|
||||||
path string
|
path string
|
||||||
unit string
|
unit string
|
||||||
|
scale int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type InfinibandCollectorInfo struct {
|
type InfinibandCollectorInfo struct {
|
||||||
@ -113,10 +114,10 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error {
|
|||||||
// Check access to counter files
|
// Check access to counter files
|
||||||
countersDir := filepath.Join(path, "counters")
|
countersDir := filepath.Join(path, "counters")
|
||||||
portCounterFiles := map[string]InfinibandCollectorMetric{
|
portCounterFiles := map[string]InfinibandCollectorMetric{
|
||||||
"ib_recv": {path: filepath.Join(countersDir, "port_rcv_data"), unit: "bytes"},
|
"ib_recv": {path: filepath.Join(countersDir, "port_rcv_data"), unit: "bytes", scale: 4},
|
||||||
"ib_xmit": {path: filepath.Join(countersDir, "port_xmit_data"), unit: "bytes"},
|
"ib_xmit": {path: filepath.Join(countersDir, "port_xmit_data"), unit: "bytes", scale: 4},
|
||||||
"ib_recv_pkts": {path: filepath.Join(countersDir, "port_rcv_packets"), unit: "packets"},
|
"ib_recv_pkts": {path: filepath.Join(countersDir, "port_rcv_packets"), unit: "packets", scale: 1},
|
||||||
"ib_xmit_pkts": {path: filepath.Join(countersDir, "port_xmit_packets"), unit: "packets"},
|
"ib_xmit_pkts": {path: filepath.Join(countersDir, "port_xmit_packets"), unit: "packets", scale: 1},
|
||||||
}
|
}
|
||||||
for _, counter := range portCounterFiles {
|
for _, counter := range portCounterFiles {
|
||||||
err := unix.Access(counter.path, unix.R_OK)
|
err := unix.Access(counter.path, unix.R_OK)
|
||||||
@ -191,6 +192,8 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr
|
|||||||
fmt.Sprintf("Read(): Failed to convert Infininiband metrice %s='%s' to int64: %v", counterName, data, err))
|
fmt.Sprintf("Read(): Failed to convert Infininiband metrice %s='%s' to int64: %v", counterName, data, err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Scale raw value
|
||||||
|
v *= counterDef.scale
|
||||||
|
|
||||||
// Send absolut values
|
// Send absolut values
|
||||||
if m.config.SendAbsoluteValues {
|
if m.config.SendAbsoluteValues {
|
||||||
|
@ -159,7 +159,8 @@ func getBaseFreq() float64 {
|
|||||||
data := strings.Replace(string(buffer), "\n", "", -1)
|
data := strings.Replace(string(buffer), "\n", "", -1)
|
||||||
x, err := strconv.ParseInt(data, 0, 64)
|
x, err := strconv.ParseInt(data, 0, 64)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
freq = float64(x) * 1e6
|
freq = float64(x)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,11 +169,11 @@ func getBaseFreq() float64 {
|
|||||||
C.power_init(0)
|
C.power_init(0)
|
||||||
info := C.get_powerInfo()
|
info := C.get_powerInfo()
|
||||||
if float64(info.baseFrequency) != 0 {
|
if float64(info.baseFrequency) != 0 {
|
||||||
freq = float64(info.baseFrequency) * 1e6
|
freq = float64(info.baseFrequency)
|
||||||
}
|
}
|
||||||
C.power_finalize()
|
C.power_finalize()
|
||||||
}
|
}
|
||||||
return freq
|
return freq * 1e3
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *LikwidCollector) Init(config json.RawMessage) error {
|
func (m *LikwidCollector) Init(config json.RawMessage) error {
|
||||||
|
@ -7,6 +7,9 @@ The `likwid` collector is probably the most complicated collector. The LIKWID li
|
|||||||
"likwid": {
|
"likwid": {
|
||||||
"force_overwrite" : false,
|
"force_overwrite" : false,
|
||||||
"invalid_to_zero" : false,
|
"invalid_to_zero" : false,
|
||||||
|
"liblikwid_path" : "/path/to/liblikwid.so",
|
||||||
|
"accessdaemon_path" : "/folder/that/contains/likwid-accessD",
|
||||||
|
"access_mode" : "direct or accessdaemon or perf_event",
|
||||||
"eventsets": [
|
"eventsets": [
|
||||||
{
|
{
|
||||||
"events" : {
|
"events" : {
|
||||||
|
Loading…
Reference in New Issue
Block a user