Skip to content

Commit 6c7722e

Browse files
committed
Added README instructions for energibridge profiler.
1 parent ff1b875 commit 6c7722e

File tree

2 files changed

+35
-20
lines changed

2 files changed

+35
-20
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# `EnergiBridge` profiler
2+
3+
A simple Linux example, that runs a python program and measures its CPU usage
4+
and power consumption using [EnergiBridge](https://github.com/tdurieux/EnergiBridge)
5+
6+
As an example program, a simple program is used that repeatedly checks
7+
if random numbers are prime or not.
8+
9+
## Requirements
10+
11+
[EnergiBridge](https://github.com/tdurieux/EnergiBridge) is assumed to be already installed.
12+
13+
To install EnergiBridge, please follow the instructions on their GitHub repo.
14+
15+
16+
## Running
17+
18+
From the root directory of the repo, run the following command:
19+
20+
```bash
21+
python experiment-runner/ examples/energibridge-profiling/RunnerConfig.py
22+
```
23+
24+
## Results
25+
26+
The results are generated in the `examples/energibridge-profiling/experiments` folder.
27+

examples/energibridge-profiling/RunnerConfig.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ def create_run_table_model(self) -> RunTableModel:
6161
sampling_factor = FactorModel("sampling", [10, 50, 100, 200, 500, 1000])
6262
self.run_table_model = RunTableModel(
6363
factors = [sampling_factor],
64-
data_columns=['avg_cpu_usage_0', 'package_energy']
64+
data_columns=['dram_energy', 'package_energy',
65+
'pp0_energy', 'pp1_energy']
66+
6567
)
6668
return self.run_table_model
6769

@@ -79,17 +81,7 @@ def start_run(self, context: RunnerContext) -> None:
7981
"""Perform any activity required for starting the run here.
8082
For example, starting the target system to measure.
8183
Activities after starting the run should also be performed here."""
82-
83-
#cpu_limit = context.run_variation['cpu_limit']
84-
85-
# start the target
86-
#self.target = subprocess.Popen(['python', './primer.py'],
87-
# stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.ROOT_DIR,
88-
#)
89-
90-
# Configure the environment based on the current variation
91-
#subprocess.check_call(shlex.split(f'cpulimit -b -p {self.target.pid} --limit {cpu_limit}'))
92-
84+
pass
9385

9486
def start_measurement(self, context: RunnerContext) -> None:
9587
"""Perform any activity required for starting measurements."""
@@ -116,16 +108,11 @@ def interact(self, context: RunnerContext) -> None:
116108

117109
def stop_measurement(self, context: RunnerContext) -> None:
118110
"""Perform any activity here required for stopping measurements."""
119-
120-
#os.kill(self.profiler.pid, signal.SIGINT) # graceful shutdown of energibridge
121111
self.profiler.wait()
122112

123113
def stop_run(self, context: RunnerContext) -> None:
124114
"""Perform any activity here required for stopping the run.
125115
Activities after stopping the run should also be performed here."""
126-
127-
#self.target.kill()
128-
#self.target.wait()
129116
pass
130117

131118
def populate_run_data(self, context: RunnerContext) -> Optional[Dict[str, Any]]:
@@ -134,11 +121,12 @@ def populate_run_data(self, context: RunnerContext) -> Optional[Dict[str, Any]]:
134121
Returns a dictionary with keys `self.run_table_model.data_columns` and their values populated"""
135122

136123
# energibridge.csv - Power consumption of the whole system
137-
# energibridge.csv-PID.csv - Power consumption of that specific process
138124
df = pd.read_csv(context.run_dir / f"energibridge.csv")
139125
run_data = {
140-
'avg_cpu_usage_0': round(df['CPU_USAGE_0'].sum(), 3),
141-
'package_energy': round(df['PACKAGE_ENERGY (J)'].sum(), 3),
126+
'dram_energy' : round(df['DRAM_ENERGY (J)'].sum(), 3),
127+
'package_energy': round(df['PACKAGE_ENERGY (J)'].sum(), 3),
128+
'pp0_energy' : round(df['PP0_ENERGY (J)'].sum(), 3),
129+
'pp1_energy' : round(df['PP1_ENERGY (J)'].sum(), 3),
142130
}
143131
return run_data
144132

0 commit comments

Comments
 (0)