Remove double error printing and return if measurements do not work

This commit is contained in:
Thomas Roehl 2022-02-21 13:23:20 +01:00
parent dc18714d83
commit 583faacd91

View File

@ -384,15 +384,13 @@ func (m *LikwidCollector) takeMeasurement(group int, interval time.Duration) err
ret = C.perfmon_setupCounters(gid) ret = C.perfmon_setupCounters(gid)
if ret != 0 { if ret != 0 {
gctr := C.GoString(C.perfmon_getGroupName(gid)) gctr := C.GoString(C.perfmon_getGroupName(gid))
err := fmt.Errorf("failed to setup performance group %s", gctr) err := fmt.Errorf("failed to setup performance group %d (%s)", gid, gctr)
cclog.ComponentError(m.name, err.Error())
return err return err
} }
ret = C.perfmon_startCounters() ret = C.perfmon_startCounters()
if ret != 0 { if ret != 0 {
gctr := C.GoString(C.perfmon_getGroupName(gid)) gctr := C.GoString(C.perfmon_getGroupName(gid))
err := fmt.Errorf("failed to start performance group %s", gctr) err := fmt.Errorf("failed to start performance group %d (%s)", gid, gctr)
cclog.ComponentError(m.name, err.Error())
return err return err
} }
m.running = true m.running = true
@ -401,8 +399,7 @@ func (m *LikwidCollector) takeMeasurement(group int, interval time.Duration) err
ret = C.perfmon_stopCounters() ret = C.perfmon_stopCounters()
if ret != 0 { if ret != 0 {
gctr := C.GoString(C.perfmon_getGroupName(gid)) gctr := C.GoString(C.perfmon_getGroupName(gid))
err := fmt.Errorf("failed to stop performance group %s", gctr) err := fmt.Errorf("failed to stop performance group %d (%s)", gid, gctr)
cclog.ComponentError(m.name, err.Error())
return err return err
} }
return nil return nil
@ -533,7 +530,7 @@ func (m *LikwidCollector) Read(interval time.Duration, output chan lp.CCMetric)
err := m.takeMeasurement(i, interval) err := m.takeMeasurement(i, interval)
if err != nil { if err != nil {
cclog.ComponentError(m.name, err.Error()) cclog.ComponentError(m.name, err.Error())
continue return
} }
// read measurements and derive event set metrics // read measurements and derive event set metrics
m.calcEventsetMetrics(i, interval, output) m.calcEventsetMetrics(i, interval, output)