The hwmon is a generic Linux kernel subsystem, providing access to hardware monitoring components like temperature or voltage/current sensors. Traditionally interfaced via external buses like I2C, many new SOCs have internal sensors ensuring better accuracy of the result. Version 3.8 of the kernel comes with over 100 drivers for different components. One of the newly added ones is a driver for hardware monitoring subsystem of ARM Versatile Express platforms.

 

Thanks to the fact that the hwmon framework provides standardised data interface, it is possible to implement a generic tool accessing all available sensors. One such tool, developed by the hwmon subsystem maintainers, is called lm-sensors. Being available in most Linux distributions (the usual name of the relevant package is "lm-sensors" or "lm_sensors") it can be used, in the most basic form, as a command line utility called "sensors". Running it on the Versatile Express platform with the CoreTile Express A9x4 (V2P-CA) will return information about the test chip power rails - current and instant power (see the CoreTile Technical Reference Manual for detail information about the supplies) - and the temperature of the motherboard controller chip:

 

 

 

 

Of course there are other tools visualising the same data, from desktop widgets for Gnome and KDE environments to server monitoring tools like MRTG and net-snmp.

 

The ARM Streamline Performance Analyzer, part of the ARM Development Studio 5 (DS-5) toolchain, provides a view on the observed system from different angles - from the process scheduler behaviour to energy consumption of the hardware measured by the external ARM Energy Probe. DS-5 Version 5.14 of the tool can also visualise data coming from the hwmon framework. I will demonstrate it using the Versatile Express CoreTile Express A15x2 A7x3 (V2P-CA15_A7) platform.

 

A microcontroller present on the board is responsible, amongst other functions, for monitoring the processors' energy consumption. Although there are test points available for external energy meters like the ARM Energy Probe, the integrated one has obvious advantages, mainly lack of external circuitry (wires) and simple data correlation, as the measurements are synchronised with other data on the target itself.

 

The Streamline Performance Analyzer requires the target to be correctly prepared - see the product documentation here. When this is done, clicking the "Counter configuration" button (fig.1) displays a dialog with all available events and those to be collected, now with "hwmon" groups amongst them (fig.2).



Figure 1

 

 

 


Figure 2

 

 

"Energy: A7 Jcore" and "Energy: A15 Jcore" are probably the most interesting ones. They represent an amount of energy consumed by a device over time. The equivalent "Power" events are also available, providing data about momentary power dissipation. Both values are closely related, but the nature of the hwmon devices (slow data interfaces) can severely reduce data sampling rate. In such circumstances the energy data provides better accuracy and is recommended in typical scenarios.

 

The two event sources mentioned above represent the energy meters present on the V2P-CA15_A7 board which monitor the power supply lines of the two clusters comprising this big.LITTLE system - one consisting of three ARM Cortex®-A7 cores, the other one of two Cortex-A15s. Even simple experiments (loading the cores with "while true" loops) show direct and clear relation between CPU usage and energy consumption (fig.3). The cross section marker for the energy chart shows amount of energy in Joules consumed by the device in the selected bin (time slice). Obviously it depends on the current zoom level, so the time represented by a single bin.

 

 


Figure 3

 

 

The other physical factor important from a power management point of view is the temperature of the devices being observed. Along with the external mentioned above (measuring environmental data like the air temperature inside the device casing) modern chips contain internal silicon die temperature sensors. Data coming from them can be used to control operating point of the processor, for example by reducing clock frequency when the temperature reaches critical levels. The Linux kernel provides a specialized thermal framework for this purpose. In effect the drivers for such sensors would not normally be a part of the hwmon subsystem. Fortunately the "duality" problem has been recognized and those two frameworks cooperate with each other so the thermal sensors are visible for all hwmon users, including Streamline. Figure 4 shows the temperature of the chip rising when the CPU load is increasing and falling when it is idle again. Notice that Streamline chart configuration allows the user to normalize the data - in this case normal temperature (25 deg.C) has been subtracted from the data to make the interesting factor - changes - more visible.



Figure 4

 

 

Considering the fact that ARM Streamline can also visualise behaviour of the CPU frequency scaling drivers (cpufreq also known as DVFS -- Dynamic Voltage and Frequency Scaling), it can be incredibly useful for observing and developing systems with complex power management infrastructure.