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

Getting started API

Thomas Vincent edited this page Mar 22, 2017 · 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>4.0</version>
</dependency>
  • build.sbt
libraryDependencies += "org.powerapi" % "powerapi-core_2.11" % "4.0"

Do not forget to configure correctly the modules (see here on how to configure a module).