Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
slicklash committed Oct 8, 2024
1 parent 17a30ac commit b561e25
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gprofiler/profilers/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,6 @@ def _check_async_profiler_loaded(self, process: Process) -> bool:
def _profile_process(self, process: Process, duration: int, spawned: bool) -> ProfileData:
comm = process_comm(process)
exe = process_exe(process)
container_name = self._profiler_state.get_container_name(process.pid)
java_version_output: Optional[str] = get_java_version_logged(process, self._profiler_state.stop_event)

if self._enabled_proc_events_java:
Expand Down Expand Up @@ -1260,6 +1259,7 @@ def _profile_process(self, process: Process, duration: int, spawned: bool) -> Pr
self._profiled_pids.add(process.pid)

logger.info(f"Profiling{' spawned' if spawned else ''} process {process.pid} with async-profiler")
container_name = self._profiler_state.get_container_name(process.pid)
app_metadata = self._metadata.get_metadata(process)
appid = application_identifiers.get_java_app_id(process, self._collect_spark_app_name)

Expand Down
3 changes: 1 addition & 2 deletions gprofiler/profilers/php.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ def extract_metadata_section(re_expr: Pattern, metadata_line: str) -> str:
if profiler_state.processes_to_profile is not None:
if pid not in [process.pid for process in profiler_state.processes_to_profile]:
continue
container_name = profiler_state.get_container_name(pid)
# TODO: appid & app metadata for php!
appid = None
app_metadata = None
profiles[pid] = ProfileData(results[pid], appid, app_metadata, container_name)
profiles[pid] = ProfileData(results[pid], appid, app_metadata, profiler_state.get_container_name(pid))

return profiles

Expand Down
2 changes: 1 addition & 1 deletion gprofiler/profilers/python_ebpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ def snapshot(self) -> ProcessToProfileData:
if self._profiler_state.processes_to_profile is not None:
if process not in self._profiler_state.processes_to_profile:
continue
container_name = self._profiler_state.get_container_name(pid)
appid = application_identifiers.get_python_app_id(process)
app_metadata = self._metadata.get_metadata(process)
container_name = self._profiler_state.get_container_name(pid)
except NoSuchProcess:
appid = None
app_metadata = None
Expand Down
3 changes: 2 additions & 1 deletion gprofiler/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,10 @@ def pgrep_maps(match: str) -> List[Process]:
# this is much faster than iterating over processes' maps with psutil.
# We use flag -E in grep to support systems where grep is not PCRE
result = run_process(
["sh", "-c", f"grep -lE '{match}' /proc/*/maps"],
f"grep -lE '{match}' /proc/*/maps",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
suppress_log=True,
check=False,
pdeathsigger=False,
Expand Down

0 comments on commit b561e25

Please sign in to comment.