Compare commits

..
3 changed files with 5 additions and 45 deletions
+1 -37
View File
@@ -46,7 +46,6 @@ const (
LIKWID_LIB_DL_FLAGS = dl.RTLD_LAZY | dl.RTLD_GLOBAL LIKWID_LIB_DL_FLAGS = dl.RTLD_LAZY | dl.RTLD_GLOBAL
LIKWID_DEF_ACCESSMODE = "direct" LIKWID_DEF_ACCESSMODE = "direct"
LIKWID_DEF_LOCKFILE = "/var/run/likwid.lock" LIKWID_DEF_LOCKFILE = "/var/run/likwid.lock"
LIKWID_DEF_WARMUP_DEL = "0s"
) )
type LikwidCollectorMetricConfig struct { type LikwidCollectorMetricConfig struct {
@@ -84,7 +83,6 @@ type LikwidCollectorConfig struct {
DaemonPath string `json:"accessdaemon_path,omitempty"` DaemonPath string `json:"accessdaemon_path,omitempty"`
LibraryPath string `json:"liblikwid_path,omitempty"` LibraryPath string `json:"liblikwid_path,omitempty"`
LockfilePath string `json:"lockfile_path,omitempty"` LockfilePath string `json:"lockfile_path,omitempty"`
WarmupDelay string `json:"warmup_delay"`
} }
type LikwidCollector struct { type LikwidCollector struct {
@@ -106,7 +104,6 @@ type LikwidCollector struct {
likwidGroups map[C.int]LikwidEventsetConfig likwidGroups map[C.int]LikwidEventsetConfig
lock sync.Mutex lock sync.Mutex
measureThread thread.Thread measureThread thread.Thread
warmupDelay time.Duration
} }
type LikwidMetric struct { type LikwidMetric struct {
@@ -209,7 +206,6 @@ func (m *LikwidCollector) Init(config json.RawMessage) error {
m.config.AccessMode = LIKWID_DEF_ACCESSMODE m.config.AccessMode = LIKWID_DEF_ACCESSMODE
m.config.LibraryPath = LIKWID_LIB_NAME m.config.LibraryPath = LIKWID_LIB_NAME
m.config.LockfilePath = LIKWID_DEF_LOCKFILE m.config.LockfilePath = LIKWID_DEF_LOCKFILE
m.config.WarmupDelay = LIKWID_DEF_WARMUP_DEL
if len(config) > 0 { if len(config) > 0 {
d := json.NewDecoder(bytes.NewReader(config)) d := json.NewDecoder(bytes.NewReader(config))
d.DisallowUnknownFields() d.DisallowUnknownFields()
@@ -246,17 +242,6 @@ func (m *LikwidCollector) Init(config json.RawMessage) error {
m.cpu2tid[c] = i m.cpu2tid[c] = i
} }
if len(m.config.WarmupDelay) > 0 {
t, err := time.ParseDuration(m.config.WarmupDelay)
if err != nil {
return fmt.Errorf("%s Init(): Cannot parse WarmupDelay: %w", m.name, err)
}
if t < 0 {
return fmt.Errorf("%s Init(): WarmupDelay must not be negative", m.name)
}
m.warmupDelay = t
}
m.likwidGroups = make(map[C.int]LikwidEventsetConfig) m.likwidGroups = make(map[C.int]LikwidEventsetConfig)
// This is for the global metrics computation test // This is for the global metrics computation test
@@ -510,27 +495,6 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
if ret != 0 { if ret != 0 {
return true, fmt.Errorf("failed to start events '%s', error %d", evset.go_estr, ret) return true, fmt.Errorf("failed to start events '%s', error %d", evset.go_estr, ret)
} }
// warmup measuring
if m.warmupDelay > 0 {
select {
case <-sigchan:
ret = -1
case e := <-watcher.Events:
if e.Op != fsnotify.Chmod {
ret = C.perfmon_readCounters()
}
default:
ret = C.perfmon_readCounters()
}
if ret != 0 {
return true, fmt.Errorf("failed to read events '%s', error %d", evset.go_estr, ret)
}
time.Sleep(m.warmupDelay)
}
// begin measuring
select { select {
case <-sigchan: case <-sigchan:
ret = -1 ret = -1
@@ -548,7 +512,7 @@ func (m *LikwidCollector) takeMeasurement(evidx int, evset LikwidEventsetConfig,
// Wait // Wait
time.Sleep(interval) time.Sleep(interval)
// end measuring // Read counters
select { select {
case <-sigchan: case <-sigchan:
ret = -1 ret = -1
-1
View File
@@ -63,7 +63,6 @@ Additional options:
- `accessdaemon_path`: Folder of the accessDaemon `likwid-accessD` (like `/usr/local/sbin`) - `accessdaemon_path`: Folder of the accessDaemon `likwid-accessD` (like `/usr/local/sbin`)
- `liblikwid_path`: Location of `liblikwid.so` including file name like `/usr/local/lib/liblikwid.so` - `liblikwid_path`: Location of `liblikwid.so` including file name like `/usr/local/lib/liblikwid.so`
- `lockfile_path`: Location of LIKWID's lock file if multiple tools should access the hardware counters. Default `/var/run/likwid.lock` - `lockfile_path`: Location of LIKWID's lock file if multiple tools should access the hardware counters. Default `/var/run/likwid.lock`
- `warmup_delay`: Run an additional measurement of the specified length before the actual measurement. This can be used as a workaround for CPU starvation (during high load) in the measurement thread. Default is disabled (i.e. `0s`).
### Available metric types ### Available metric types
+4 -7
View File
@@ -84,7 +84,7 @@ func getStats(filename string) map[string]MemstatStats {
case 5: case 5:
v, err := strconv.ParseFloat(linefields[3], 64) v, err := strconv.ParseFloat(linefields[3], 64)
if err == nil { if err == nil {
cclog.ComponentDebug("getStats", strings.Trim(linefields[2], ":"), v, linefields[4]) cclog.ComponentDebug("MemstatCollector", strings.Trim(linefields[2], ":"), v, linefields[4])
stats[strings.Trim(linefields[2], ":")] = MemstatStats{ stats[strings.Trim(linefields[2], ":")] = MemstatStats{
value: v, value: v,
unit: linefields[4], unit: linefields[4],
@@ -92,6 +92,9 @@ func getStats(filename string) map[string]MemstatStats {
} }
} }
} }
if scanner.Err() != nil {
cclog.ComponentError("MemstatCollector", "Failed to get memory stats")
}
return stats return stats
} }
@@ -247,12 +250,6 @@ func (m *MemstatCollector) Read(interval time.Duration, output chan lp.CCMessage
unit = cacheVal.unit unit = cacheVal.unit
} }
} }
if shmemVal, shmem := stats["Shmem"]; shmem {
memUsed -= shmemVal.value
if len(shmemVal.unit) > 0 && len(unit) == 0 {
unit = shmemVal.unit
}
}
} }
} }
} }