Skip to content

Commit 8b1ebbf

Browse files
gleocadiechrisnas
andauthored
Move profiler source files into the tracer repository (DataDog#2404)
- Make sure the azure pipelines build the profiler from tracer repository instead of the profiler internal repo. - AzOps and Gitlabs checks Co-authored-by: chrisnas <chrisnas@users.noreply.github.com>
1 parent a9a34c0 commit 8b1ebbf

File tree

859 files changed

+333397
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

859 files changed

+333397
-50
lines changed

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pr:
6565
- tracer/build/_build/Build.GitHub.cs
6666
- tracer/build/_build/Build.Gitlab.cs
6767
- .azure-pipelines/noop-pipeline.yml
68+
- profiler/
6869

6970
schedules:
7071
- cron: "0 3 * * *"
@@ -85,7 +86,6 @@ variables:
8586
relativeArtifacts: /tracer/src/bin/artifacts
8687
ddTracerHome: $(System.DefaultWorkingDirectory)/tracer/src/bin/dd-tracer-home
8788
tracerHome: $(System.DefaultWorkingDirectory)/tracer/src/bin/windows-tracer-home
88-
profilerSrcDirectory: $(System.DefaultWorkingDirectory)/../dd-continuous-profiler-dotnet
8989
profilerHome: $(System.DefaultWorkingDirectory)/profiler/bin/profiler-home # Important, put the profiler assets into the working directory so it can be saved across build stages more easily
9090
monitoringHome: $(System.DefaultWorkingDirectory)/shared/bin/monitoring-home
9191
artifacts: $(System.DefaultWorkingDirectory)/tracer/src/bin/artifacts
@@ -117,11 +117,6 @@ resources:
117117
env:
118118
DD_API_KEY: $(ddApiKey)
119119
DD_INSIDE_CI: true
120-
repositories:
121-
- repository: dd-continuous-profiler-dotnet
122-
type: github
123-
endpoint: DataDog
124-
name: DataDog/dd-continuous-profiler-dotnet
125120

126121
# Stages
127122
stages:
@@ -190,34 +185,6 @@ stages:
190185

191186
- template: steps/install-latest-dotnet-sdk.yml
192187

193-
# workaround for "Unable move and reuse existing repository to required location."
194-
# https://github.com/microsoft/azure-pipelines-yaml/issues/403
195-
- powershell: |
196-
New-Item -Path . -Name "dd-continuous-profiler-dotnet" -ItemType "directory"
197-
displayName: "Create repository folder (workaround)"
198-
199-
- checkout: dd-continuous-profiler-dotnet
200-
path: dd-continuous-profiler-dotnet
201-
202-
- powershell: |
203-
New-Item -Path $(System.DefaultWorkingDirectory)\..\dd-trace-dotnet -ItemType SymbolicLink -Value $(System.DefaultWorkingDirectory)
204-
displayName: Create symlink from $(System.DefaultWorkingDirectory)\..\dd-trace-dotnet to $(System.DefaultWorkingDirectory)
205-
206-
- powershell: |
207-
Write-Host "Attempting to check out ref specified by GIT_PROFILER_REF: '$(GIT_PROFILER_REF)'"
208-
git checkout $(GIT_PROFILER_REF)
209-
workingDirectory: $(System.DefaultWorkingDirectory)\..\dd-continuous-profiler-dotnet
210-
displayName: Checkout GIT_PROFILER_REF
211-
212-
- powershell: |
213-
$sha = git rev-parse --short HEAD
214-
Write-Host "SHA is $sha"
215-
echo "##vso[task.setvariable variable=BetaMsiSuffix;isOutput=true]v$(Build.BuildId)-$sha"
216-
Write-Host "BetaMsiSuffix set to v$(Build.BuildId)-$sha"
217-
workingDirectory: $(System.DefaultWorkingDirectory)\..\dd-continuous-profiler-dotnet
218-
displayName: Persist the commit sha for the dd-continuous-profiler repo (temporary)
219-
name: SetMsiSuffix # because we're going to depend on the variable output, we need to name the step
220-
221188
- script: tracer\build.cmd BuildProfilerHome
222189
displayName: Build profiler home
223190

.gitlab-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ build:
1616
script:
1717
- if (Test-Path build-out) { remove-item -recurse -force build-out }
1818
- if (Test-Path artifacts) { remove-item -recurse -force artifacts }
19-
- Write-Host "Attempting to clone profiler repo with GIT_PROFILER_REF=${GIT_PROFILER_REF}"
20-
- git clone -b ${GIT_PROFILER_REF} https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/dd-continuous-profiler-dotnet.git
2119
- docker run --rm -m 4096M -v "$(Get-Location):c:\mnt" -e CI_JOB_ID=${CI_JOB_ID} -e WINDOWS_BUILDER=true -e AWS_NETWORKING=true -e SIGN_WINDOWS=true 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/windows_1809_x64:$Env:DATADOG_AGENT_WINBUILDIMAGES c:\mnt\tracer\build\_build\gitlab.bat
2220
- mkdir artifacts
2321
- xcopy /e/s build-out\${CI_JOB_ID}\*.* artifacts
@@ -58,4 +56,4 @@ publish:
5856
$i++
5957
Start-Sleep -Milliseconds 100
6058
}
61-
} while ($i -lt 3)
59+
} while ($i -lt 3)

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repository contains the sources for the client-side components of the Datad
44

55
**[Datadog .NET Tracer](https://github.com/DataDog/dd-trace-dotnet/tree/master/tracer)**: A set of .NET libraries that let you trace any piece of your .NET code. It automatically instruments supported libraries out-of-the-box and also supports custom instrumentation to instrument your own code.
66

7-
**[Datadog .NET Continuous Profiler](https://github.com/DataDog/dd-trace-dotnet/tree/master/profiler)**: To be added.
7+
**[Datadog .NET Continuous Profiler](https://github.com/DataDog/dd-trace-dotnet/tree/master/profiler)**: Libraries that automatically profile your application.
88

99
## Downloads
1010

@@ -29,4 +29,4 @@ Copyright (c) 2017 Datadog
2929

3030
## License
3131

32-
See [license information](../LICENSE).
32+
See [license information](../LICENSE).

profiler/.clang-format

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
# Set ColumnLimit to 0, because the behavior is not the same
3+
# ex: splitting arguments on multiple lines.
4+
ColumnLimit: 0
5+
UseTab: Never
6+
IndentWidth: 4
7+
AccessModifierOffset: -4
8+
NamespaceIndentation: Inner
9+
10+
BreakBeforeBraces: Custom
11+
BraceWrapping:
12+
AfterNamespace: false
13+
AfterEnum: true
14+
AfterStruct: true
15+
AfterClass: true
16+
SplitEmptyFunction: true
17+
SplitEmptyRecord: true
18+
AfterControlStatement: true
19+
AfterFunction: true
20+
AfterUnion: true
21+
BeforeElse: true
22+
AfterCaseLabel: true
23+
AfterExternBlock: true
24+
BeforeCatch: true
25+
26+
BreakBeforeTernaryOperators: true
27+
BreakConstructorInitializers: AfterColon
28+
CompactNamespaces: false
29+
AlwaysBreakTemplateDeclarations: true
30+
BreakConstructorInitializersBeforeComma: true
31+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
32+
AllowShortBlocksOnASingleLine: false
33+
AllowShortFunctionsOnASingleLine: false
34+
AllowShortIfStatementsOnASingleLine: true
35+
AllowShortLoopsOnASingleLine: true
36+
PointerAlignment: Left
37+
AlignConsecutiveAssignments: false
38+
AlignTrailingComments: true
39+
SpaceAfterCStyleCast: true
40+
CommentPragmas: '^ NO-FORMAT:'
41+
IndentCaseLabels: true
42+
IndentGotoLabels: true
43+
SpaceAfterCStyleCast: false
44+
45+
# The following doesn't work pre clang-format version 13
46+
#BreakBeforeConceptDeclarations: true
47+
#EmptyLineBeforeAccessModifier: LogicalBlock

profiler/.clang-tidy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
Checks: '-*,readability-*,clang-analyzer-*,cppcoreguidelines-*'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: '.*'
5+
FormatStyle: 'file'

profiler/CMakeLists.txt

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
cmake_minimum_required (VERSION 3.14)
2+
cmake_policy(SET CMP0015 NEW)
3+
4+
# ******************************************************
5+
# Environment detection
6+
# ******************************************************
7+
8+
# Detect operating system
9+
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
10+
message(FATAL_ERROR "Windows builds are not supported using CMAKE. Please use Visual Studio")
11+
SET(ISWINDOWS true)
12+
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
13+
message(STATUS "Preparing Linux build")
14+
SET(ISLINUX true)
15+
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
16+
message(FATAL_ERROR "MACOS builds are not supported yet.")
17+
SET(ISMACOS true)
18+
endif()
19+
20+
# Detect bitness of the build
21+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
22+
message(STATUS "Setting compilation for 64bits processor")
23+
SET(BIT64 true)
24+
endif()
25+
26+
# Detect architecture
27+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
28+
message(STATUS "Architecture is x64/AMD64")
29+
SET(ISAMD64 true)
30+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL x86 OR CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
31+
message(STATUS "Architecture is x86")
32+
SET(ISX86 true)
33+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
34+
message(STATUS "Architecture is ARM64")
35+
SET(ISARM64 true)
36+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
37+
message(STATUS "Architecture is ARM")
38+
SET(ISARM true)
39+
endif()
40+
41+
# Out of source build directory
42+
SET(OUTPUT_BUILD_DIR ${CMAKE_SOURCE_DIR}/../_build)
43+
44+
SET(DOTNET_TRACER_REPO_ROOT_PATH ${CMAKE_SOURCE_DIR}/../dd-trace-dotnet)
45+
46+
if (BIT64)
47+
SET(ARCH_POSTFIX "x64")
48+
else()
49+
SET(ARCH_POSTFIX "x86")
50+
endif()
51+
52+
if (DEFINED RUN_ANALYSIS AND NOT RUN_ANALYSIS EQUAL 0)
53+
SET(CMAKE_EXPORT_COMPILE_COMMANDS 1)
54+
endif()
55+
56+
# ******************************************************
57+
# Detect prerequisites
58+
# ******************************************************
59+
60+
if (NOT EXISTS /usr/bin/clang)
61+
message(FATAL_ERROR "CLANG is required to build the project")
62+
else()
63+
message(STATUS "CLANG was found")
64+
endif()
65+
66+
if (NOT EXISTS /usr/bin/clang++)
67+
message(FATAL_ERROR "CLANG++ is required to build the project")
68+
else()
69+
message(STATUS "CLANG++ was found")
70+
endif()
71+
72+
if (NOT EXISTS /usr/bin/git)
73+
message(FATAL_ERROR "GIT is required to build the project")
74+
else()
75+
message(STATUS "GIT was found")
76+
endif()
77+
78+
if (DEFINED RUN_ANALYSIS AND RUN_ANALYSIS EQUAL 1)
79+
if (NOT EXISTS /usr/bin/clang-tidy)
80+
message(FATAL_ERROR "clang-tidy is required to build the project")
81+
else()
82+
message(STATUS "clang-tidy was found")
83+
endif()
84+
endif()
85+
86+
# ******************************************************
87+
# Output folders
88+
# ******************************************************
89+
90+
# Set output folders
91+
SET(OUTPUT_TMP_DIR ${CMAKE_BINARY_DIR}/tmp.${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
92+
SET(OUTPUT_DEPS_DIR ${CMAKE_BINARY_DIR}/deps)
93+
FILE(MAKE_DIRECTORY ${OUTPUT_DEPS_DIR})
94+
FILE(MAKE_DIRECTORY ${OUTPUT_TMP_DIR})
95+
96+
add_subdirectory(src/ProfilerEngine/Datadog.Profiler.Native.Linux)
97+
add_subdirectory(src/ProfilerEngine/Datadog.Linux.ApiWrapper)
98+
enable_testing()
99+
add_subdirectory(test)

0 commit comments

Comments
 (0)