From: Vincent Brillault Date: Fri, 13 Feb 2015 20:04:27 +0000 (+0100) Subject: Turbostat: extend the configuration options X-Git-Tag: collectd-5.5.0~24^2~17 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=f5809f75f6243584cb2f56a6d82f156cd4323768 Turbostat: extend the configuration options This commit adds a number of configuration options that overide which features are enabled by the automated mechanisms. These options should only be used to turn off unwanted features or add (temporarily) support for a new CPU --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 078f2dd9..a5b82ec6 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -1189,8 +1189,22 @@ # # -## The following option should not be used if MSR_IA32_TEMPERATURE_TARGET is supported -# TCCActivationTemp 100 +## None of the following option should be set manually +## This plugin automatically detect most optimal options +## Only set values here if: +## - The module ask you to +## - You want to disable the collection of some data +## - Your (intel) CPU is not supported (yet) by the module +## - The module generate a lot of errors 'MSR offset 0x... read failed' +## In the last two cases, please open a bug request +# +# TCCActivationTemp "100" +# CoreCstates "392" +# PackageCstates "396" +# SystemManagementInterrupt true +# DigitalTemperatureSensor true +# PackageThermalManagement true +# RunningAveragePowerLimit "7" # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 642d7994..f5425042 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -6421,18 +6421,76 @@ Default: B<1978> =back -=head2 Plugin C +=head2 Plugin C The I reads CPU frequency and C-state residency on modern Intel processors by using the new Model Specific Registers. =over 4 +=item B I + +Bitmask of the list of core C states supported by the processor. +This option should only be used if the automated detection fails. +Default value extracted from the cpu model and family. + +Currently supported C-states (by this plugin): 3, 6, 7 + +Example: (1<<3)+(1<<6)+(1<<7) = 392 for all states + +=item B I + +Bitmask of the list of pacages C states supported by the processor. +This option should only be used if the automated detection fails. +Default value extracted from the cpu model and family. + +Currently supported C-states (by this plugin): 2, 3, 6, 7, 8, 9, 10 + +Example: (1<<2)+(1<<3)+(1<<6)+(1<<7) = 396 for states 2, 3, 6 and 7 + +=item B I|I + +Boolean enabling the collection of the I/O System-Management Interrupt +counter'. This option should only be used if the automated detection +fails or if you want to disable this feature. + +=item B I|I + +Boolean enabling the collection of the temperature of each core. +This option should only be used if the automated detectionfails or +if you want to disable this feature. + +=item B I|I + +Boolean enabling the collection of the temperature of each package. +This option should only be used if the automated detectionfails or +if you want to disable this feature. + =item B I Thermal Control Circuit Activation Temperature of the installed -CPU. This option should only be used if the automated detection -fails. Default value extracted from B +CPU. This temperature is used when collecting the temperature of +cores or packages. This option should only be used if the automated +detection fails. Default value extracted from B + +=item B I + +Bitmask of the list of elements to be thermally monitored. This option +should only be used if the automated detection fails or if you want to +disable some collections. The different bits of this bitmask accepted +by this plugin are: + +=over 4 + +=item 0 ('1'): Package + +=item 1 ('2'): DRAM + +=item 2 ('4'): Cores + +=item 3 ('8'): Embedded graphic device + +=back =back diff --git a/src/turbostat.c b/src/turbostat.c index ec8757e7..5ee45186 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -81,17 +81,23 @@ static _Bool aperf_mperf_unstable; * Currently supported C-states (by this plugin): 3, 6, 7 */ static unsigned int do_core_cstate; +static unsigned int config_core_cstate; +static _Bool apply_config_core_cstate; /* * Bitmask of the list of pacages C states supported by the processor. * Currently supported C-states (by this plugin): 2, 3, 6, 7, 8, 9, 10 */ static unsigned int do_pkg_cstate; +static unsigned int config_pkg_cstate; +static _Bool apply_config_pkg_cstate; /* * Boolean indicating if the processor supports 'I/O System-Management Interrupt counter' */ static _Bool do_smi; +static _Bool config_smi; +static _Bool apply_config_smi; /* * Boolean indicating if the processor supports 'Digital temperature sensor' @@ -102,6 +108,8 @@ static _Bool do_smi; * - Temperatures above the tcc_activation_temp are not recorded */ static _Bool do_dts; +static _Bool config_dts; +static _Bool apply_config_dts; /* * Boolean indicating if the processor supports 'Package thermal management' @@ -112,6 +120,8 @@ static _Bool do_dts; * - Temperatures above the tcc_activation_temp are not recorded */ static _Bool do_ptm; +static _Bool config_ptm; +static _Bool apply_config_ptm; /* * Thermal Control Circuit Activation Temperature as configured by the user. @@ -121,6 +131,8 @@ static _Bool do_ptm; static unsigned int tcc_activation_temp; static unsigned int do_rapl; +static unsigned int config_rapl; +static _Bool apply_config_rapl; static double rapl_energy_units; #define RAPL_PKG (1 << 0) @@ -218,7 +230,13 @@ static cdtime_t time_even, time_odd, time_delta; static const char *config_keys[] = { + "CoreCstates", + "PackageCstates", + "SystemManagementInterrupt", + "DigitalTemperatureSensor", + "PackageThermalManagement", "TCCActivationTemp", + "RunningAveragePowerLimit", }; static const int config_keys_num = STATIC_ARRAY_SIZE (config_keys); @@ -981,6 +999,20 @@ probe_cpu() return -1; } + /* Override detected values with configuration */ + if (apply_config_core_cstate) + do_core_cstate = config_core_cstate; + if (apply_config_pkg_cstate) + do_pkg_cstate = config_pkg_cstate; + if (apply_config_smi) + do_smi = config_smi; + if (apply_config_dts) + do_dts = config_dts; + if (apply_config_ptm) + do_ptm = config_ptm; + if (apply_config_rapl) + do_rapl = config_rapl; + if (do_rapl) { unsigned long long msr; if (get_msr(0, MSR_RAPL_POWER_UNIT, &msr)) @@ -1537,7 +1569,43 @@ turbostat_config(const char *key, const char *value) long unsigned int tmp_val; char *end; - if (strcasecmp("TCCActivationTemp", key) == 0) { + if (strcasecmp("CoreCstates", key) == 0) { + tmp_val = strtoul(value, &end, 0); + if (*end != '\0' || tmp_val > UINT_MAX) { + ERROR("Turbostat plugin: Invalid CoreCstates '%s'", + value); + return -1; + } + config_core_cstate = (unsigned int) tmp_val; + apply_config_core_cstate = 1; + } else if (strcasecmp("PackageCstates", key) == 0) { + tmp_val = strtoul(value, &end, 0); + if (*end != '\0' || tmp_val > UINT_MAX) { + ERROR("Turbostat plugin: Invalid PackageCstates '%s'", + value); + return -1; + } + config_pkg_cstate = (unsigned int) tmp_val; + apply_config_pkg_cstate = 1; + } else if (strcasecmp("SystemManagementInterrupt", key) == 0) { + config_smi = IS_TRUE(value); + apply_config_smi = 1; + } else if (strcasecmp("DigitalTemperatureSensor", key) == 0) { + config_dts = IS_TRUE(value); + apply_config_dts = 1; + } else if (strcasecmp("PackageThermalManagement", key) == 0) { + config_ptm = IS_TRUE(value); + apply_config_ptm = 1; + } else if (strcasecmp("RunningAveragePowerLimit", key) == 0) { + tmp_val = strtoul(value, &end, 0); + if (*end != '\0' || tmp_val > UINT_MAX) { + ERROR("Turbostat plugin: Invalid RunningAveragePowerLimit '%s'", + value); + return -1; + } + config_rapl = (unsigned int) tmp_val; + apply_config_rapl = 1; + } else if (strcasecmp("TCCActivationTemp", key) == 0) { tmp_val = strtoul(value, &end, 0); if (*end != '\0' || tmp_val > UINT_MAX) { ERROR("Turbostat plugin: Invalid TCCActivationTemp '%s'",