Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! add new Tracer engine based on the PIN fr…
Browse files Browse the repository at this point in the history
…amework
  • Loading branch information
PeterMocary committed Aug 1, 2024
1 parent dbee67d commit af7f366
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
9 changes: 6 additions & 3 deletions perun/collect/trace/pin/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,15 @@ def assemble_collect_program(self, **kwargs) -> None:
run_safely_external_command(f"make -C {get_tmp_directory()}")
msg_to_stdout("[Debug]: The pintool is built.", 3)

def collect(self, config, **kwargs: Dict[str, Any]) -> None:
def collect(self, **kwargs: Dict[str, Any]) -> None:
"""Collect the raw performance data using the assembled pintool.
:param Configuration config: the configuration object
:raises PinBinaryInstrumentationFailed: execution of pin with generated pintool failed
"""
msg_to_stdout("[Info]: Collecting the performance data.", 2)
config = kwargs["config"]
collection_cmd: str = (
f"{self.__pin_root}/pin "
f"-t {get_tmp_directory()}/obj-intel64/pintool.so "
Expand All @@ -174,14 +175,15 @@ def collect(self, config, **kwargs: Dict[str, Any]) -> None:
except subprocess.CalledProcessError:
raise PinBinaryInstrumentationFailed

def transform(self, config, **kwargs) -> Generator[Dict[str, Union[str, int]], None, None]:
def transform(self, **kwargs) -> Generator[Dict[str, Union[str, int]], None, None]:
"""Transform the raw performance data into a resources as used in the profiles.
:param Configuration config: the configuration object
:return iterable: a generator object that produces the resources
"""
msg_to_stdout("[Info]: Transforming the collected data to perun profile.", 2)
config = kwargs["config"]

# Transform function information from DWARF debug info into a map based on name
function_arguments_map = {}
Expand Down Expand Up @@ -222,12 +224,13 @@ def transform(self, config, **kwargs) -> Generator[Dict[str, Union[str, int]], N

return dynamic_parser.parse_dynamic_data_file()

def cleanup(self, config, **kwargs: Dict[str, Any]) -> None:
def cleanup(self, **kwargs: Dict[str, Any]) -> None:
"""Cleans up all the engine-related resources such as files, processes, locks, etc.
:param Configuration config: collection parameters
"""
msg_to_stdout("[Info]: Cleaning up.", 2)
config = kwargs["config"]
if os.path.exists(f"{get_tmp_directory()}/obj-intel64"):
msg_to_stdout("[Debug]: Removing the built pintool.", 3)
run_safely_external_command(f"make -C {get_tmp_directory()} clean-obj-intel64")
Expand Down
8 changes: 4 additions & 4 deletions perun/collect/trace/pin/parse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .parser import PinStaticOutputParser, PinDynamicOutputParser, ProgramData
from .time_parser import PinTimeOutputParser
from .instructions_parser import PinInstructionOutputParser
from .memory_parser import PinMemoryOutputParser
from .parser import PinStaticOutputParser, PinDynamicOutputParser, ProgramData # noqa: F401
from .time_parser import PinTimeOutputParser # noqa: F401
from .instructions_parser import PinInstructionOutputParser # noqa: F401
from .memory_parser import PinMemoryOutputParser # noqa: F401
4 changes: 2 additions & 2 deletions perun/collect/trace/pin/parse/time_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def parse_dynamic_data_file(self) -> Generator[Dict[str, Union[str, int]], None,

if self.basic_block_backlog:
msg_to_stdout(
f"[DEBUG]: Basic blocks backlog contains "
"{len(self.basic_block_backlog)} unpaired entries.",
"[DEBUG]: Basic blocks backlog contains "
f"{len(self.basic_block_backlog)} unpaired entries.",
3,
)

Expand Down
1 change: 0 additions & 1 deletion perun/collect/trace/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import perun.logic.runner as runner
import perun.utils.log as stdout
import perun.utils.metrics as metrics
import perun.utils as utils
from perun.profile.factory import Profile
from perun.utils.structs import CollectStatus

Expand Down
1 change: 0 additions & 1 deletion perun/profile/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

# Third-Party Imports
import click
import re

# Perun Imports
from perun.logic import config
Expand Down

0 comments on commit af7f366

Please sign in to comment.