Skip to content

Commit 70c5d76

Browse files
authored
dotnet: Support Aarch64 (#459)
1 parent b4e605d commit 70c5d76

File tree

8 files changed

+26
-22
lines changed

8 files changed

+26
-22
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ARG PERF_BUILDER_UBUNTU=@sha256:d7bb0589725587f2f67d0340edb81fd1fcba6c5f38166639
99
# phpspy - ubuntu:20.04
1010
ARG PHPSPY_BUILDER_UBUNTU=@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93
1111
# dotnet builder - mcr.microsoft.com/dotnet/sdk:6.0-focal
12-
ARG DOTNET_BUILDER_UBUNTU=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
12+
ARG DOTNET_BUILDER=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
1313
# async-profiler glibc build
1414
# requires CentOS 7 so the built DSO can be loaded into machines running with old glibc (tested up to centos:6),
1515
# we do make some modifications to the selected versioned symbols so that we don't use anything from >2.12 (what centos:6
@@ -46,7 +46,7 @@ RUN ./rbspy_build.sh
4646
RUN mv "/tmp/rbspy/target/$(uname -m)-unknown-linux-musl/release/rbspy" /tmp/rbspy/rbspy
4747

4848
# dotnet-trace
49-
FROM mcr.microsoft.com/dotnet/sdk${DOTNET_BUILDER_UBUNTU} as dotnet-builder
49+
FROM mcr.microsoft.com/dotnet/sdk${DOTNET_BUILDER} as dotnet-builder
5050
WORKDIR /tmp
5151
RUN apt-get update && \
5252
dotnet tool install --global dotnet-trace

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ The runtime stacks are then merged into the data collected by `perf`, substituti
380380
| Ruby (rbspy) | :heavy_check_mark: | :heavy_check_mark: |
381381
| PHP (phpspy) | :heavy_check_mark: | :heavy_check_mark: (experimental) |
382382
| NodeJS (perf) | :heavy_check_mark: | :heavy_check_mark: |
383-
| .NET (dotnet-trace) | :heavy_check_mark: (experimental) | :x: |
383+
| .NET (dotnet-trace) | :heavy_check_mark: (experimental) | :heavy_check_mark: (experimental) |
384384

385385
## perf-less mode
386386

gprofiler/profilers/dotnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def make_application_metadata(self, process: Process) -> Dict[str, Any]:
5151
@register_profiler(
5252
"dotnet",
5353
possible_modes=["dotnet-trace", "disabled"],
54-
supported_archs=["x86_64"],
54+
supported_archs=["x86_64", "aarch64"],
5555
default_mode="dotnet-trace",
5656
)
5757
class DotnetProfiler(ProcessProfilerBase):

pyi.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ARG AP_CENTOS_MIN
1111
ARG BURN_BUILDER_GOLANG
1212
ARG GPROFILER_BUILDER
1313
ARG PYPERF_BUILDER_UBUNTU
14-
ARG DOTNET_BUILDER_UBUNTU
14+
ARG DOTNET_BUILDER
1515

1616
# pyspy & rbspy builder base
1717
FROM rust${RUST_BUILDER_VERSION} AS pyspy-rbspy-builder-common
@@ -35,7 +35,7 @@ RUN ./rbspy_build.sh
3535
RUN mv "/tmp/rbspy/target/$(uname -m)-unknown-linux-musl/release/rbspy" /tmp/rbspy/rbspy
3636

3737
# dotnet-trace
38-
FROM mcr.microsoft.com/dotnet/sdk${DOTNET_BUILDER_UBUNTU} as dotnet-builder
38+
FROM mcr.microsoft.com/dotnet/sdk${DOTNET_BUILDER} as dotnet-builder
3939
WORKDIR /tmp
4040
RUN apt-get update && \
4141
dotnet tool install --global dotnet-trace

scripts/build_aarch64_container.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ CENTOS_VERSION=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492430
1515
GOLANG_VERSION=@sha256:f7d3519759ba6988a2b73b5874b17c5958ac7d0aa48a8b1d84d66ef25fa345f1
1616
# alpine 3.14.2
1717
ALPINE_VERSION=@sha256:b06a5cf61b2956088722c4f1b9a6f71dfe95f0b1fe285d44195452b8a1627de7
18+
# mcr.microsoft.com/dotnet/sdk:6.0-focal
19+
DOTNET_BUILDER=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
1820

1921
docker buildx build --platform=linux/arm64 \
2022
--build-arg RUST_BUILDER_VERSION=$RUST_VERSION \
@@ -25,4 +27,5 @@ docker buildx build --platform=linux/arm64 \
2527
--build-arg AP_BUILDER_ALPINE=$ALPINE_VERSION \
2628
--build-arg BURN_BUILDER_GOLANG=$GOLANG_VERSION \
2729
--build-arg GPROFILER_BUILDER_UBUNTU=$UBUNTU_VERSION \
30+
--build-arg DOTNET_BUILDER=$DOTNET_BUILDER \
2831
. $@

scripts/build_aarch64_executable.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ CENTOS8_VERSION=@sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473
1717
GOLANG_VERSION=@sha256:f7d3519759ba6988a2b73b5874b17c5958ac7d0aa48a8b1d84d66ef25fa345f1
1818
# alpine 3.14.2
1919
ALPINE_VERSION=@sha256:b06a5cf61b2956088722c4f1b9a6f71dfe95f0b1fe285d44195452b8a1627de7
20+
# mcr.microsoft.com/dotnet/sdk:6.0-focal
21+
DOTNET_BUILDER=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
2022

2123
mkdir -p build/aarch64
2224
docker buildx build --platform=linux/arm64 \
@@ -29,4 +31,5 @@ docker buildx build --platform=linux/arm64 \
2931
--build-arg AP_CENTOS_MIN=$CENTOS7_VERSION \
3032
--build-arg BURN_BUILDER_GOLANG=$GOLANG_VERSION \
3133
--build-arg GPROFILER_BUILDER=$CENTOS8_VERSION \
34+
--build-arg DOTNET_BUILDER=$DOTNET_BUILDER \
3235
. -f pyi.Dockerfile --output type=local,dest=build/aarch64/ $@

scripts/build_x86_64_executable.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ AP_BUILDER_CENTOS=@sha256:0f4ec88e21daf75124b8a9e5ca03c37a5e937e0e108a255d890492
1616
# async-profiler musl - alpine
1717
AP_BUILDER_ALPINE=@sha256:69704ef328d05a9f806b6b8502915e6a0a4faa4d72018dc42343f511490daf8a
1818
# dotnet builder - mcr.microsoft.com/dotnet/sdk:6.0-focal
19-
DOTNET_BUILDER_UBUNTU=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
19+
DOTNET_BUILDER=@sha256:749439ff7a431ab4bc38d43cea453dff9ae1ed89a707c318b5082f9b2b25fa22
2020
# minimum CentOS version we intend to support with async-profiler (different between x86_64, where we require
2121
# an older version)
2222
AP_CENTOS_MIN=:6
@@ -38,5 +38,5 @@ DOCKER_BUILDKIT=1 docker build -f pyi.Dockerfile --output type=local,dest=build/
3838
--build-arg AP_CENTOS_MIN=$AP_CENTOS_MIN \
3939
--build-arg BURN_BUILDER_GOLANG=$BURN_BUILDER_GOLANG \
4040
--build-arg GPROFILER_BUILDER=$GPROFILER_BUILDER \
41-
--build-arg DOTNET_BUILDER_UBUNTU=$DOTNET_BUILDER_UBUNTU \
41+
--build-arg DOTNET_BUILDER=$DOTNET_BUILDER \
4242
. $@

scripts/dotnet_prepare_dependencies.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Copyright (c) Granulate. All rights reserved.
44
# Licensed under the AGPL3 License. See LICENSE.md in the project root for license information.
55
#
6-
# set -euo pipefail
6+
set -euo pipefail
77

88
declare -a deps=("libclrjit.so"
99
"libhostpolicy.so"
10-
"libcoreclr.so"
10+
"libcoreclr.so"
1111
"libSystem.Native.so"
1212
"Microsoft.CSharp.dll"
1313
"Microsoft.NETCore.App.deps.json"
@@ -34,22 +34,22 @@ declare -a deps=("libclrjit.so"
3434
"System.Linq.Expressions.dll"
3535
"System.Memory.dll"
3636
"System.Private.CoreLib.dll"
37-
"System.Private.Uri.dll"
37+
"System.Private.Uri.dll"
3838
"System.Runtime.dll"
3939
"System.Runtime.Extensions.dll"
40-
"System.Runtime.InteropServices.dll"
41-
"System.Runtime.InteropServices.RuntimeInformation.dll"
40+
"System.Runtime.InteropServices.dll"
41+
"System.Runtime.InteropServices.RuntimeInformation.dll"
4242
"System.Text.RegularExpressions.dll"
43-
"System.Threading.Channels.dll"
43+
"System.Threading.Channels.dll"
4444
"System.Threading.dll"
45-
"System.Threading.Overlapped.dll"
46-
"System.Threading.Tasks.dll"
45+
"System.Threading.Overlapped.dll"
46+
"System.Threading.Tasks.dll"
4747
"System.Threading.Thread.dll"
4848
"System.Threading.ThreadPool.dll"
49-
"System.IO.Pipes.dll"
50-
"System.Net.Sockets.dll"
51-
"System.Net.Primitives.dll"
52-
"System.Security.Principal.dll"
49+
"System.IO.Pipes.dll"
50+
"System.Net.Sockets.dll"
51+
"System.Net.Primitives.dll"
52+
"System.Security.Principal.dll"
5353
"System.IO.dll"
5454
"System.Security.Cryptography.Algorithms.dll"
5555
"System.Security.Cryptography.Primitives.dll"
@@ -65,5 +65,3 @@ for i in "${deps[@]}"
6565
do
6666
cp "/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.7/$i" "/tmp/dotnet/deps/$i"
6767
done
68-
69-

0 commit comments

Comments
 (0)