Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit c1bbdae

Browse files
author
Victor "Nate" Graf
authored
Retry: Enable EventPipe across Unix and Windows (#15611)
* Revert "Revert "Enable EventPipe across Unix and Windows (#14772)" (#15609)" This reverts commit 302005c. * Fix ARM build break * Use more explicit references to resolve build failures * Fix compat with python3 * Disable FeaturePerfTracing on Windows as it is not ready * Disable test for incomplete functionality * Fix test diabled patterns * Add license header * Use keyword types for managed code * Add message prefix * More precisly condition generation of eventing sources * Remove erroneously added changes
1 parent 35bba0c commit c1bbdae

File tree

65 files changed

+2162
-1071
lines changed

Some content is hidden

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

65 files changed

+2162
-1071
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ endif (WIN32)
2323
set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2424
set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)
2525
set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)
26+
set(GENERATED_EVENTING_DIR ${CMAKE_CURRENT_BINARY_DIR}/eventing)
2627
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp")
2728

2829
set(CORECLR_SET_RPATH ON)

build.cmd

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set __ThisScriptDir="%~dp0"
2828
if defined VisualStudioVersion (
2929
if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
3030
goto :Run
31-
)
31+
)
3232

3333
echo %__MsgPrefix%Searching ^for Visual Studio 2017 or 2015 installation
3434
set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
@@ -294,6 +294,16 @@ if %__EnforcePgo%==1 (
294294
)
295295
)
296296

297+
REM Determine if this is a cross-arch build
298+
299+
if /i "%__BuildArch%"=="arm64" (
300+
set __DoCrossArchBuild=1
301+
)
302+
303+
if /i "%__BuildArch%"=="arm" (
304+
set __DoCrossArchBuild=1
305+
)
306+
297307
:: Set the remaining variables based upon the determined build configuration
298308
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
299309
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
@@ -380,6 +390,56 @@ for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:Dum
380390
set __IbcOptDataVersion=%%s
381391
)
382392

393+
REM =========================================================================================
394+
REM ===
395+
REM === Generate source files for eventing
396+
REM ===
397+
REM =========================================================================================
398+
399+
set __IntermediatesIncDir=%__IntermediatesDir%\src\inc
400+
set __IntermediatesEventingDir=%__IntermediatesDir%\eventing
401+
402+
REM Find python and set it to the variable PYTHON
403+
echo import sys; sys.stdout.write(sys.executable) | (py -3 || py -2 || python3 || python2 || python) > %TEMP%\pythonlocation.txt 2> NUL
404+
set /p PYTHON=<%TEMP%\pythonlocation.txt
405+
406+
if /i "%__BuildNative%"=="1" (
407+
if NOT DEFINED PYTHON (
408+
echo %__MsgPrefix%Error: Could not find a python installation
409+
exit /b 1
410+
)
411+
412+
echo %__MsgPrefix%Laying out dynamically generated files consumed by the native build system
413+
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
414+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventing.py --inc %__IntermediatesIncDir% --dummy %__IntermediatesIncDir%\etmdummy.h --man %__SourceDir%\vm\ClrEtwAll.man --nonextern || exit /b 1
415+
416+
echo %__MsgPrefix%Laying out dynamically generated EventPipe Implementation
417+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventPipe.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesEventingDir%\eventpipe --nonextern || exit /b 1
418+
419+
echo %__MsgPrefix%Laying out ETW event logging interface
420+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesIncDir% --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
421+
)
422+
423+
if /i "%__DoCrossArchBuild%"=="1" (
424+
if NOT DEFINED PYTHON (
425+
echo %__MsgPrefix%Error: Could not find a python installation
426+
exit /b 1
427+
)
428+
429+
set __CrossCompIntermediatesIncDir=%__CrossCompIntermediatesDir%\src\inc
430+
set __CrossCompIntermediatesEventingDir=%__CrossCompIntermediatesDir%\eventing
431+
432+
echo %__MsgPrefix%Laying out dynamically generated files consumed by the crossarch build system
433+
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
434+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventing.py --inc !__CrossCompIntermediatesIncDir! --dummy !__CrossCompIntermediatesIncDir!\etmdummy.h --man %__SourceDir%\vm\ClrEtwAll.man --nonextern || exit /b 1
435+
436+
echo %__MsgPrefix%Laying out dynamically generated EventPipe Implementation
437+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventPipe.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesEventingDir!\eventpipe --nonextern || exit /b 1
438+
439+
echo %__MsgPrefix%Laying out ETW event logging interface
440+
!PYTHON! -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesIncDir! --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
441+
)
442+
383443
REM =========================================================================================
384444
REM ===
385445
REM === Build the CLR VM
@@ -476,14 +536,6 @@ REM === Build Cross-Architecture Native Components (if applicable)
476536
REM ===
477537
REM =========================================================================================
478538

479-
if /i "%__BuildArch%"=="arm64" (
480-
set __DoCrossArchBuild=1
481-
)
482-
483-
if /i "%__BuildArch%"=="arm" (
484-
set __DoCrossArchBuild=1
485-
)
486-
487539
if /i "%__DoCrossArchBuild%"=="1" (
488540
REM Scope environment changes start {
489541
setlocal

build.sh

Lines changed: 16 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -194,28 +194,9 @@ generate_event_logging_sources()
194194
fi
195195

196196
# Event Logging Infrastructure
197-
__GeneratedIntermediate="$__IntermediatesDir/Generated"
198-
__GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider_new"
199-
__GeneratedIntermediateEventPipe="$__GeneratedIntermediate/eventpipe_new"
200-
201-
if [[ -d "$__GeneratedIntermediateEventProvider" ]]; then
202-
rm -rf "$__GeneratedIntermediateEventProvider"
203-
fi
204-
205-
if [[ -d "$__GeneratedIntermediateEventPipe" ]]; then
206-
rm -rf "$__GeneratedIntermediateEventPipe"
207-
fi
208-
209-
if [[ ! -d "$__GeneratedIntermediate/eventprovider" ]]; then
210-
mkdir -p "$__GeneratedIntermediate/eventprovider"
211-
fi
212-
213-
if [[ ! -d "$__GeneratedIntermediate/eventpipe" ]]; then
214-
mkdir -p "$__GeneratedIntermediate/eventpipe"
215-
fi
216-
217-
mkdir -p "$__GeneratedIntermediateEventProvider"
218-
mkdir -p "$__GeneratedIntermediateEventPipe"
197+
__GeneratedIntermediate="$__IntermediatesDir/eventing"
198+
__GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider"
199+
__GeneratedIntermediateEventPipe="$__GeneratedIntermediate/eventpipe"
219200

220201
__PythonWarningFlags="-Wall"
221202
if [[ $__IgnoreWarnings == 0 ]]; then
@@ -225,54 +206,38 @@ generate_event_logging_sources()
225206

226207
if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then
227208
echo "Laying out dynamically generated files consumed by the build system "
228-
echo "Laying out dynamically generated Event Logging Test files"
229-
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --testdir "$__GeneratedIntermediateEventProvider/tests"
209+
echo "Laying out dynamically generated Event test files, etmdummy stub functions, and external linkages"
210+
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventing.py" --inc $__IntermediatesDir/src/inc --dummy $__IntermediatesDir/src/inc/etmdummy.h --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --testdir "$__GeneratedIntermediateEventProvider/tests"
230211

231212
if [[ $? != 0 ]]; then
232213
exit
233214
fi
234215

235-
case $__BuildOS in
236-
Linux|FreeBSD)
237-
echo "Laying out dynamically generated EventPipe Implementation"
238-
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventPipe" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst"
239-
if [[ $? != 0 ]]; then
240-
exit
241-
fi
242-
;;
243-
*)
244-
;;
245-
esac
216+
echo "Laying out dynamically generated EventPipe Implementation"
217+
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventPipe"
246218

247219
#determine the logging system
248220
case $__BuildOS in
249221
Linux|FreeBSD)
250222
echo "Laying out dynamically generated Event Logging Implementation of Lttng"
251-
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
223+
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genLttngProvider.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
252224
if [[ $? != 0 ]]; then
253225
exit
254226
fi
255227
;;
256228
*)
229+
echo "Laying out dummy event logging provider"
230+
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genDummyProvider.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
231+
if [[ $? != 0 ]]; then
232+
exit
233+
fi
257234
;;
258235
esac
259-
fi
260-
261-
echo "Cleaning the temp folder of dynamically generated Event Logging files"
262-
$PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventprovider\",\"$__GeneratedIntermediateEventProvider\")"
263-
if [[ $? != 0 ]]; then
264-
exit
265-
fi
266236

267-
rm -rf "$__GeneratedIntermediateEventProvider"
268-
269-
echo "Cleaning the temp folder of dynamically generated EventPipe files"
270-
$PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventpipe\",\"$__GeneratedIntermediateEventPipe\")"
271-
if [[ $? != 0 ]]; then
272-
exit
237+
if [[ $__CrossBuild == 1 ]]; then
238+
cp -r $__GeneratedIntermediate $__CrossCompIntermediatesDir
239+
fi
273240
fi
274-
275-
rm -rf "$__GeneratedIntermediateEventPipe"
276241
}
277242

278243
build_native()

clr.coreclr.props

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<FeatureEventTrace>true</FeatureEventTrace>
44
<FeatureICastable>true</FeatureICastable>
55
<FeatureManagedEtwChannels>true</FeatureManagedEtwChannels>
6+
<FeatureManagedEtw>true</FeatureManagedEtw>
67

78
<ProfilingSupportedBuild>true</ProfilingSupportedBuild>
89
</PropertyGroup>
@@ -16,12 +17,12 @@
1617
<FeatureStubsAsIL>true</FeatureStubsAsIL>
1718

1819
<FeatureCoreFxGlobalization>true</FeatureCoreFxGlobalization>
20+
<FeaturePerfTracing>true</FeaturePerfTracing>
1921
</PropertyGroup>
2022

2123
<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
2224
<FeatureArrayStubAsIL Condition="'$(TargetArch)' != 'i386'">true</FeatureArrayStubAsIL>
2325
<FeatureMulticastStubAsIL Condition="'$(TargetArch)' != 'i386'">true</FeatureMulticastStubAsIL>
24-
<FeatureManagedEtw>true</FeatureManagedEtw>
2526
<FeatureStubsAsIL Condition="'$(TargetArch)' == 'arm64'">true</FeatureStubsAsIL>
2627
<FeatureUseLcid>true</FeatureUseLcid>
2728
<FeatureCominterop>true</FeatureCominterop>
@@ -32,9 +33,4 @@
3233
<FeatureAppX>true</FeatureAppX>
3334
<FeatureWin32Registry>true</FeatureWin32Registry>
3435
</PropertyGroup>
35-
36-
<PropertyGroup Condition="'$(TargetsLinux)' == 'true'">
37-
<FeatureManagedEtw>true</FeatureManagedEtw>
38-
<FeaturePerfTracing>true</FeaturePerfTracing>
39-
</PropertyGroup>
40-
</Project>
36+
</Project>

clrdefinitions.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ if(FEATURE_DBGIPC)
125125
endif(FEATURE_DBGIPC)
126126
if(FEATURE_EVENT_TRACE)
127127
add_definitions(-DFEATURE_EVENT_TRACE=1)
128+
add_definitions(-DFEATURE_PERFTRACING=1)
128129
endif(FEATURE_EVENT_TRACE)
129130
if(FEATURE_GDBJIT)
130131
add_definitions(-DFEATURE_GDBJIT)
@@ -138,9 +139,6 @@ endif(FEATURE_GDBJIT_LANGID_CS)
138139
if(FEATURE_GDBJIT_SYMTAB)
139140
add_definitions(-DFEATURE_GDBJIT_SYMTAB)
140141
endif(FEATURE_GDBJIT_SYMTAB)
141-
if(CLR_CMAKE_PLATFORM_LINUX)
142-
add_definitions(-DFEATURE_PERFTRACING)
143-
endif(CLR_CMAKE_PLATFORM_LINUX)
144142
if(CLR_CMAKE_PLATFORM_UNIX)
145143
add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
146144
endif(CLR_CMAKE_PLATFORM_UNIX)

clrfeatures.cmake

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,13 @@ if(CLR_CMAKE_TARGET_TIZEN_LINUX)
33
endif()
44

55
if(NOT DEFINED FEATURE_EVENT_TRACE)
6-
if (WIN32)
7-
set(FEATURE_EVENT_TRACE 1)
8-
endif()
9-
10-
if(CLR_CMAKE_PLATFORM_LINUX)
11-
if(CLR_CMAKE_TARGET_TIZEN_LINUX)
12-
set(FEATURE_EVENT_TRACE 1)
13-
elseif(CLR_CMAKE_TARGET_ARCH_AMD64)
14-
set(FEATURE_EVENT_TRACE 1)
15-
elseif(CLR_CMAKE_TARGET_ARCH_ARM)
16-
set(FEATURE_EVENT_TRACE 1)
17-
elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
18-
set(FEATURE_EVENT_TRACE 1)
19-
endif()
20-
endif(CLR_CMAKE_PLATFORM_LINUX)
6+
set(FEATURE_EVENT_TRACE 1)
217
endif(NOT DEFINED FEATURE_EVENT_TRACE)
228

9+
if(NOT DEFINED FEATURE_PERFTRACING AND FEATURE_EVENT_TRACE)
10+
set(FEATURE_PERFTRACING 1)
11+
endif(NOT DEFINED FEATURE_PERFTRACING AND FEATURE_EVENT_TRACE)
12+
2313
if(NOT DEFINED FEATURE_DBGIPC)
2414
if(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
2515
set(FEATURE_DBGIPC 1)

dependencies.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
3939
<XunitConsoleNetcorePackageVersion>1.0.2-prerelease-00177</XunitConsoleNetcorePackageVersion>
4040
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
41-
<MicrosoftDiagnosticsTracingTraceEventPackageVersion>1.0.3-alpha-experimental</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
41+
<MicrosoftDiagnosticsTracingTraceEventPackageVersion>2.0.2</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
4242
<VCRuntimeVersion>1.2.0</VCRuntimeVersion>
4343
</PropertyGroup>
4444

0 commit comments

Comments
 (0)