Skip to content

Migrate cpu-usage-over-time.py to Python 3 #86907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/ci/cpu-usage-over-time.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# ignore-tidy-linelength

# This is a small script that we use on CI to collect CPU usage statistics of
Expand Down Expand Up @@ -37,7 +37,10 @@
import sys
import time

if sys.platform == 'linux2':
# Python 3.3 changed the value of `sys.platform` on Linux from "linux2" to just
# "linux". We check here with `.startswith` to keep compatibility with older
# Python versions (especially Python 2.7).
if sys.platform.startswith('linux'):
class State:
def __init__(self):
with open('/proc/stat', 'r') as file:
Expand Down
2 changes: 1 addition & 1 deletion src/ci/scripts/collect-cpu-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
set -euo pipefail
IFS=$'\n\t'

python src/ci/cpu-usage-over-time.py &> cpu-usage.csv &
python3 src/ci/cpu-usage-over-time.py &> cpu-usage.csv &