summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/cpufreq
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-04-17 17:57:35 +0000
commit3b95e5be69c199a2a195c57aba12d88c242225ac (patch)
tree137b72ffaefe7f34bf21e975ccc9cc9ec0474564 /collectors/python.d.plugin/cpufreq
parentAdding upstream version 1.13.0. (diff)
downloadnetdata-3b95e5be69c199a2a195c57aba12d88c242225ac.tar.xz
netdata-3b95e5be69c199a2a195c57aba12d88c242225ac.zip
Adding upstream version 1.14.0~rc0.upstream/1.14.0_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/cpufreq')
-rw-r--r--collectors/python.d.plugin/cpufreq/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/cpufreq/README.md37
-rw-r--r--collectors/python.d.plugin/cpufreq/cpufreq.chart.py115
-rw-r--r--collectors/python.d.plugin/cpufreq/cpufreq.conf41
4 files changed, 0 insertions, 206 deletions
diff --git a/collectors/python.d.plugin/cpufreq/Makefile.inc b/collectors/python.d.plugin/cpufreq/Makefile.inc
deleted file mode 100644
index d6138801d..000000000
--- a/collectors/python.d.plugin/cpufreq/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# install these files
-dist_python_DATA += cpufreq/cpufreq.chart.py
-dist_pythonconfig_DATA += cpufreq/cpufreq.conf
-
-# do not install these files, but include them in the distribution
-dist_noinst_DATA += cpufreq/README.md cpufreq/Makefile.inc
-
diff --git a/collectors/python.d.plugin/cpufreq/README.md b/collectors/python.d.plugin/cpufreq/README.md
deleted file mode 100644
index f1fc1e8f2..000000000
--- a/collectors/python.d.plugin/cpufreq/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# cpufreq
-
-> THIS MODULE IS OBSOLETE.
-> USE THE [PROC PLUGIN](../../proc.plugin) - IT IS MORE EFFICIENT
-
----
-
-This module shows the current CPU frequency as set by the cpufreq kernel
-module.
-
-**Requirement:**
-You need to have `CONFIG_CPU_FREQ` and (optionally) `CONFIG_CPU_FREQ_STAT`
-enabled in your kernel.
-
-This module tries to read from one of two possible locations. On
-initialization, it tries to read the `time_in_state` files provided by
-cpufreq\_stats. If this file does not exist, or doesn't contain valid data, it
-falls back to using the more inaccurate `scaling_cur_freq` file (which only
-represents the **current** CPU frequency, and doesn't account for any state
-changes which happen between updates).
-
-It produces one chart with multiple lines (one line per core).
-
-### configuration
-
-Sample:
-
-```yaml
-sys_dir: "/sys/devices"
-```
-
-If no configuration is given, module will search for cpufreq files in `/sys/devices` directory.
-Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified.
-
----
-
-[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fpython.d.plugin%2Fcpufreq%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/python.d.plugin/cpufreq/cpufreq.chart.py b/collectors/python.d.plugin/cpufreq/cpufreq.chart.py
deleted file mode 100644
index cbbab6d7f..000000000
--- a/collectors/python.d.plugin/cpufreq/cpufreq.chart.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- coding: utf-8 -*-
-# Description: cpufreq netdata python.d module
-# Author: Pawel Krupa (paulfantom)
-# Author: Steven Noonan (tycho)
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-import glob
-import os
-
-from bases.FrameworkServices.SimpleService import SimpleService
-
-# default module values (can be overridden per job in `config`)
-# update_every = 2
-
-ORDER = ['cpufreq']
-
-CHARTS = {
- 'cpufreq': {
- 'options': [None, 'CPU Clock', 'MHz', 'cpufreq', 'cpufreq.cpufreq', 'line'],
- 'lines': [
- # lines are created dynamically in `check()` method
- ]
- }
-}
-
-
-class Service(SimpleService):
- def __init__(self, configuration=None, name=None):
- prefix = os.getenv('NETDATA_HOST_PREFIX', "")
- if prefix.endswith('/'):
- prefix = prefix[:-1]
- self.sys_dir = prefix + "/sys/devices"
- SimpleService.__init__(self, configuration=configuration, name=name)
- self.order = ORDER
- self.definitions = CHARTS
- self.fake_name = 'cpu'
- self.assignment = {}
- self.accurate_exists = True
- self.accurate_last = {}
-
- def _get_data(self):
- data = {}
-
- if self.accurate_exists:
- accurate_ok = True
-
- for name, paths in self.assignment.items():
- last = self.accurate_last[name]
-
- current = {}
- deltas = {}
- ticks_since_last = 0
-
- for line in open(paths['accurate'], 'r'):
- line = list(map(int, line.split()))
- current[line[0]] = line[1]
- ticks = line[1] - last.get(line[0], 0)
- ticks_since_last += ticks
- deltas[line[0]] = line[1] - last.get(line[0], 0)
-
- avg_freq = 0
- if ticks_since_last != 0:
- for frequency, ticks in deltas.items():
- avg_freq += frequency * ticks
- avg_freq /= ticks_since_last
-
- data[name] = avg_freq
- self.accurate_last[name] = current
- if avg_freq == 0 or ticks_since_last == 0:
- # Delta is either too large or nonexistent, fall back to
- # less accurate reading. This can happen if we switch
- # to/from the 'schedutil' governor, which doesn't report
- # stats.
- accurate_ok = False
-
- if accurate_ok:
- return data
-
- for name, paths in self.assignment.items():
- data[name] = open(paths['inaccurate'], 'r').read()
-
- return data
-
- def check(self):
- try:
- self.sys_dir = str(self.configuration['sys_dir'])
- except (KeyError, TypeError):
- self.error("No path specified. Using: '" + self.sys_dir + "'")
-
- for path in glob.glob(self.sys_dir + '/system/cpu/cpu*/cpufreq/stats/time_in_state'):
- path_elem = path.split('/')
- cpu = path_elem[-4]
- if cpu not in self.assignment:
- self.assignment[cpu] = {}
- self.assignment[cpu]['accurate'] = path
- self.accurate_last[cpu] = {}
-
- if not self.assignment:
- self.accurate_exists = False
-
- for path in glob.glob(self.sys_dir + '/system/cpu/cpu*/cpufreq/scaling_cur_freq'):
- path_elem = path.split('/')
- cpu = path_elem[-3]
- if cpu not in self.assignment:
- self.assignment[cpu] = {}
- self.assignment[cpu]['inaccurate'] = path
-
- if not self.assignment:
- self.error("couldn't find a method to read cpufreq statistics")
- return False
-
- for name in sorted(self.assignment, key=lambda v: int(v[3:])):
- self.definitions[ORDER[0]]['lines'].append([name, name, 'absolute', 1, 1000])
-
- return True
diff --git a/collectors/python.d.plugin/cpufreq/cpufreq.conf b/collectors/python.d.plugin/cpufreq/cpufreq.conf
deleted file mode 100644
index 96c0884c6..000000000
--- a/collectors/python.d.plugin/cpufreq/cpufreq.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-# netdata python.d.plugin configuration for cpufreq
-#
-# This file is in YaML format. Generally the format is:
-#
-# name: value
-#
-# There are 2 sections:
-# - global variables
-# - one or more JOBS
-#
-# JOBS allow you to collect values from multiple sources.
-# Each source will have its own set of charts.
-#
-# JOB parameters have to be indented (using spaces only, example below).
-
-# ----------------------------------------------------------------------
-# Global Variables
-# These variables set the defaults for all JOBs, however each JOB
-# may define its own, overriding the defaults.
-
-# update_every sets the default data collection frequency.
-# If unset, the python.d.plugin default is used.
-# update_every: 1
-
-# priority controls the order of charts at the netdata dashboard.
-# Lower numbers move the charts towards the top of the page.
-# If unset, the default for python.d.plugin is used.
-# priority: 60000
-
-# penalty indicates whether to apply penalty to update_every in case of failures.
-# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
-# penalty: yes
-
-# autodetection_retry sets the job re-check interval in seconds.
-# The job is not deleted if check fails.
-# Attempts to start the job are made once every autodetection_retry.
-# This feature is disabled by default.
-# autodetection_retry: 0
-
-# The directory to search for the file scaling_cur_freq
-sys_dir: "/sys/devices"