Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
klottick committed Jul 19, 2019
1 parent 0b984ad commit 85fd783
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion energy-meter/convert.py
Expand Up @@ -7,7 +7,7 @@ def to_joules(ujoules):

return ujoules*10**(-6)

def to_kwh(joules, seconds):
def to_kwh(joules):
""" Converts from watts used in a timeframe (in seconds) to kwh """

watt_hours = joules / 3600
Expand Down
1 change: 1 addition & 0 deletions energy-meter/evaluate.py
Expand Up @@ -72,6 +72,7 @@ def energy(user_func, *args):

files = utils.measure_files(files, DELAY)
files = utils.update_files(files, True)

package = utils.get_total(files, multiple_cpus)
if package >=0:
utils.log("Process wattage", package)
Expand Down
13 changes: 8 additions & 5 deletions energy-meter/utils.py
Expand Up @@ -56,9 +56,10 @@ def measure(file, delay=1):

return end-start
def get_process_average(raplfiles, multiple_cpus):
total = 0
if multiple_cpus:
for file in raplfiles:
if file.name.contains("CPU"):
if "CPU" in file.name:
total+= file.process_average
return total
else:
Expand All @@ -67,9 +68,10 @@ def get_process_average(raplfiles, multiple_cpus):
return file.process_average
return -1
def get_baseline_average(raplfiles, multiple_cpus):
total = 0
if multiple_cpus:
for file in raplfiles:
if file.name.contains("CPU"):
if "CPU" in file.name:
total+= file.baseline_average
return total
else:
Expand All @@ -82,7 +84,7 @@ def get_total(raplfiles, multiple_cpus):
total = 0
if multiple_cpus:
for file in raplfiles:
if file.name.contains("CPU"):
if "CPU" in file.name:
total+= file.recent
return total
else:
Expand Down Expand Up @@ -133,7 +135,7 @@ def measure_files(files, delay = 1):
return files


def reformat(name):
def reformat(name, multiple_cpus):
""" Renames the RAPL files for better readability/understanding """
if 'package' in name:
if multiple_cpus:
Expand Down Expand Up @@ -161,8 +163,9 @@ def get_files():
cpu_count = 0
multiple_cpus = False
for file in files:
if (re.search("intel-rapl:.", file)):
if (re.fullmatch("intel-rapl:.", file)):
cpu_count += 1

if cpu_count > 1:
multiple_cpus = True

Expand Down

0 comments on commit 85fd783

Please sign in to comment.