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

Commit 8b1d1d1

Browse files
huertasmcolmant
authored andcommitted
feature(powermeter): add some examples of defined powermeters
1 parent ec8afa8 commit 8b1d1d1

File tree

125 files changed

+566
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+566
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
scalaVersion in ThisBuild := "2.11.6"
2+
3+
resolvers ++= Seq(
4+
"OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
5+
)
6+
7+
libraryDependencies in ThisBuild ++= Seq(
8+
"org.powerapi" % "powerapi-core_2.11" % "3.3"
9+
)
10+
11+
mainClass in (Compile, run) := Some("AppMonitorExample")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import org.powerapi.PowerMeter;
2+
import org.powerapi.PowerModule;
3+
import org.powerapi.PowerMonitoring;
4+
import org.powerapi.module.cpu.simple.ProcFSCpuSimpleModule;
5+
import org.powerapi.reporter.JFreeChartDisplay;
6+
import org.powerapi.core.target.Target;
7+
import org.powerapi.core.target.Application;
8+
import scala.concurrent.duration.Duration;
9+
import scala.collection.JavaConversions;
10+
import java.util.ArrayList;
11+
import java.util.Arrays;
12+
13+
public class AppMonitorExample {
14+
public static void main (String[] args) {
15+
ArrayList<PowerModule> modules = new ArrayList<PowerModule>(Arrays.asList(ProcFSCpuSimpleModule.apply()));
16+
PowerMeter cpu_simple = PowerMeter.loadModule(JavaConversions.asScalaBuffer(modules));
17+
JFreeChartDisplay chart = new JFreeChartDisplay();
18+
ArrayList<Target> targets = new ArrayList<Target>(Arrays.asList(new Application(args[0])));
19+
PowerMonitoring monitoring = cpu_simple.monitor(Duration.create(1L, "seconds"), JavaConversions.asScalaBuffer(targets));
20+
monitoring.to(chart);
21+
22+
cpu_simple.waitFor(Duration.create(5, "minutes"));
23+
24+
monitoring.cancel();
25+
cpu_simple.shutdown();
26+
}
27+
}
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
akka {
2+
# Options: OFF, ERROR, WARNING, INFO, DEBUG
3+
loglevel = ERROR
4+
5+
log-dead-letters-during-shutdown = off
6+
log-dead-letters = off
7+
8+
actor {
9+
guardian-supervisor-strategy = "org.powerapi.core.GuardianFailureStrategy"
10+
11+
debug {
12+
# Enable function of LoggingReceive, which is to log any received message at
13+
# DEBUG level
14+
receive = off
15+
16+
# Enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
17+
autoreceive = off
18+
19+
# Enable DEBUG logging of actor lifecycle changes
20+
lifecycle = off
21+
22+
# Enable DEBUG logging of subscription changes on the eventStream
23+
event-stream = off
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include "akka"
2+
include "hardware"
3+
include "display-file"
4+
include "powerspy"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
powerapi {
2+
reporter {
3+
file {
4+
prefix = "powerapi-out"
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
powerapi {
2+
cpu {
3+
tdp = 35
4+
}
5+
}
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
powerspy {
2+
mac = "00:0B:CE:07:1E:87"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
scalaVersion in ThisBuild := "2.11.6"
2+
3+
resolvers ++= Seq(
4+
"OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
5+
)
6+
7+
libraryDependencies in ThisBuild ++= Seq(
8+
"org.powerapi" % "powerapi-core_2.11" % "3.3"
9+
)
10+
11+
mainClass in (Compile, run) := Some("Monitor")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
akka {
2+
# Options: OFF, ERROR, WARNING, INFO, DEBUG
3+
loglevel = ERROR
4+
5+
log-dead-letters-during-shutdown = off
6+
log-dead-letters = off
7+
8+
actor {
9+
guardian-supervisor-strategy = "org.powerapi.core.GuardianFailureStrategy"
10+
11+
debug {
12+
# Enable function of LoggingReceive, which is to log any received message at
13+
# DEBUG level
14+
receive = off
15+
16+
# Enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
17+
autoreceive = off
18+
19+
# Enable DEBUG logging of actor lifecycle changes
20+
lifecycle = off
21+
22+
# Enable DEBUG logging of subscription changes on the eventStream
23+
event-stream = off
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include "akka"
2+
include "hardware"
3+
include "display-file"
4+
include "powerspy"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
powerapi {
2+
reporter {
3+
file {
4+
prefix = "powerapi-out"
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
powerapi {
2+
cpu {
3+
tdp = 35
4+
}
5+
}
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
powerspy {
2+
mac = "00:0B:CE:07:1E:87"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import org.powerapi.PowerMeter
2+
import org.powerapi.module.cpu.simple.ProcFSCpuSimpleModule
3+
import org.powerapi.core.target._
4+
import org.powerapi.reporter.JFreeChartDisplay
5+
import scala.concurrent.duration._
6+
7+
object Monitor extends App {
8+
val cpu = PowerMeter.loadModule(ProcFSCpuSimpleModule())
9+
val chart = new JFreeChartDisplay
10+
val monitoring = cpu.monitor(1.second)(args(0)) to chart
11+
12+
cpu.waitFor(5.minutes)
13+
14+
monitoring.cancel
15+
cpu.shutdown
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
scalaVersion in ThisBuild := "2.11.6"
2+
3+
resolvers ++= Seq(
4+
"OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
5+
)
6+
7+
libraryDependencies in ThisBuild ++= Seq(
8+
"org.powerapi" % "powerapi-core_2.11" % "3.3"
9+
)
10+
11+
mainClass in (Compile, run) := Some("AppMonitorExample")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import org.powerapi.PowerMeter;
2+
import org.powerapi.PowerModule;
3+
import org.powerapi.PowerMonitoring;
4+
import org.powerapi.module.cpu.simple.SigarCpuSimpleModule;
5+
import org.powerapi.reporter.JFreeChartDisplay;
6+
import org.powerapi.core.target.Target;
7+
import org.powerapi.core.target.Application;
8+
import scala.concurrent.duration.Duration;
9+
import scala.collection.JavaConversions;
10+
import java.util.ArrayList;
11+
import java.util.Arrays;
12+
13+
public class AppMonitorExample {
14+
public static void main (String[] args) {
15+
ArrayList<PowerModule> modules = new ArrayList<PowerModule>(Arrays.asList(SigarCpuSimpleModule.apply()));
16+
PowerMeter cpu_simple = PowerMeter.loadModule(JavaConversions.asScalaBuffer(modules));
17+
JFreeChartDisplay chart = new JFreeChartDisplay();
18+
ArrayList<Target> targets = new ArrayList<Target>(Arrays.asList(new Application(args[0])));
19+
PowerMonitoring monitoring = cpu_simple.monitor(Duration.create(1L, "seconds"), JavaConversions.asScalaBuffer(targets));
20+
monitoring.to(chart);
21+
22+
cpu_simple.waitFor(Duration.create(5, "minutes"));
23+
24+
monitoring.cancel();
25+
cpu_simple.shutdown();
26+
}
27+
}
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
akka {
2+
# Options: OFF, ERROR, WARNING, INFO, DEBUG
3+
loglevel = ERROR
4+
5+
log-dead-letters-during-shutdown = off
6+
log-dead-letters = off
7+
8+
actor {
9+
guardian-supervisor-strategy = "org.powerapi.core.GuardianFailureStrategy"
10+
11+
debug {
12+
# Enable function of LoggingReceive, which is to log any received message at
13+
# DEBUG level
14+
receive = off
15+
16+
# Enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
17+
autoreceive = off
18+
19+
# Enable DEBUG logging of actor lifecycle changes
20+
lifecycle = off
21+
22+
# Enable DEBUG logging of subscription changes on the eventStream
23+
event-stream = off
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include "akka"
2+
include "hardware"
3+
include "display-file"
4+
include "powerspy"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
powerapi {
2+
reporter {
3+
file {
4+
prefix = "powerapi-out"
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
powerapi {
2+
cpu {
3+
tdp = 35
4+
}
5+
}
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
powerspy {
2+
mac = "00:0B:CE:07:1E:87"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
scalaVersion in ThisBuild := "2.11.6"
2+
3+
resolvers ++= Seq(
4+
"OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
5+
)
6+
7+
libraryDependencies in ThisBuild ++= Seq(
8+
"org.powerapi" % "powerapi-core_2.11" % "3.3"
9+
)
10+
11+
mainClass in (Compile, run) := Some("Monitor")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
akka {
2+
# Options: OFF, ERROR, WARNING, INFO, DEBUG
3+
loglevel = ERROR
4+
5+
log-dead-letters-during-shutdown = off
6+
log-dead-letters = off
7+
8+
actor {
9+
guardian-supervisor-strategy = "org.powerapi.core.GuardianFailureStrategy"
10+
11+
debug {
12+
# Enable function of LoggingReceive, which is to log any received message at
13+
# DEBUG level
14+
receive = off
15+
16+
# Enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
17+
autoreceive = off
18+
19+
# Enable DEBUG logging of actor lifecycle changes
20+
lifecycle = off
21+
22+
# Enable DEBUG logging of subscription changes on the eventStream
23+
event-stream = off
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include "akka"
2+
include "hardware"
3+
include "display-file"
4+
include "powerspy"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
powerapi {
2+
reporter {
3+
file {
4+
prefix = "powerapi-out"
5+
}
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
powerapi {
2+
cpu {
3+
tdp = 35
4+
}
5+
}
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
powerspy {
2+
mac = "00:0B:CE:07:1E:87"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import org.powerapi.PowerMeter
2+
import org.powerapi.module.cpu.simple.SigarCpuSimpleModule
3+
import org.powerapi.core.target._
4+
import org.powerapi.reporter.JFreeChartDisplay
5+
import scala.concurrent.duration._
6+
7+
object Monitor extends App {
8+
val cpu = PowerMeter.loadModule(SigarCpuSimpleModule())
9+
val chart = new JFreeChartDisplay
10+
val monitoring = cpu.monitor(1.second)(args(0)) to chart
11+
12+
cpu.waitFor(5.minutes)
13+
14+
monitoring.cancel
15+
cpu.shutdown
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
scalaVersion in ThisBuild := "2.11.6"
2+
3+
resolvers ++= Seq(
4+
"OSS Sonatype snapshot repository" at "https://oss.sonatype.org/content/repositories/snapshots"
5+
)
6+
7+
libraryDependencies in ThisBuild ++= Seq(
8+
"org.powerapi" % "powerapi-core_2.11" % "3.3"
9+
)
10+
11+
mainClass in (Compile, run) := Some("Monitor")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
akka {
2+
# Options: OFF, ERROR, WARNING, INFO, DEBUG
3+
loglevel = ERROR
4+
5+
log-dead-letters-during-shutdown = off
6+
log-dead-letters = off
7+
8+
actor {
9+
guardian-supervisor-strategy = "org.powerapi.core.GuardianFailureStrategy"
10+
11+
debug {
12+
# Enable function of LoggingReceive, which is to log any received message at
13+
# DEBUG level
14+
receive = off
15+
16+
# Enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like)
17+
autoreceive = off
18+
19+
# Enable DEBUG logging of actor lifecycle changes
20+
lifecycle = off
21+
22+
# Enable DEBUG logging of subscription changes on the eventStream
23+
event-stream = off
24+
}
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include "akka"
2+
include "hardware"
3+
include "display-file"
4+
include "omegawatt"

0 commit comments

Comments
 (0)