Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
slicklash committed Oct 25, 2024
1 parent 2a18cf5 commit 58788cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions gprofiler/utils/perf_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from psutil import Process

from gprofiler.exceptions import CalledProcessError
from gprofiler.log import get_logger_adapter
from gprofiler.utils import (
reap_process,
Expand Down Expand Up @@ -189,11 +190,17 @@ def wait_and_script(self) -> str:
perf_data.unlink()
perf_data = inject_data

perf_script_proc = run_process(
[perf_path(), "script", "-F", "+pid,+symline", "-i", str(perf_data)],
suppress_log=True,
)
return perf_script_proc.stdout.decode("utf8")
try:
perf_script_proc = run_process(
[perf_path(), "script", "-F", "+pid,+symline", "-i", str(perf_data)],
suppress_log=True,
)
return perf_script_proc.stdout.decode("utf8")
except CalledProcessError as e:
# ignore addr2line errors
if isinstance(e.stderr, str) and e.stderr.startswith("addr2line"):
return e.stdout.decode("utf8") if isinstance(e.stdout, bytes) else str(e.stdout)
raise
finally:
perf_data.unlink()
if self._inject_jit:
Expand Down
2 changes: 1 addition & 1 deletion tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ fi
python3 -m pip install -q --upgrade setuptools pip
python3 -m pip install -r ./requirements.txt -r ./exe-requirements.txt -r ./dev-requirements.txt
# TODO: python3 -m pip install .
sudo env "PATH=$PATH" python3 -m pytest -v tests/ "$@"
sudo -E env "PATH=$PATH" python3 -m pytest -v tests/ "$@"

0 comments on commit 58788cb

Please sign in to comment.