Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 5 additions & 7 deletions gprofiler/utils/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,18 @@ def discover_appropriate_perf_event(
"sleep",
"0.5",
] # `sleep 0.5` is enough to be certain some samples should've been collected.
# For discovery, we need to ensure we can capture the 'sleep 0.5' command
# When using cgroups, the sleep command won't be in any target cgroup,
# so we use system-wide profiling for discovery regardless of the final mode
discovery_pids = None if use_cgroups else pids
discovery_use_cgroups = False # Always use system-wide for discovery

# For discovery, always use system-wide profiling so that `sleep 0.5` is captured
# regardless of the final profiling mode (pid-based or cgroup-based).
discovery_use_cgroups = False

perf_process = PerfProcess(
frequency=11,
stop_event=stop_event,
output_path=str(tmp_dir / "perf_default_event.fp"),
is_dwarf=False,
inject_jit=False,
extra_args=current_extra_args,
processes_to_profile=discovery_pids,
processes_to_profile=None, # None -> system-wide (-a), placed before -- by _get_perf_cmd
switch_timeout_s=15,
use_cgroups=discovery_use_cgroups,
max_cgroups=max_cgroups,
Expand Down
4 changes: 2 additions & 2 deletions gprofiler/utils/perf_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ def _get_perf_cmd(self) -> List[str]:
"-m",
str(self._MMAP_SIZES[self._type]),
]
+ extra_args # Events must come before cgroups
+ self._pid_args
+ self._pid_args # -a or --pid must come before extra_args which may contain --
Comment thread
artursarlo marked this conversation as resolved.
+ extra_args # Events must come before cgroups; may contain -- cmd for discovery
Comment thread
artursarlo marked this conversation as resolved.
+ self._cgroup_args
+ (["-k", "1"] if self._inject_jit else [])
)
Expand Down
Loading