Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Getting started API

Loïc Huertas edited this page May 22, 2015 · 12 revisions

How to acquire it

There are two ways to acquire PowerAPI: With or without Maven repositories. In other words, directly from Maven repositories (to get stable or snapshot versions), or from our Git repository (to get the source code).

With Maven repositories

Stable versions are available from the Maven central repository.

Snapshot versions are available from the OSS Sonatype repository. Thus, you have to add this following repository location:

  • pom.xml
<repository>
  <id>OSS Sonatype snapshot repository</id>
	<url>https://oss.sonatype.org/content/repositories/snapshots</url>
	<snapshots>
		<enabled>true</enabled>
	</snapshots>
</repository>
  • build.sbt
resolvers ++= Seq(
  "OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
)

Without Maven repositories

Without Maven repositories, you have to deal with our Git repository as explain below:

To acquire PowerAPI, simply clone it via your Git client:

git clone git://github.com/Spirals-Team/powerapi

As PowerAPI is a sbt managed project, you have to launch the publishLocal command at the root directory (here, POWERAPI_DIR) in order to compile and install it to your local machine. To be able to use the metrics from the hardware counters, PowerAPI has to be installed and used as a root user.

cd $POWERAPI_DIR
sudo sbt publishLocal

How to use it

You can use PowerAPI as a Jar project in your pom.xml or build.sbt file by adding these following lines:

  • pom.xml
<dependency>
	<groupId>org.powerapi</groupId>
	<artifactId>powerapi-core_2.11</artifactId>
	<version>3.1</version>
</dependency>
  • build.sbt
libraryDependencies += "org.powerapi" % "powerapi-core_2.11" % "3.1"

## How to configure it

As said before, configuration part is managed by the Typesafe Config. Thus, be aware to properly configure PowerAPI from a .conf file(s).

Let us take an example for the org.powerapi.module.cpu.dvfs module, which implements the PowerAPI CPU power model using the CMOS CPU power formula, P = c * f * V * V, where c constant, f a frequency and V its associated voltage.

To compute this formula, org.powerapi.module.cpu.dvfs module has to know:

This information can be written in a configuration file as the following:

powerapi {
	cpu {
		tdp = 105
		frequencies = [
			{ value = 1800002, voltage = 1.31 }
			{ value = 2100002, voltage = 1.41 }
			{ value = 2400003, voltage = 1.5 }
		]
	}
}