Skip to content

Commit a0d8de3

Browse files
committed
docs(getting-started): Pretty print improvement and start.py update
1 parent 9819bbf commit a0d8de3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/script/getting_started/pretty_print.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def start_pretty_print():
1313

1414
directory = './csv'
1515

16-
print("The consumption are given in Watt, note that the precision depend on the value given in the configuration file (the base CPU frequence, the CPU TDP, ...) ")
16+
print("\nThe consumptions are given in Watt, note that the precision depend on the value given in the configuration file (the base CPU frequence, the CPU TDP, ...) \n")
1717

1818
# Get all the csv power report in the csv directory
1919
for dirpath, dirnames, filenames in os.walk(directory):
@@ -44,14 +44,21 @@ def start_pretty_print():
4444
max_consumption = max(consumptions)
4545
min_consumption = min(consumptions)
4646

47-
result.append([target, f"{avg_consumption:.2f}", f"{max_consumption:.2f}", f"{min_consumption:.2f}"])
47+
if not target == 'global':
48+
result.append([target, f"{avg_consumption:.2f}", f"{max_consumption:.2f}", f"{min_consumption:.2f}"])
49+
else:
50+
total = [avg_consumption, max_consumption, min_consumption]
4851

4952
print(f"{'Cgroup':<20} {'Average consumption':<20} {'Maximum consumption':<20} {'Minimum consumption':<20}")
5053
print("=" * 80)
5154

5255
for row in result[1:]:
5356
print(f"{row[0]:<20} {row[1]:<20} {row[2]:<20} {row[3]:<20}")
5457

58+
print("=" * 80)
59+
print(f"{'Global':<20} {total[0]:<20.2f} {total[1]:<20.2f} {total[2]:<20.2f}")
60+
61+
print("\nIf you want to get a more precise evaluation, we encourage you to read the documentation of PowerAPI and adapte the sensor and formula configuration file in consequence \n")
5562

5663
if __name__ == '__main__':
5764
start_pretty_print()

docs/script/getting_started/start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def start_demo():
101101

102102
print("The demo has ended, "
103103
"you can see the result under the /csv directory"
104-
" or use 'python pretty_print.py' "
104+
" or use 'python3 pretty_print.py' "
105105
"to get a quick summary of the result in the terminal")
106106

107107

0 commit comments

Comments
 (0)