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

Retry: Enable EventPipe across Unix and Windows #15611

Merged
merged 14 commits into from Jan 2, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -23,6 +23,7 @@ endif (WIN32)
set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)
set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)
set(GENERATED_EVENTING_DIR ${CMAKE_CURRENT_BINARY_DIR}/eventing)
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp")

set(CORECLR_SET_RPATH ON)
Expand Down
70 changes: 61 additions & 9 deletions build.cmd
Expand Up @@ -28,7 +28,7 @@ set __ThisScriptDir="%~dp0"
if defined VisualStudioVersion (
if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
goto :Run
)
)

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

REM Determine if this is a cross-arch build

if /i "%__BuildArch%"=="arm64" (
set __DoCrossArchBuild=1
)

if /i "%__BuildArch%"=="arm" (
set __DoCrossArchBuild=1
)

:: Set the remaining variables based upon the determined build configuration
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
Expand Down Expand Up @@ -380,6 +390,56 @@ for /f "tokens=*" %%s in ('%DotNetCli% msbuild "%OptDataProjectFilePath%" /t:Dum
set __IbcOptDataVersion=%%s
)

REM =========================================================================================
REM ===
REM === Generate source files for eventing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This phase looks unconditional, whether we're building native, corelib, etc. Is that appropriate?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take another look at what types of builds actually need these files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out better conditioning. Thanks for catching this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect incremental build? If I run "build.cmd" twice in a row, will it generate new files that will cause the subsequent builds to build things they shouldn't need to?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I created a utility which ensures files are only written if the copy on disk is different

REM ===
REM =========================================================================================

set __IntermediatesIncDir=%__IntermediatesDir%\src\inc
set __IntermediatesEventingDir=%__IntermediatesDir%\eventing

REM Find python and set it to the variable PYTHON
echo import sys; sys.stdout.write(sys.executable) | (py -3 || py -2 || python3 || python2 || python) > %TEMP%\pythonlocation.txt 2> NUL
set /p PYTHON=<%TEMP%\pythonlocation.txt

if /i "%__BuildNative%"=="1" (
if NOT DEFINED PYTHON (
echo %__MsgPrefix%Error: Could not find a python installation
exit /b 1
)

echo %__MsgPrefix%Laying out dynamically generated files consumed by the native build system
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventing.py --inc %__IntermediatesIncDir% --dummy %__IntermediatesIncDir%\etmdummy.h --man %__SourceDir%\vm\ClrEtwAll.man --nonextern || exit /b 1

echo %__MsgPrefix%Laying out dynamically generated EventPipe Implementation
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventPipe.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesEventingDir%\eventpipe --nonextern || exit /b 1

echo %__MsgPrefix%Laying out ETW event logging interface
!PYTHON! -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate %__IntermediatesIncDir% --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
)

if /i "%__DoCrossArchBuild%"=="1" (
if NOT DEFINED PYTHON (
echo %__MsgPrefix%Error: Could not find a python installation
exit /b 1
)

set __CrossCompIntermediatesIncDir=%__CrossCompIntermediatesDir%\src\inc
set __CrossCompIntermediatesEventingDir=%__CrossCompIntermediatesDir%\eventing

echo %__MsgPrefix%Laying out dynamically generated files consumed by the crossarch build system
echo %__MsgPrefix%Laying out dynamically generated Event test files and etmdummy stub functions
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventing.py --inc !__CrossCompIntermediatesIncDir! --dummy !__CrossCompIntermediatesIncDir!\etmdummy.h --man %__SourceDir%\vm\ClrEtwAll.man --nonextern || exit /b 1

echo %__MsgPrefix%Laying out dynamically generated EventPipe Implementation
!PYTHON! -B -Wall %__SourceDir%\scripts\genEventPipe.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesEventingDir!\eventpipe --nonextern || exit /b 1

echo %__MsgPrefix%Laying out ETW event logging interface
!PYTHON! -B -Wall %__SourceDir%\scripts\genEtwProvider.py --man %__SourceDir%\vm\ClrEtwAll.man --intermediate !__CrossCompIntermediatesIncDir! --exc %__SourceDir%\vm\ClrEtwAllMeta.lst || exit /b 1
)

REM =========================================================================================
REM ===
REM === Build the CLR VM
Expand Down Expand Up @@ -476,14 +536,6 @@ REM === Build Cross-Architecture Native Components (if applicable)
REM ===
REM =========================================================================================

if /i "%__BuildArch%"=="arm64" (
set __DoCrossArchBuild=1
)

if /i "%__BuildArch%"=="arm" (
set __DoCrossArchBuild=1
)

if /i "%__DoCrossArchBuild%"=="1" (
REM Scope environment changes start {
setlocal
Expand Down
67 changes: 16 additions & 51 deletions build.sh
Expand Up @@ -194,28 +194,9 @@ generate_event_logging_sources()
fi

# Event Logging Infrastructure
__GeneratedIntermediate="$__IntermediatesDir/Generated"
__GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider_new"
__GeneratedIntermediateEventPipe="$__GeneratedIntermediate/eventpipe_new"

if [[ -d "$__GeneratedIntermediateEventProvider" ]]; then
rm -rf "$__GeneratedIntermediateEventProvider"
fi

if [[ -d "$__GeneratedIntermediateEventPipe" ]]; then
rm -rf "$__GeneratedIntermediateEventPipe"
fi

if [[ ! -d "$__GeneratedIntermediate/eventprovider" ]]; then
mkdir -p "$__GeneratedIntermediate/eventprovider"
fi

if [[ ! -d "$__GeneratedIntermediate/eventpipe" ]]; then
mkdir -p "$__GeneratedIntermediate/eventpipe"
fi

mkdir -p "$__GeneratedIntermediateEventProvider"
mkdir -p "$__GeneratedIntermediateEventPipe"
__GeneratedIntermediate="$__IntermediatesDir/eventing"
__GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider"
__GeneratedIntermediateEventPipe="$__GeneratedIntermediate/eventpipe"

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

if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then
echo "Laying out dynamically generated files consumed by the build system "
echo "Laying out dynamically generated Event Logging Test files"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --testdir "$__GeneratedIntermediateEventProvider/tests"
echo "Laying out dynamically generated Event test files, etmdummy stub functions, and external linkages"
$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"

if [[ $? != 0 ]]; then
exit
fi

case $__BuildOS in
Linux|FreeBSD)
echo "Laying out dynamically generated EventPipe Implementation"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventPipe" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst"
if [[ $? != 0 ]]; then
exit
fi
;;
*)
;;
esac
echo "Laying out dynamically generated EventPipe Implementation"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genEventPipe.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventPipe"

#determine the logging system
case $__BuildOS in
Linux|FreeBSD)
echo "Laying out dynamically generated Event Logging Implementation of Lttng"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genLttngProvider.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
if [[ $? != 0 ]]; then
exit
fi
;;
*)
echo "Laying out dummy event logging provider"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genDummyProvider.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
if [[ $? != 0 ]]; then
exit
fi
;;
esac
fi

echo "Cleaning the temp folder of dynamically generated Event Logging files"
$PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventprovider\",\"$__GeneratedIntermediateEventProvider\")"
if [[ $? != 0 ]]; then
exit
fi

rm -rf "$__GeneratedIntermediateEventProvider"

echo "Cleaning the temp folder of dynamically generated EventPipe files"
$PYTHON -B $__PythonWarningFlags -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventpipe\",\"$__GeneratedIntermediateEventPipe\")"
if [[ $? != 0 ]]; then
exit
if [[ $__CrossBuild == 1 ]]; then
cp -r $__GeneratedIntermediate $__CrossCompIntermediatesDir
fi
fi

rm -rf "$__GeneratedIntermediateEventPipe"
}

build_native()
Expand Down
10 changes: 3 additions & 7 deletions clr.coreclr.props
Expand Up @@ -3,6 +3,7 @@
<FeatureEventTrace>true</FeatureEventTrace>
<FeatureICastable>true</FeatureICastable>
<FeatureManagedEtwChannels>true</FeatureManagedEtwChannels>
<FeatureManagedEtw>true</FeatureManagedEtw>

<ProfilingSupportedBuild>true</ProfilingSupportedBuild>
</PropertyGroup>
Expand All @@ -16,12 +17,12 @@
<FeatureStubsAsIL>true</FeatureStubsAsIL>

<FeatureCoreFxGlobalization>true</FeatureCoreFxGlobalization>
<FeaturePerfTracing>true</FeaturePerfTracing>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
<FeatureArrayStubAsIL Condition="'$(TargetArch)' != 'i386'">true</FeatureArrayStubAsIL>
<FeatureMulticastStubAsIL Condition="'$(TargetArch)' != 'i386'">true</FeatureMulticastStubAsIL>
<FeatureManagedEtw>true</FeatureManagedEtw>
<FeatureStubsAsIL Condition="'$(TargetArch)' == 'arm64'">true</FeatureStubsAsIL>
<FeatureUseLcid>true</FeatureUseLcid>
<FeatureCominterop>true</FeatureCominterop>
Expand All @@ -32,9 +33,4 @@
<FeatureAppX>true</FeatureAppX>
<FeatureWin32Registry>true</FeatureWin32Registry>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsLinux)' == 'true'">
<FeatureManagedEtw>true</FeatureManagedEtw>
<FeaturePerfTracing>true</FeaturePerfTracing>
</PropertyGroup>
</Project>
</Project>
4 changes: 1 addition & 3 deletions clrdefinitions.cmake
Expand Up @@ -125,6 +125,7 @@ if(FEATURE_DBGIPC)
endif(FEATURE_DBGIPC)
if(FEATURE_EVENT_TRACE)
add_definitions(-DFEATURE_EVENT_TRACE=1)
add_definitions(-DFEATURE_PERFTRACING=1)
endif(FEATURE_EVENT_TRACE)
if(FEATURE_GDBJIT)
add_definitions(-DFEATURE_GDBJIT)
Expand All @@ -138,9 +139,6 @@ endif(FEATURE_GDBJIT_LANGID_CS)
if(FEATURE_GDBJIT_SYMTAB)
add_definitions(-DFEATURE_GDBJIT_SYMTAB)
endif(FEATURE_GDBJIT_SYMTAB)
if(CLR_CMAKE_PLATFORM_LINUX)
add_definitions(-DFEATURE_PERFTRACING)
endif(CLR_CMAKE_PLATFORM_LINUX)
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_EVENTSOURCE_XPLAT=1)
endif(CLR_CMAKE_PLATFORM_UNIX)
Expand Down
20 changes: 5 additions & 15 deletions clrfeatures.cmake
Expand Up @@ -3,23 +3,13 @@ if(CLR_CMAKE_TARGET_TIZEN_LINUX)
endif()

if(NOT DEFINED FEATURE_EVENT_TRACE)
if (WIN32)
set(FEATURE_EVENT_TRACE 1)
endif()

if(CLR_CMAKE_PLATFORM_LINUX)
if(CLR_CMAKE_TARGET_TIZEN_LINUX)
set(FEATURE_EVENT_TRACE 1)
elseif(CLR_CMAKE_TARGET_ARCH_AMD64)
set(FEATURE_EVENT_TRACE 1)
elseif(CLR_CMAKE_TARGET_ARCH_ARM)
set(FEATURE_EVENT_TRACE 1)
elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
set(FEATURE_EVENT_TRACE 1)
endif()
endif(CLR_CMAKE_PLATFORM_LINUX)
set(FEATURE_EVENT_TRACE 1)
endif(NOT DEFINED FEATURE_EVENT_TRACE)

if(NOT DEFINED FEATURE_PERFTRACING AND FEATURE_EVENT_TRACE)
set(FEATURE_PERFTRACING 1)
endif(NOT DEFINED FEATURE_PERFTRACING AND FEATURE_EVENT_TRACE)

if(NOT DEFINED FEATURE_DBGIPC)
if(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
set(FEATURE_DBGIPC 1)
Expand Down
2 changes: 1 addition & 1 deletion dependencies.props
Expand Up @@ -38,7 +38,7 @@
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
<XunitConsoleNetcorePackageVersion>1.0.2-prerelease-00177</XunitConsoleNetcorePackageVersion>
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
<MicrosoftDiagnosticsTracingTraceEventPackageVersion>1.0.3-alpha-experimental</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
<MicrosoftDiagnosticsTracingTraceEventPackageVersion>2.0.2</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
<VCRuntimeVersion>1.2.0</VCRuntimeVersion>
</PropertyGroup>

Expand Down