Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Change profilers to use thread local evacuation counters
Change to prefix increment
  • Loading branch information
davmason committed Oct 6, 2021
commit 1a0fea7d4bb8e33b016ea83bee649f4cd4140c7c
6 changes: 3 additions & 3 deletions src/coreclr/inc/CrstTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ End
// between the thread executing DetachProfiler(), and the DetachThread
// carrying out the evacuation order.
Crst ProfilingAPIStatus
AcquiredBefore ThreadStore
End

Crst RCWCache
Expand Down Expand Up @@ -496,9 +497,8 @@ End
Crst ThreadStore
AcquiredBefore AvailableParamTypes DeadlockDetection DebuggerController
DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile
JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilingAPIStatus
ProfilerGCRefDataFreeList SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList
ThreadIdDispenser DebuggerMutex
JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList
SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList ThreadIdDispenser DebuggerMutex
End

Crst TypeIDMap
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/inc/crsttypes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//

#ifndef __CRST_TYPES_INCLUDED
Expand All @@ -10,7 +11,7 @@

// This file describes the range of Crst types available and their mapping to a numeric level (used by the
// runtime in debug mode to validate we're deadlock free). To modify these settings edit the
// file:CrstTypes.def file and run the clr\artifacts\CrstTypeTool utility to generate a new version of this file.
// file:CrstTypes.def file and run the clr\bin\CrstTypeTool utility to generate a new version of this file.

// Each Crst type is declared as a value in the following CrstType enum.
enum CrstType
Expand Down Expand Up @@ -230,7 +231,7 @@ int g_rgCrstLevelMap[] =
4, // CrstPgoData
0, // CrstPinnedByrefValidation
0, // CrstProfilerGCRefDataFreeList
0, // CrstProfilingAPIStatus
13, // CrstProfilingAPIStatus
4, // CrstRCWCache
0, // CrstRCWCleanupList
10, // CrstReadyToRunEntryPointToMethodDescMap
Expand Down
25 changes: 5 additions & 20 deletions src/coreclr/inc/profilepriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,10 @@ class ProfilerInfo

EventMask eventMask;

//---------------------------------------------------------------
// dwProfilerEvacuationCounter keeps track of how many profiler
// callback calls remain on the stack
//---------------------------------------------------------------
// Why volatile?
// See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization.
Volatile<DWORD> dwProfilerEvacuationCounter;

Volatile<BOOL> inUse;

DWORD slot;

// Reset those variables that is only for the current attach session
void ResetPerSessionStatus();
void Init();
Expand Down Expand Up @@ -150,19 +144,11 @@ class EvacuationCounterHolder
{
private:
ProfilerInfo *m_pProfilerInfo;
Thread *m_pThread;

public:
EvacuationCounterHolder(ProfilerInfo *pProfilerInfo) :
m_pProfilerInfo(pProfilerInfo)
{
_ASSERTE(m_pProfilerInfo != NULL);
InterlockedIncrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer()));
}

~EvacuationCounterHolder()
{
InterlockedDecrement((LONG *)(m_pProfilerInfo->dwProfilerEvacuationCounter.GetPointer()));
}
EvacuationCounterHolder(ProfilerInfo *pProfilerInfo);
~EvacuationCounterHolder();
};

struct StoredProfilerNode
Expand Down Expand Up @@ -317,7 +303,6 @@ class ProfControlBlock

BOOL IsCallback3Supported();
BOOL IsCallback5Supported();
BOOL IsDisableTransparencySet();
BOOL RequiresGenericsContextForEnterLeave();
UINT_PTR EEFunctionIDMapper(FunctionID funcId, BOOL * pbHookFunction);

Expand Down
Loading