Skip to content

Commit

Permalink
check if platform is linux for iowait
Browse files Browse the repository at this point in the history
  • Loading branch information
kareefardi committed Oct 24, 2023
1 parent b50cbe0 commit a2803c0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions openlane/steps/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import subprocess
import textwrap
import time
import sys

from signal import Signals
from inspect import isabstract
Expand Down Expand Up @@ -131,11 +132,10 @@ def __init__(self, process: psutil.Popen, interval: float = 0.1):
self.process = process
self.result = None
self.interval = interval
self.time = {
"cpu_time_user": 0.0,
"cpu_time_system": 0.0,
"cpu_time_iowait": 0.0,
}
self.time = {"cpu_time_user": 0.0, "cpu_time_system": 0.0}
if sys.platform == "linux":
self.time["cpu_time_iowait"] = 0.0

self.peak_resources = {
"cpu_percent": 0.0,
"memory_rss": 0.0,
Expand All @@ -161,7 +161,8 @@ def run(self):

self.time["cpu_time_user"] = cpu_time.user
self.time["cpu_time_system"] = cpu_time.system
self.time["cpu_time_iowait"] = cpu_time.iowait # type: ignore
if sys.platform == "linux":
self.time["cpu_time_iowait"] = cpu_time.iowait # type: ignore

current: Dict[str, float] = {}
current["cpu_percent"] = cpu
Expand Down

0 comments on commit a2803c0

Please sign in to comment.