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
9 changes: 8 additions & 1 deletion gprofiler/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def jattach_path() -> str:
return resource_path("java/jattach")


@functools.lru_cache(maxsize=1)
def get_ap_version() -> str:
return Path(resource_path("java/async-profiler-version")).read_text()


class AsyncProfiledProcess:
"""
Represents a process profiled with async-profiler.
Expand All @@ -73,7 +78,9 @@ def __init__(self, process: Process, storage_dir: str):
# multiple times into the process)
# without depending on storage_dir here, we maintain the same path even if gProfiler is re-run,
# because storage_dir changes between runs.
self._ap_dir = os.path.join(TEMPORARY_STORAGE_PATH, "async-profiler")
# we embed the async-profiler version in the path, so future gprofiler versions which use another version
# of AP case use it (will be loaded as a different DSO)
self._ap_dir = os.path.join(TEMPORARY_STORAGE_PATH, f"async-profiler-{get_ap_version()}")
self._ap_dir_host = resolve_proc_root_links(self._process_root, self._ap_dir)

self._libap_path_host = os.path.join(self._ap_dir_host, "libasyncProfiler.so")
Expand Down
11 changes: 10 additions & 1 deletion scripts/async_profiler_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@
#
set -euo pipefail

git clone --depth 1 -b v2.0g3 https://github.com/Granulate/async-profiler.git && cd async-profiler && git reset --hard 51447a849d686e899c1cd393e83f0f7c41685d95
VERSION=v2.0g3
OUTPUT=async-profiler-2.0-linux-x64.tar.gz

git clone --depth 1 -b "$VERSION" https://github.com/Granulate/async-profiler.git && cd async-profiler && git reset --hard 51447a849d686e899c1cd393e83f0f7c41685d95
make release

# add a version file to the build directory
echo -n "$VERSION" > async-profiler-version
gunzip "$OUTPUT"
tar -rf "${OUTPUT%.gz}" --transform s,^,async-profiler-2.0-linux-x64/build/, async-profiler-version
gzip "${OUTPUT%.gz}"