Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .azure-pipelines/steps/update-github-pipeline-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ stages:
- integration_tests_linux_debugger
- profiler_integration_tests_windows
- profiler_integration_tests_linux
- profiler_integration_tests_arm64
- asan_profiler_tests
- ubsan_profiler_tests
- tsan_profiler_tests
Expand Down Expand Up @@ -118,6 +119,7 @@ stages:
in(dependencies.integration_tests_linux_debugger.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_windows.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_linux.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_arm64.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.asan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.ubsan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.tsan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
Expand Down Expand Up @@ -209,6 +211,7 @@ stages:
- integration_tests_linux_debugger
- profiler_integration_tests_windows
- profiler_integration_tests_linux
- profiler_integration_tests_arm64
- asan_profiler_tests
- ubsan_profiler_tests
- tsan_profiler_tests
Expand Down Expand Up @@ -288,6 +291,7 @@ stages:
in(dependencies.integration_tests_linux_debugger.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_windows.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_linux.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.profiler_integration_tests_arm64.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.asan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.ubsan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
in(dependencies.tsan_profiler_tests.result, 'Succeeded','SucceededWithIssues','Skipped'),
Expand Down
101 changes: 101 additions & 0 deletions .azure-pipelines/ultimate-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2905,6 +2905,107 @@ stages:
testResultsFiles: profiler/build_data/results/**/*.trx
condition: succeededOrFailed()

- stage: profiler_integration_tests_arm64
condition: >
and(
succeeded(),
or(
eq(variables.isMainOrReleaseBranch, true),
eq(dependencies.generate_variables.outputs['generate_variables_job.generate_variables_step.IsProfilerChanged'], 'True')
)
)
dependsOn: [package_arm64, generate_variables, merge_commit_id]
variables:
targetShaId: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.sha']]
targetBranch: $[ stageDependencies.merge_commit_id.fetch.outputs['set_sha.branch']]
jobs:
- template: steps/update-github-status-jobs.yml
parameters:
jobs: [Test]

- job: Test
timeoutInMinutes: 60 #default value
strategy:
matrix:
arm64:
baseImage: debian
artifactSuffix: linux-arm64
alpine:
baseImage: alpine
artifactSuffix: linux-musl-arm64

variables:
IncludeMinorPackageVersions: $[eq(variables.perform_comprehensive_testing, 'true')]

pool:
name: $(linuxArm64Pool)

steps:
- template: steps/clone-repo.yml
parameters:
targetShaId: $(targetShaId)
targetBranch: $(targetBranch)

- template: steps/restore-working-directory.yml
parameters:
artifact: build-$(artifactSuffix)-working-directory

- template: steps/download-artifact.yml
parameters:
artifact: linux-monitoring-home-$(artifactSuffix)
path: $(monitoringHome)

- template: steps/download-artifact.yml
parameters:
artifact: linux-profiler-symbols-$(artifactSuffix)
path: $(monitoringHome)

- template: steps/run-in-docker.yml
parameters:
build: true
baseImage: $(baseImage)
command: "BuildProfilerSamples"
apiKey: $(DD_LOGGER_DD_API_KEY)
retryCountForRunCommand: 3

- template: steps/run-in-docker.yml
parameters:
baseImage: $(baseImage)
command: "BuildAndRunProfilerCpuLimitTests"
extraArgs: "--cpus 2 --env CONTAINER_CPUS=1"
apiKey: $(DD_LOGGER_DD_API_KEY)
retryCountForRunCommand: 3

- template: steps/run-in-docker.yml
parameters:
baseImage: $(baseImage)
command: "BuildAndRunProfilerCpuLimitTests"
extraArgs: "--cpus 0.5 --env CONTAINER_CPUS=0.5"
apiKey: $(DD_LOGGER_DD_API_KEY)
retryCountForRunCommand: 3

- script: |
docker-compose -f docker-compose.yml -p $(DockerComposeProjectName) \
run --rm \
-e baseImage=$(baseImage) \
ProfilerIntegrationTests
displayName: docker-compose run --no-deps ProfilerIntegrationTests
env:
DD_LOGGER_DD_API_KEY: $(ddApiKey)
baseImage: $(baseImage) # for interpolation in the docker-compose file

- publish: profiler/build_data
artifact: _$(System.StageName)_$(Agent.JobName)_logs_$(System.JobAttempt)
condition: always()
continueOnError: true

- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFormat: VSTest
testResultsFiles: profiler/build_data/results/**/*.trx
condition: succeededOrFailed()

- stage: asan_profiler_tests
#address sanitizer tests
condition: >
Expand Down
Empty file added BUILDME
Empty file.
4 changes: 2 additions & 2 deletions build/cmake/FindLibunwind.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SET(LIBUNWIND_VERSION "v1.8.1-custom-2")
SET(LIBUNWIND_VERSION "v1.8.1-custom-3")

SET(LIBUNWIND_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libunwind-prefix/src/libunwind-build)

ExternalProject_Add(libunwind
GIT_REPOSITORY https://github.com/DataDog/libunwind.git
GIT_TAG kevin/v1.8.1-custom-2
GIT_TAG gleocadie/v1.8.1-custom-3
GIT_PROGRESS true
INSTALL_COMMAND ""
UPDATE_COMMAND ""
Expand Down
5 changes: 3 additions & 2 deletions profiler/src/Demos/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Expand All @@ -7,7 +7,8 @@
<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' != 'Arm64'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' == 'Arm64'">net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>

<!-- Hide warnings for EOL .NET Core targets (e.g. netcoreapp3.0) -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' != 'Arm64'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' == 'Arm64'">net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>

<!--This is required for smoke test assembly discovery-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' != 'Arm64'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT' And '$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)' == 'Arm64'">net6.0;net7.0;net8.0;net9.0;net10.0</TargetFrameworks>
<RootNamespace>Samples.Website_AspNetCore01</RootNamespace>
<Platforms>AnyCPU;x64;x86</Platforms>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,36 @@ pid_t fork()
}
#endif
#endif

static int (*__real_sigaction)(int signum, const struct sigaction* act, struct sigaction* oldact) = NULL;
static int (*__real_pthread_sigmask)(int how, const sigset_t *set, sigset_t *oldset) = NULL;

int sigaction(int signum, const struct sigaction* act, struct sigaction* oldact)
{
check_init();
if (signum == SIGSEGV && act != NULL)
{
struct sigaction new_act = *act;
sigaddset(&new_act.sa_mask, SIGPROF);
sigaddset(&new_act.sa_mask, SIGUSR1);
return __real_sigaction(signum, &new_act, oldact);
}
return __real_sigaction(signum, act, oldact);
}

int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
{
check_init();
if (how == SIG_UNBLOCK && set != NULL && 1 == sigismember(set, SIGSEGV))
{
sigset_t new_set = *set;
sigaddset(&new_set, SIGPROF);
sigaddset(&new_set, SIGUSR1);
return __real_pthread_sigmask(how, &new_set, oldset);
}
return __real_pthread_sigmask(how, set, oldset);
}

static pthread_once_t once_control = PTHREAD_ONCE_INIT;

static void init()
Expand All @@ -682,6 +712,8 @@ static void init()
__real_dlclose = __dd_dlsym(RTLD_NEXT, "dlclose");
__real_dladdr = __dd_dlsym(RTLD_NEXT, "dladdr");
__real_execve = __dd_dlsym(RTLD_NEXT, "execve");
__real_sigaction = __dd_dlsym(RTLD_NEXT, "sigaction");
__real_pthread_sigmask = __dd_dlsym(RTLD_NEXT, "pthread_sigmask");
#ifdef DD_ALPINE
__real_pthread_create = __dd_dlsym(RTLD_NEXT, "pthread_create");
__real_pthread_attr_init = __dd_dlsym(RTLD_NEXT, "pthread_attr_init");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

Backtrace2Unwinder::Backtrace2Unwinder() = default;

std::int32_t Backtrace2Unwinder::Unwind(void* ctx, std::uintptr_t* buffer, std::size_t bufferSize) const
std::int32_t Backtrace2Unwinder::Unwind(void* ctx, std::uintptr_t* buffer, std::size_t bufferSize,
std::uintptr_t stackBase, std::uintptr_t stackEnd) const
{
// unw_backtrace2 handles the case ctx == nullptr
auto* context = reinterpret_cast<unw_context_t*>(ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Backtrace2Unwinder : public IUnwinder
~Backtrace2Unwinder() override = default;

// Returns the number of frames unwound
std::int32_t Unwind(void* ctx, std::uintptr_t* buffer, std::size_t bufferSize) const override;
std::int32_t Unwind(void* ctx, std::uintptr_t* buffer, std::size_t bufferSize,
std::uintptr_t stackBase = 0, std::uintptr_t stackEnd = 0) const override;

};
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${DEPLOY_DIR})

FILE(GLOB LINUX_PROFILER_SRC CONFIGURE_DEPENDS "*.cpp")

if (ISARM64)
list(REMOVE_ITEM LINUX_PROFILER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/Backtrace2Unwinder.cpp")
else()
list(REMOVE_ITEM LINUX_PROFILER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/HybridUnwinder.cpp")
endif()

FILE(GLOB COMMON_PROFILER_SRC LIST_DIRECTORIES false "../Datadog.Profiler.Native/*.cpp")
FILE(GLOB EXCLUDE_DLLMAIN "../Datadog.Profiler.Native/DllMain.cpp")

Expand Down
Loading
Loading