Skip to content
Merged
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
16 changes: 6 additions & 10 deletions flow/util/genMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,14 @@ def extractGnuTime(prefix, jsonFile, file):
#
def read_sdc(file_name):
clkList = []
sdcFile = None

try:
sdcFile = open(file_name, "r")
except IOError:
print("[WARN] Failed to open file:", file_name)
with open(file_name, "r") as sdcFile:
lines = sdcFile.readlines()
except OSError as e:
print(f"[WARN] Failed to open file: {file_name} ({e})")
return clkList

lines = sdcFile.readlines()
sdcFile.close()

for line in lines:
if len(line.split()) < 2:
continue
Expand Down Expand Up @@ -185,10 +182,9 @@ def is_git_repo(folder=None):
def merge_jsons(root_path, output, files):
paths = sorted(glob(os.path.join(root_path, files)))
for path in paths:
file = open(path, "r")
data = json.load(file)
with open(path, "r") as file:
data = json.load(file)
output.update(data)
file.close()


def extract_metrics(
Expand Down