mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-04 12:12:25 -08:00
Add additional perf counters for stalled frontend/backend cycles (#2191)
* Add stalled frontend/backend cycles counters for perf collector Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com> * Update collector/perf_linux.go Co-authored-by: Ben Kochie <superq@gmail.com> Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com> * Update collector/perf_linux.go Co-authored-by: Ben Kochie <superq@gmail.com> Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com> Co-authored-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
9ed32666cc
commit
b43db0de6e
|
@ -397,6 +397,26 @@ func NewPerfCollector(logger log.Logger) (Collector, error) {
|
||||||
[]string{"cpu"},
|
[]string{"cpu"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
"stalled_cycles_backend_total": prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(
|
||||||
|
namespace,
|
||||||
|
perfSubsystem,
|
||||||
|
"stalled_cycles_backend_total",
|
||||||
|
),
|
||||||
|
"Number of stalled backend CPU cycles",
|
||||||
|
[]string{"cpu"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
|
"stalled_cycles_frontend_total": prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(
|
||||||
|
namespace,
|
||||||
|
perfSubsystem,
|
||||||
|
"stalled_cycles_frontend_total",
|
||||||
|
),
|
||||||
|
"Number of stalled frontend CPU cycles",
|
||||||
|
[]string{"cpu"},
|
||||||
|
nil,
|
||||||
|
),
|
||||||
"page_faults_total": prometheus.NewDesc(
|
"page_faults_total": prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(
|
prometheus.BuildFQName(
|
||||||
namespace,
|
namespace,
|
||||||
|
@ -598,6 +618,9 @@ func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metric) error {
|
||||||
if err := (*profiler).Profile(hwProfile); err != nil {
|
if err := (*profiler).Profile(hwProfile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if hwProfile == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
cpuid := strconv.Itoa(c.hwProfilerCPUMap[profiler])
|
cpuid := strconv.Itoa(c.hwProfilerCPUMap[profiler])
|
||||||
|
|
||||||
|
@ -656,6 +679,22 @@ func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metric) error {
|
||||||
cpuid,
|
cpuid,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hwProfile.StalledCyclesBackend != nil {
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.desc["stalled_cycles_backend_total"],
|
||||||
|
prometheus.CounterValue, float64(*hwProfile.StalledCyclesBackend),
|
||||||
|
cpuid,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if hwProfile.StalledCyclesFrontend != nil {
|
||||||
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
c.desc["stalled_cycles_frontend_total"],
|
||||||
|
prometheus.CounterValue, float64(*hwProfile.StalledCyclesFrontend),
|
||||||
|
cpuid,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -667,6 +706,9 @@ func (c *perfCollector) updateSoftwareStats(ch chan<- prometheus.Metric) error {
|
||||||
if err := (*profiler).Profile(swProfile); err != nil {
|
if err := (*profiler).Profile(swProfile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if swProfile == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
cpuid := strconv.Itoa(c.swProfilerCPUMap[profiler])
|
cpuid := strconv.Itoa(c.swProfilerCPUMap[profiler])
|
||||||
|
|
||||||
|
@ -720,6 +762,9 @@ func (c *perfCollector) updateCacheStats(ch chan<- prometheus.Metric) error {
|
||||||
if err := (*profiler).Profile(cacheProfile); err != nil {
|
if err := (*profiler).Profile(cacheProfile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if cacheProfile == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
cpuid := strconv.Itoa(c.cacheProfilerCPUMap[profiler])
|
cpuid := strconv.Itoa(c.cacheProfilerCPUMap[profiler])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue