=back
-=head2 Plugin C<Turbostat>
+=head2 Plugin C<turbostat>
The I<Turbostat plugin> reads CPU frequency and C-state residency on modern
Intel processors by using the new Model Specific Registers.
=over 4
+=item B<CoreCstates> I<Bitmask(Integer)>
+
+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<PackageCstates> I<Bitmask(Integer)>
+
+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<SystemManagementInterrupt> I<true>|I<false>
+
+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<DigitalTemperatureSensor> I<true>|I<false>
+
+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<DigitalTemperatureSensor> I<true>|I<false>
+
+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<TCCActivationTemp> I<Temperature>
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<MSR_IA32_TEMPERATURE_TARGET>
+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<MSR_IA32_TEMPERATURE_TARGET>
+
+=item B<RunningAveragePowerLimit> I<Bitmask(Integer)>
+
+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
* 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'
* - 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'
* - 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.
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)
static const char *config_keys[] =
{
+ "CoreCstates",
+ "PackageCstates",
+ "SystemManagementInterrupt",
+ "DigitalTemperatureSensor",
+ "PackageThermalManagement",
"TCCActivationTemp",
+ "RunningAveragePowerLimit",
};
static const int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
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))
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'",