Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneTR committed Jan 1, 2025
1 parent 0cce865 commit fdf7f03
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion metric_providers/cpu/energy/rapl/msr/component/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, resolution, skip_check=False):
metric_name='cpu_energy_rapl_msr_component',
metrics={'time': int, 'value': int, 'package_id': str},
resolution=resolution,
unit='mJ',
unit='uJ',
current_dir=os.path.dirname(os.path.abspath(__file__)),
skip_check=skip_check,
)
Expand Down
6 changes: 3 additions & 3 deletions metric_providers/cpu/energy/rapl/msr/component/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ static void rapl_msr(int measurement_mode) {
if(energy_output>=0) {
gettimeofday(&now, NULL);
if (measurement_mode == MEASURE_ENERGY_PKG) {
printf("%ld%06ld %ld Package_%d\n", now.tv_sec, now.tv_usec, (long int)(energy_output*1000), k);
printf("%ld%06ld %lld Package_%d\n", now.tv_sec, now.tv_usec, (long long)energy_output, k);
} else if (measurement_mode == MEASURE_DRAM) {
printf("%ld%06ld %ld DRAM_%d\n", now.tv_sec, now.tv_usec, (long int)(energy_output*1000), k);
printf("%ld%06ld %lld DRAM_%d\n", now.tv_sec, now.tv_usec, (long long)energy_output, k);
} else if (measurement_mode == MEASURE_PSYS) {
printf("%ld%06ld %ld PSYS_%d\n", now.tv_sec, now.tv_usec, (long int)(energy_output*1000), k);
printf("%ld%06ld %lld PSYS_%d\n", now.tv_sec, now.tv_usec, (long long)energy_output, k);
}
}
/*
Expand Down
2 changes: 1 addition & 1 deletion metric_providers/psu/energy/ac/mcp/machine/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _parse_metrics(self, df):
df.dropna(inplace=True)

df['interval'] = intervals # in microseconds
df['value'] = df.apply(lambda x: x['value'] * x['interval'] / 1_000_00, axis=1) # value is in centiwatts, so divide by 1_000_00 instead of 1_000 as we would do for Watts
df['value'] = df.apply(lambda x: x['value'] * x['interval'] / 1_00, axis=1) # value is in centiwatts (1/100 W), so divide by 1_00 instead of 1 as we would do for Watts to get micro-Joules
df['value'] = df.value.astype(int)

df = df.drop(columns='interval') # clean up
Expand Down

0 comments on commit fdf7f03

Please sign in to comment.