Skip to content

Commit

Permalink
Small clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
vulder committed Oct 20, 2023
1 parent 3e97822 commit 9c3581e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 2 additions & 3 deletions tests/report/test_linux_perf_report.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Test LinuxPerfReport."""

import unittest
import unittest.mock as mock
from datetime import timedelta
from pathlib import Path
from unittest import mock

from varats.report.linux_perf_report import LinuxPerfReport

Expand Down Expand Up @@ -40,7 +39,7 @@
PERF_REPORT_2 = """# started on Sun Jul 23 22:44:31 2023
Performance counter stats for '/home/vulder/vara-root/benchbuild/results/GenBBBaselineO/SynthSAContextSensitivity-perf_tests@a8c3a8722f,0/SynthSAContextSensitivity/build/bin/ContextSense --compress --mem 10 8':
Performance counter stats for 'foobar':
1.23 msec task-clock:u # 0.000 CPUs utilized
0 context-switches:u # 0.000 /sec
Expand Down
10 changes: 2 additions & 8 deletions varats-core/varats/report/linux_perf_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
command = sleep["2"]
perf("stat", "-x", "';'", "-o", f"{report_file}", "--", command)
"""
import csv
import math
import typing as tp
from pathlib import Path
Expand All @@ -45,10 +44,6 @@ def __init__(self, path: Path) -> None:
if line == "" or line.startswith("#"):
continue

# TODO: impl cmd
# if line.startswith("Performance counter"):
# print(f"CMD: {line}")

if "time elapsed" in line:
self.__elapsed_time = self.__parse_elapsed_time(line)

Expand All @@ -70,10 +65,9 @@ def __parse_ctx_switches(line: str) -> int:
return int(line.split(" ")[0].replace(",", ""))

@staticmethod
def __parse_branch_misses(line: str) -> int:
# TODO: fix return type
def __parse_branch_misses(line: str) -> tp.Optional[int]:
if line.startswith("<not counted>"):
return np.NaN
return None
return int(line.split(" ")[0].replace(",", ""))

@property
Expand Down

0 comments on commit 9c3581e

Please sign in to comment.