Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.28 KB

README.md

File metadata and controls

62 lines (42 loc) · 2.28 KB

PowTrAn

POWer TRace ANalyzer

Is an R package that is able to analyze power traces from repeated executions of software applications or algorithms in a efficient and accurate way.

Workflow

Taking as a reference the approach reported in the article Methodological Guidelines for Measuring Energy Consumption of Software Applications where four steps are identified:

  1. Goal (G): define the research question, the target device(s) on which the measurements will take place, and the context in which the SWUT is executed
  2. How (H): decide how consumption will be measured and the procedure needed to carry out the measurement
  3. Do (D): carry out the measurement and collect the data
  4. Analyse (A): analyse the data and address the research question(s)

The PowTrAn tool can be used in the initial part of the Analyse phase.

Analysis approach

The How approach supported by this tool is a physical measyre that uses no explicit synchronization but adopts markers.

The power traces are expected to be collected according to the following protocol:

  • each work unit must be preceded a and followed by a marker

  • the markers consist in a square pulse that has to be generated by a fragment of code keeping the processor as busy as possible. The pulse is preceded by (equally long) sleep period.

E.g.

      __B__                  __B__
      |   |     __work__     |   |
      |   |     |      |     |   |
.__S__|   |__S__|      |__S__|   |__S__...
  • the work units are repeated several times (default: 30) in order to obtain an accurate estimate of the real power consumptiom.

The effective power consumption is estimated by subtracting the sleep level power from the average power measured during the work phase.


This package is not currently on CRAN, to install it, use devtools:

install.packages("devtools") # if not already installed

devtools::install_github("SoftengPoliTo/powtran")

A sample usage is as follows:

voltage = 5  # V
period = 1/1000  # s

# the text file contains one current sample per row
filename = "tests/raspberrypi2_c_bubblesort_10000_3.txt"
current.samples = scan(filename,skip=1,quiet = TRUE)
res = extract.power(current.samples*voltage, # instant power [W]
                    period) 
plot(res)