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

Commit

Permalink
This enables Lttng Logging for CoreClr,
Browse files Browse the repository at this point in the history
The Tracepoint Providers are built as a separate shared object called libcoreclrtraceptprovider and it is
available in the same directory as libcoreclr.so

By Default the ability of Tracing will not be present
To enable the ability of  Tracing, the apps need to be run like:

LD_PRELOAD=libcoreclrtraceptprovider.so ./corerun HelloWorld.exe

For now to change Xplat Event Logging mechanism add any events to:
        <root>/src/vm/ClrEtwAll.man
Then regenerate files by running :
        <root>/src/inc/genXplatLtnng.pl

Conflicts:
	Documentation/building/linux-instructions.md
  • Loading branch information
ramarag committed Oct 12, 2015
1 parent 66b24ad commit ff328b6
Show file tree
Hide file tree
Showing 39 changed files with 25,248 additions and 203 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Expand Up @@ -217,6 +217,10 @@ elseif (CLR_CMAKE_PLATFORM_UNIX)

endif(WIN32)

if (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
add_definitions(-DFEATURE_EVENT_TRACE=1)
endif (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)

if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(src/ToolBox/SOS/lldbplugin)
add_subdirectory(src/pal)
Expand All @@ -225,6 +229,7 @@ if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(src/coreclr/hosts/unixcoreconsole)
endif(CLR_CMAKE_PLATFORM_UNIX)


if(CLR_CMAKE_PLATFORM_DARWIN)
add_subdirectory(src/coreclr/hosts/osxbundlerun)
endif(CLR_CMAKE_PLATFORM_DARWIN)
Expand Down Expand Up @@ -421,10 +426,7 @@ if (WIN32)
endif(WIN32)
# Definition directives

# The following defines were extracted from the official amd64 debug / release builds.
if (WIN32)
add_definitions(-DFEATURE_EVENT_TRACE=1)
endif (WIN32)


if (CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DPLATFORM_UNIX=1)
Expand Down
3 changes: 2 additions & 1 deletion Documentation/building/linux-instructions.md
Expand Up @@ -26,6 +26,7 @@ Install the following packages for the toolchain:
- libunwind8-dev
- gettext
- libicu-dev
- liblttng-ust-dev

In order to get lldb-3.6 on Ubuntu 14.04, we need to add an additional package source:

Expand All @@ -37,7 +38,7 @@ ellismg@linux:~$ sudo apt-get update

Then install the packages you need:

`ellismg@linux:~$ sudo apt-get install cmake llvm-3.5 clang-3.5 lldb-3.6 lldb-3.6-dev libunwind8 libunwind8-dev gettext libicu-dev`
`ellismg@linux:~$ sudo apt-get install cmake llvm-3.5 clang-3.5 lldb-3.6 lldb-3.6-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev`

You now have all the required components.

Expand Down
9 changes: 8 additions & 1 deletion src/dlls/mscoree/coreclr/CMakeLists.txt
Expand Up @@ -114,7 +114,14 @@ else()
)
endif(WIN32)

target_link_libraries(coreclr ${CORECLR_LIBRARIES})
if(CLR_CMAKE_PLATFORM_LINUX)
list(APPEND CORECLR_LIBRARIES
eventprovider
)

endif(CLR_CMAKE_PLATFORM_LINUX)

target_link_libraries(coreclr ${CORECLR_LIBRARIES})

if(WIN32)
add_dependencies(coreclr dactablegen)
Expand Down
2 changes: 1 addition & 1 deletion src/gc/gc.cpp
Expand Up @@ -31551,7 +31551,7 @@ void gc_heap::descr_generations_to_profiler (gen_walk_fn fn, void *context)
assert (seg == hp->ephemeral_heap_segment);
assert (curr_gen_number0 <= max_generation);
//
if ((curr_gen_number0 == max_generation))
if (curr_gen_number0 == max_generation)
{
if (heap_segment_mem (seg) < generation_allocation_start (hp->generation_of (max_generation-1)))
{
Expand Down
13 changes: 5 additions & 8 deletions src/gc/gcee.cpp
Expand Up @@ -390,9 +390,10 @@ size_t GCHeap::GetNow()
return hp->get_time_now();
}

#if defined(GC_PROFILING) //UNIXTODO: Enable this for FEATURE_EVENT_TRACE
void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, DWORD dwFlags)
{
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
#if defined(FEATURE_EVENT_TRACE)
Object *pObj = *ppObject;
#ifdef INTERIOR_POINTERS
if (dwFlags & GC_CALL_INTERIOR)
Expand All @@ -408,10 +409,9 @@ void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, DWORD dwFlags)
}
#endif //INTERIOR_POINTERS
ScanRootsHelper(&pObj, pSC, dwFlags);
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
#endif // defined(FEATURE_EVENT_TRACE)
}

#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
// This is called only if we've determined that either:
// a) The Profiling API wants to do a walk of the heap, and it has pinned the
// profiler in place (so it cannot be detached), and it's thus safe to call into the
Expand Down Expand Up @@ -454,7 +454,6 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
pGenGCHeap->finalize_queue->GcScanRoots(&ScanRootsHelper, 0, &SC);

#endif // MULTIPLE_HEAPS

// Handles are kept independent of wks/svr/concurrent builds
SC.dwEtwRootKind = kEtwGCRootKindHandle;
CNameSpace::GcScanHandlesForProfilerAndETW(max_generation, &SC);
Expand Down Expand Up @@ -482,12 +481,10 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
// indicate that dependent handle scanning is over, so we can flush the buffered roots
// to the profiler. (This is for profapi only. ETW will flush after the
// entire heap was is complete, via ETW::GCLog::EndHeapDump.)
#if defined (GC_PROFILING)
if (fProfilerPinned && CORProfilerTrackConditionalWeakTableElements())
{
g_profControlBlock.pProfInterface->EndConditionalWeakTableElementReferences(&SC.pHeapId);
}
#endif // defined (GC_PROFILING)
}

ProfilerWalkHeapContext profilerWalkHeapContext(fProfilerPinned, SC.pvEtwContext);
Expand Down Expand Up @@ -517,7 +514,7 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
}
}
}
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
#endif // defined(GC_PROFILING)

void GCProfileWalkHeap()
{
Expand All @@ -543,7 +540,7 @@ void GCProfileWalkHeap()
}
#endif // defined (GC_PROFILING)

#ifdef FEATURE_EVENT_TRACE
#if defined (GC_PROFILING)//UNIXTODO: Enable this for FEATURE_EVENT_TRACE
// If the profiling API didn't want us to walk the heap but ETW does, then do the
// walk here
if (!fWalkedHeapForProfiler &&
Expand Down

0 comments on commit ff328b6

Please sign in to comment.