-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from powerapi-ng/pr-belgaid
Pr belgaid
- Loading branch information
Showing
5 changed files
with
556 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import pyRAPL | ||
# from pyRAPL import measure | ||
# from pyRAPL import measure_energy | ||
from time import sleep | ||
from sys import argv | ||
|
||
|
||
|
||
def myhandler(measures): | ||
print("myhandler") | ||
print(measures) | ||
|
||
|
||
@pyRAPL.measure(handler=myhandler) | ||
def testi(n): | ||
sleep(n) | ||
return n | ||
|
||
@pyRAPL.measure() | ||
def fun2(n): | ||
sleep(2*n) | ||
|
||
|
||
@pyRAPL.measure(devices=[pyRAPL.Device.PKG, pyRAPL.Device.DRAM]) | ||
def fun3(n): | ||
sleep(2*n) | ||
|
||
|
||
def main1(): | ||
n = int(argv[1]) if len(argv) >1 else 5 | ||
sensor = pyRAPL.PyRAPL() | ||
sensor.record([pyRAPL.Device.PKG, pyRAPL.Device.DRAM]) | ||
sleep(n) | ||
sensor.stop() | ||
# energy_pkg = sensor.recorded_energy(pyRAPL.Device.PKG) | ||
# energy_dram = sensor.recorded_energy(pyRAPL.Device.DRAM) | ||
# print("Energy PKG: %f , Energy DRAM: %f"%(energy_pkg,energy_dram)) | ||
print(sensor.recorded_energy()) | ||
sensor = pyRAPL.PyRAPL() | ||
sensor.record() | ||
sleep(n) | ||
sensor.stop() | ||
# energy_pkg = sensor.recorded_energy(pyRAPL.Device.PKG) | ||
# energy_dram = sensor.recorded_energy(pyRAPL.Device.DRAM) | ||
# print("Energy PKG: %f , Energy DRAM: %f"%(energy_pkg,energy_dram)) | ||
print(sensor.recorded_energy()) | ||
|
||
|
||
def main2(): | ||
n = int(argv[1]) if len(argv) >1 else 5 | ||
# testi(n) | ||
# fun2(n) | ||
# testi(n) | ||
fun3(n) | ||
|
||
if __name__=="__main__": | ||
main2() |
Oops, something went wrong.