To measure the actual power consumption you should use add an electricity meter to your power supply (remove the batteries if using a notebook).
Note that you will measure the power consumption of the entire system, so make sure to avoid nuisance parameters (any other system activity, i.e. anti-virus updates, graphical desktop environment, indexing services, (internal) hardware devices), perform measurements repeatedly, with and without your algorithms running to cancel out “background” consumption.
If possible use an embedded system.
Concerning your algorithms, the actual energy efficiency depends not only on the C code but also on the performance of the compiler and also the runtime behavior in interaction with the surrounding system. However, here are some resources what you can do as developer to help on this:
Especially take a look on the paragraph Tools in above “Checklist”, as it lists some tools that may help you on rough estimates (based on application profiling). It lists (besides others):
- Perfmon
- PwrTest/Windows Driver Kit
- Windows Event Viewer (Timer tick change events, Microsoft-Windows-Kernel-PowerDiagnostic log)
- Intel PowerInformer
- Windows ETW (performance monitoring framework)
- Intel Application Energy Toolkit
3
solved which code is consuming less power?