mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-14 05:57:25 +01:00
Update fsnotify in LIKWID Collector
This commit is contained in:
parent
a7e8a1dfb5
commit
34bc23fbbd
@ -30,7 +30,7 @@ import (
|
|||||||
topo "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology"
|
topo "github.com/ClusterCockpit/cc-metric-collector/pkg/ccTopology"
|
||||||
"github.com/NVIDIA/go-nvml/pkg/dl"
|
"github.com/NVIDIA/go-nvml/pkg/dl"
|
||||||
"golang.design/x/thread"
|
"golang.design/x/thread"
|
||||||
fsnotify "gopkg.in/fsnotify.v0"
|
fsnotify "gopkg.in/fsnotify.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -360,7 +360,7 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
return true, fmt.Errorf("Access to performance counters locked by %d", stat.Uid)
|
return true, fmt.Errorf("Access to performance counters locked by %d", stat.Uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = watcher.Watch(m.config.LockfilePath)
|
err = watcher.Add(m.config.LockfilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cclog.ComponentError(m.name, err.Error())
|
cclog.ComponentError(m.name, err.Error())
|
||||||
}
|
}
|
||||||
@ -368,9 +368,9 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
m.lock.Lock()
|
m.lock.Lock()
|
||||||
defer m.lock.Unlock()
|
defer m.lock.Unlock()
|
||||||
select {
|
select {
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
ret = -1
|
ret = -1
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_init(C.int(len(m.cpulist)), &m.cpulist[0])
|
ret = C.perfmon_init(C.int(len(m.cpulist)), &m.cpulist[0])
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -384,9 +384,9 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
gid = -1
|
gid = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
gid = -1
|
gid = -1
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
gid = C.perfmon_addEventSet(evset.estr)
|
gid = C.perfmon_addEventSet(evset.estr)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -401,8 +401,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
ret = -1
|
ret = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_setupCounters(gid)
|
ret = C.perfmon_setupCounters(gid)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -414,8 +414,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
ret = -1
|
ret = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_startCounters()
|
ret = C.perfmon_startCounters()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -427,8 +427,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
ret = -1
|
ret = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_readCounters()
|
ret = C.perfmon_readCounters()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -441,8 +441,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
ret = -1
|
ret = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_readCounters()
|
ret = C.perfmon_readCounters()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -468,8 +468,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
select {
|
select {
|
||||||
case <-sigchan:
|
case <-sigchan:
|
||||||
ret = -1
|
ret = -1
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
ret = C.perfmon_stopCounters()
|
ret = C.perfmon_stopCounters()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -480,8 +480,8 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
|
|||||||
}
|
}
|
||||||
signal.Stop(sigchan)
|
signal.Stop(sigchan)
|
||||||
select {
|
select {
|
||||||
case e := <-watcher.Event:
|
case e := <-watcher.Events:
|
||||||
if !e.IsAttrib() {
|
if e.Op != fsnotify.Chmod {
|
||||||
C.perfmon_finalize()
|
C.perfmon_finalize()
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -589,7 +589,6 @@ func (m *LikwidCollector) calcGlobalMetrics(groups []LikwidEventsetConfig, inter
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (m *LikwidCollector) ReadThread(interval time.Duration, output chan lp.CCMetric) {
|
func (m *LikwidCollector) ReadThread(interval time.Duration, output chan lp.CCMetric) {
|
||||||
var err error = nil
|
var err error = nil
|
||||||
groups := make([]LikwidEventsetConfig, 0)
|
groups := make([]LikwidEventsetConfig, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user