This is a async plugin for Score-P to capture sensors available from hwmon.
It utilizes the library libsensors
for that.
The plugin is configure via environment variables. The following are available:
SCOREP_METRIC_PLUGINS
(required): Comma-separated list of enable plugins. MUST containsensors_plugin
.SCOREP_METRIC_SENSORS_PLUGIN
(required): Comma-separated list of metrics to record. See below how to find available metrics.SCOREP_METRIC_SENSORS_PLUGIN_PERIOD
(optional, default=1000000) Set the amplitude to read the sensors (in usecs).SCOREP_METRIC_SENSORS_PLUGIN_FILE
(optional, default=none) Use the given alternatelibsensors
config-file. Only intended for experienced users.
The helper binary scorep-plugin-libsensors-print-sensors
prints all available sensors.
Copy the string From the second column to the environment variable SCOREP_METRIC_SENSORS_PLUGIN
.
Example output:
$ ./result/bin/scorep-plugin-libsensors-print-sensors
Chip/Feature/Sub-feature;"SCOREP_METRIC_SENSORS_PLUGIN";current value
thinkpad//sys/class/hwmon/hwmon4/fan1/fan1_input;"thinkpad/fan1/fan1_input";0.000000e+00
thinkpad//sys/class/hwmon/hwmon4/fan2/fan2_input;"thinkpad/fan2/fan2_input";0.000000e+00
thinkpad//sys/class/hwmon/hwmon4/temp1/temp1_input;"thinkpad/CPU/temp1_input";5.600000e+01
[...]
Here, one might use export SCOREP_METRIC_SENSORS_PLUGIN="thinkpad/fan1/fan1_input,thinkpad/CPU/temp1_input"
To scan for available sensors, start the tool sensors-detect
as root and
follow the instructions on the screen. Use it at your own risk ;)
Sensor detection might not be necessary, depending on your system.
To compile this plugin, you need:
- C compiler
libpthread
- Score-P
libsensors
(including development files)
Ensure submodules are present. (execute git submodule update--init --recursive
)
Then follow standard cmake procedure.
mkdir build && cd build
cmake ..
make -j
make install
Append -DCMAKE_INSTALL_PREFIX=$PREFIX
to set a different install prefix.
Make sure that the installed libsensors_plugin.so
is found by Score-P,
e.g. by setting your LD_LIBRARY_PATH
appropriately.
The following further build options can be set with -D<option>=<value>
on cmake invocation:
SENSORS_DIR
(no default): directory to installed libsensorsSENSORS_STATIC
(defaultON
): whether to link against staticlibsensors.a
(valueON
) or dynamiclibsensors.so
(valueOFF
)BUILD_PRINT_SENSORS_BINARY
(defaultON
): whether to build the helper binary to print available sensors
Further advanced options can be found in the source code.
# Score-P configuration
export SCOREP_ENABLE_PROFILING=0
export SCOREP_ENABLE_TRACING=1
export SCOREP_TOTAL_MEMORY=4095M
# plugin configuration
export SCOREP_METRIC_PLUGINS=sensors_plugin
export SCOREP_METRIC_SENSORS_PLUGIN="thinkpad/fan1/fan1_input,thinkpad/CPU/temp1_input"
# sleep5 is an Score-P instrumented binary from the test/ subdirectory
SCOREP_EXPERIMENT_DIRECTORY=trace ./sleep5
# dump results
otf2-print trace/traces.otf
A simple script to check if the plugin is installed correctly resides in the subdirectory test/
- Check whether the plugin library can be loaded from the
LD_LIBRARY_PATH
. - It may be, that
libsensors
needs root access to read the counters. In this case, you need to trace your application as root. Alternatively, attempt to allow non-root users to read your sensors by settingsudo sysctl kernel.perf_event_paranoid=-1
. - The maximum number of counters is defined in the source file. Adapt
MAX_SENSOR_COUNTER
to en- or decrease it and recompile the plugin. - Open an issue or send an E-Mail to the author.
- Robert Schoene (robert.schoene at tu-dresden dot de)