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

Commit ff328b6

Browse files
committed
This enables Lttng Logging for CoreClr,
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
1 parent 66b24ad commit ff328b6

39 files changed

+25248
-203
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ elseif (CLR_CMAKE_PLATFORM_UNIX)
217217

218218
endif(WIN32)
219219

220+
if (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
221+
add_definitions(-DFEATURE_EVENT_TRACE=1)
222+
endif (WIN32 OR CLR_CMAKE_PLATFORM_LINUX)
223+
220224
if(CLR_CMAKE_PLATFORM_UNIX)
221225
add_subdirectory(src/ToolBox/SOS/lldbplugin)
222226
add_subdirectory(src/pal)
@@ -225,6 +229,7 @@ if(CLR_CMAKE_PLATFORM_UNIX)
225229
add_subdirectory(src/coreclr/hosts/unixcoreconsole)
226230
endif(CLR_CMAKE_PLATFORM_UNIX)
227231

232+
228233
if(CLR_CMAKE_PLATFORM_DARWIN)
229234
add_subdirectory(src/coreclr/hosts/osxbundlerun)
230235
endif(CLR_CMAKE_PLATFORM_DARWIN)
@@ -421,10 +426,7 @@ if (WIN32)
421426
endif(WIN32)
422427
# Definition directives
423428

424-
# The following defines were extracted from the official amd64 debug / release builds.
425-
if (WIN32)
426-
add_definitions(-DFEATURE_EVENT_TRACE=1)
427-
endif (WIN32)
429+
428430

429431
if (CLR_CMAKE_PLATFORM_UNIX)
430432
add_definitions(-DPLATFORM_UNIX=1)

Documentation/building/linux-instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Install the following packages for the toolchain:
2626
- libunwind8-dev
2727
- gettext
2828
- libicu-dev
29+
- liblttng-ust-dev
2930

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

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

3839
Then install the packages you need:
3940

40-
`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`
41+
`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`
4142

4243
You now have all the required components.
4344

src/dlls/mscoree/coreclr/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ else()
114114
)
115115
endif(WIN32)
116116

117-
target_link_libraries(coreclr ${CORECLR_LIBRARIES})
117+
if(CLR_CMAKE_PLATFORM_LINUX)
118+
list(APPEND CORECLR_LIBRARIES
119+
eventprovider
120+
)
121+
122+
endif(CLR_CMAKE_PLATFORM_LINUX)
123+
124+
target_link_libraries(coreclr ${CORECLR_LIBRARIES})
118125

119126
if(WIN32)
120127
add_dependencies(coreclr dactablegen)

src/gc/gc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31551,7 +31551,7 @@ void gc_heap::descr_generations_to_profiler (gen_walk_fn fn, void *context)
3155131551
assert (seg == hp->ephemeral_heap_segment);
3155231552
assert (curr_gen_number0 <= max_generation);
3155331553
//
31554-
if ((curr_gen_number0 == max_generation))
31554+
if (curr_gen_number0 == max_generation)
3155531555
{
3155631556
if (heap_segment_mem (seg) < generation_allocation_start (hp->generation_of (max_generation-1)))
3155731557
{

src/gc/gcee.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,10 @@ size_t GCHeap::GetNow()
390390
return hp->get_time_now();
391391
}
392392

393+
#if defined(GC_PROFILING) //UNIXTODO: Enable this for FEATURE_EVENT_TRACE
393394
void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, DWORD dwFlags)
394395
{
395-
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
396+
#if defined(FEATURE_EVENT_TRACE)
396397
Object *pObj = *ppObject;
397398
#ifdef INTERIOR_POINTERS
398399
if (dwFlags & GC_CALL_INTERIOR)
@@ -408,10 +409,9 @@ void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, DWORD dwFlags)
408409
}
409410
#endif //INTERIOR_POINTERS
410411
ScanRootsHelper(&pObj, pSC, dwFlags);
411-
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
412+
#endif // defined(FEATURE_EVENT_TRACE)
412413
}
413414

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

456456
#endif // MULTIPLE_HEAPS
457-
458457
// Handles are kept independent of wks/svr/concurrent builds
459458
SC.dwEtwRootKind = kEtwGCRootKindHandle;
460459
CNameSpace::GcScanHandlesForProfilerAndETW(max_generation, &SC);
@@ -482,12 +481,10 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
482481
// indicate that dependent handle scanning is over, so we can flush the buffered roots
483482
// to the profiler. (This is for profapi only. ETW will flush after the
484483
// entire heap was is complete, via ETW::GCLog::EndHeapDump.)
485-
#if defined (GC_PROFILING)
486484
if (fProfilerPinned && CORProfilerTrackConditionalWeakTableElements())
487485
{
488486
g_profControlBlock.pProfInterface->EndConditionalWeakTableElementReferences(&SC.pHeapId);
489487
}
490-
#endif // defined (GC_PROFILING)
491488
}
492489

493490
ProfilerWalkHeapContext profilerWalkHeapContext(fProfilerPinned, SC.pvEtwContext);
@@ -517,7 +514,7 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
517514
}
518515
}
519516
}
520-
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
517+
#endif // defined(GC_PROFILING)
521518

522519
void GCProfileWalkHeap()
523520
{
@@ -543,7 +540,7 @@ void GCProfileWalkHeap()
543540
}
544541
#endif // defined (GC_PROFILING)
545542

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

0 commit comments

Comments
 (0)