From: Sung Yoon Whang Date: Thu, 21 Feb 2019 22:19:27 +0000 (-0800) Subject: Remove unused perfcounter code (#22742) X-Git-Tag: accepted/tizen/unified/20190813.215958~61^2~179 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2dfd1779ae9eebe89b223cff6fd77825301971dd;p=platform%2Fupstream%2Fcoreclr.git Remove unused perfcounter code (#22742) * removing references to COUNTER_ONLY, ENABLE_PERF_COUNTERS in src/vm directory * removing perfcounters* files * Fix build * Remove PerfCounterSupportedBuild * Some more cleanup on the GC side --- diff --git a/src/classlibnative/bcltype/CMakeLists.txt b/src/classlibnative/bcltype/CMakeLists.txt index 2f990ad..2913f9d 100644 --- a/src/classlibnative/bcltype/CMakeLists.txt +++ b/src/classlibnative/bcltype/CMakeLists.txt @@ -1,9 +1,5 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) -if(PerfCountersSupportedBuild) - add_definitions(-DENABLE_PERF_COUNTERS) -endif(PerfCountersSupportedBuild) - set(BCLTYPE_SOURCES arraynative.cpp arrayhelpers.cpp diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h index d982cae..351f4f3 100644 --- a/src/gc/env/gcenv.base.h +++ b/src/gc/env/gcenv.base.h @@ -498,8 +498,6 @@ inline bool dbgOnly_IsSpecialEEThread() // Performance logging // -#define COUNTER_ONLY(x) - //#include "etmdummy.h" //#define ETW_EVENT_ENABLED(e,f) false diff --git a/src/gc/gcee.cpp b/src/gc/gcee.cpp index 52c4fb6..8706ae7 100644 --- a/src/gc/gcee.cpp +++ b/src/gc/gcee.cpp @@ -12,8 +12,10 @@ #ifndef DACCESS_COMPILE -COUNTER_ONLY(PERF_COUNTER_TIMER_PRECISION g_TotalTimeInGC = 0); -COUNTER_ONLY(PERF_COUNTER_TIMER_PRECISION g_TotalTimeSinceLastGCEnd = 0); +#ifdef ENABLE_PERF_COUNTERS +PERF_COUNTER_TIMER_PRECISION g_TotalTimeInGC = 0; +PERF_COUNTER_TIMER_PRECISION g_TotalTimeSinceLastGCEnd = 0; +#endif #if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE) size_t g_GenerationSizes[NUMBERGENERATIONS]; diff --git a/src/gc/handletable.cpp b/src/gc/handletable.cpp index 2232c45..2480a56 100644 --- a/src/gc/handletable.cpp +++ b/src/gc/handletable.cpp @@ -184,8 +184,10 @@ void HndDestroyHandleTable(HHANDLETABLE hTable) // fetch the handle table pointer HandleTable *pTable = Table(hTable); +#ifdef ENABLE_PERF_COUNTERS // decrement handle count by number of handles in this table COUNTER_ONLY(GetPerfCounters().m_GC.cHandles -= HndCountHandles(hTable)); +#endif // We are going to free the memory for this HandleTable. // Let us reset the copy in g_pHandleTableArray to NULL. diff --git a/src/inc/perfcounterdefs.h b/src/inc/perfcounterdefs.h deleted file mode 100644 index 83fe7b1..0000000 --- a/src/inc/perfcounterdefs.h +++ /dev/null @@ -1,495 +0,0 @@ -// 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. -//----------------------------------------------------------------------------- -// PerfCounterDefs.h -// -// Internal Interface for CLR to use Performance counters -//----------------------------------------------------------------------------- - - -#ifndef _PerfCounterDefs_h_ -#define _PerfCounterDefs_h_ - -#include "contract.h" - -//----------------------------------------------------------------------------- -// PerfCounters are only enabled if ENABLE_PERF_COUNTERS is defined. -// If we know we want them (such as in the impl or perfmon, then define this -// in before we include this header, else define this from the sources file. -// -// Note that some platforms don't use perfcounters, so to avoid a build -// break, you must wrap PerfCounter code (such as instrumenting in either -// #ifdef or use the COUNTER_ONLY(x) macro (defined below) -// - -//----------------------------------------------------------------------------- -// Name of global IPC block -#define SHARED_PERF_IPC_NAME W("SharedPerfIPCBlock") - - -//----------------------------------------------------------------------------- -// Attributes for the IPC block -//----------------------------------------------------------------------------- -const int PERF_ATTR_ON = 0x0001; // Are we even updating any counters? -const int PERF_ATTR_GLOBAL = 0x0002; // Is this a global or private block? - - - - - -//............................................................................. -// Tri Counter. Support for the common trio of counters (Total, Current, and -// Instantaneous). This compiles to the same thing if we had them all separate, -// but it's a lot cleaner this way. -//............................................................................. -struct TRICOUNT -{ - DWORD Cur; // Current, has +, - - DWORD Total; // Total, has only + - inline void operator++(int) { - LIMITED_METHOD_CONTRACT; - Cur ++; Total ++; - } - inline void operator--(int) { - LIMITED_METHOD_CONTRACT; - Cur --; - } - inline void operator+=(int delta) { - LIMITED_METHOD_CONTRACT; - Cur += delta; Total += delta; - } - inline void operator-=(int delta) { - LIMITED_METHOD_CONTRACT; - Cur -= delta; - } - inline void operator=(int delta) { - LIMITED_METHOD_CONTRACT; - Cur = delta; - Total = delta; - } - inline void operator+=(TRICOUNT delta) { - LIMITED_METHOD_CONTRACT; - Cur += delta.Cur; Total += delta.Total; - } - -}; - -//............................................................................. -// Interlocked Tri Counter. Support for the common trio of counters (Total, Current, -// and Instantaneous). This compiles to the same thing if we had them all separate, -// but it's a lot cleaner this way. -//............................................................................. -struct TRICOUNT_IL -{ - DWORD Cur; // Current, has +, - - DWORD Total; // Total, has only + - inline void operator++(int) { - LIMITED_METHOD_CONTRACT; - InterlockedIncrement((LPLONG)&Cur); InterlockedIncrement((LPLONG)&Total); - } - inline void operator--(int) { - LIMITED_METHOD_CONTRACT; - InterlockedDecrement((LPLONG)&Cur); - } - inline void operator+=(int delta) { - LIMITED_METHOD_CONTRACT; - while (TRUE) - { - LONG old_Cur = Cur; - if (InterlockedCompareExchange((LPLONG)&Cur, Cur+delta, old_Cur) == old_Cur) - break; - } - while (TRUE) - { - LONG old_Total = Total; - if (InterlockedCompareExchange((LPLONG)&Total, Total+delta, old_Total) == old_Total) - break; - } - } - inline void operator-=(int delta) { - LIMITED_METHOD_CONTRACT; - while (TRUE) - { - LONG old_Cur = Cur; - if (InterlockedCompareExchange((LPLONG)&Cur, Cur-delta, old_Cur) == old_Cur) - break; - } - } - inline void operator=(int delta) { - LIMITED_METHOD_CONTRACT; - while (TRUE) - { - LONG old_Cur = Cur; - if (InterlockedCompareExchange((LPLONG)&Cur, delta, old_Cur) == old_Cur) - break; - } - - while (TRUE) - { - LONG old_Total = Total; - if (InterlockedCompareExchange((LPLONG)&Total, delta, old_Total) == old_Total) - break; - } - } - inline void operator+=(TRICOUNT_IL delta) { - LIMITED_METHOD_CONTRACT; - while (TRUE) - { - LONG old_Cur = Cur; - if (InterlockedCompareExchange((LPLONG)&Cur, Cur+delta.Cur, old_Cur) == old_Cur) - break; - } - while (TRUE) - { - LONG old_Total = Total; - if (InterlockedCompareExchange((LPLONG)&Total, Total+delta.Total, old_Total) == old_Total) - break; - } - } - -}; - - -//............................................................................. -// Dual Counter. Support for the (Total and Instantaneous (rate)). Helpful in cases -// where the current value is always same as the total value. ie. the counter is never -// decremented. -// This compiles to the same thing if we had them separate, but it's a lot cleaner -// this way. -//............................................................................. -struct DUALCOUNT -{ - DWORD Total; - inline void operator++(int) { - LIMITED_METHOD_CONTRACT; - Total ++; - } - - inline void operator+=(int delta) { - LIMITED_METHOD_CONTRACT; - Total += delta; - } - - inline void operator+=(DUALCOUNT delta) { - LIMITED_METHOD_CONTRACT; - Total += delta.Total; - } - - -}; - -//----------------------------------------------------------------------------- -// Format for the Perf Counter IPC Block -// IPC block is broken up into sections. This marks it easier to marshall -// into different perfmon objects -// -//............................................................................. -// Naming convention (by prefix): -// c - Raw count of something. -// cb- count of bytes -// time - time value. -// depth - stack depth -//----------------------------------------------------------------------------- - -const int MAX_TRACKED_GENS = 3; // number of generations we track - -// -// Perf_GC_Wow64 mimics in a 64 bit process, the layout of Perf_GC in a 32 bit process -// It does this by replacing all size_t by DWORD -// -// *** Keep contents of Perf_GC_Wow64 and Perf_GC in sync *** - -struct Perf_GC_Wow64 -{ -public: - DWORD cGenCollections[MAX_TRACKED_GENS];// count of collects per gen - DWORD cbPromotedMem[MAX_TRACKED_GENS-1]; // count of promoted memory - DWORD cbPromotedFinalizationMem; // count of memory promoted due to finalization - DWORD cProcessID; // process ID - DWORD cGenHeapSize[MAX_TRACKED_GENS]; // size of heaps per gen - DWORD cTotalCommittedBytes; // total number of committed bytes. - DWORD cTotalReservedBytes; // bytes reserved via VirtualAlloc - DWORD cLrgObjSize; // size of Large Object Heap - DWORD cSurviveFinalize; // count of instances surviving from finalizing - DWORD cHandles; // count of GC handles - DWORD cbAlloc; // bytes allocated - DWORD cbLargeAlloc; // bytes allocated for Large Objects - DWORD cInducedGCs; // number of explicit GCs - DWORD timeInGC; // Time in GC - DWORD timeInGCBase; // must follow time in GC counter - - DWORD cPinnedObj; // # of Pinned Objects - DWORD cSinkBlocks; // # of sink blocks -}; - -// *** Keep contents of Perf_GC_Wow64 and Perf_GC in sync *** -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_GC -{ -public: - size_t cGenCollections[MAX_TRACKED_GENS];// count of collects per gen - size_t cbPromotedMem[MAX_TRACKED_GENS-1]; // count of promoted memory - size_t cbPromotedFinalizationMem; // count of memory promoted due to finalization - size_t cProcessID; // process ID - size_t cGenHeapSize[MAX_TRACKED_GENS]; // size of heaps per gen - size_t cTotalCommittedBytes; // total number of committed bytes. - size_t cTotalReservedBytes; // bytes reserved via VirtualAlloc - size_t cLrgObjSize; // size of Large Object Heap - size_t cSurviveFinalize; // count of instances surviving from finalizing - size_t cHandles; // count of GC handles - size_t cbAlloc; // bytes allocated - size_t cbLargeAlloc; // bytes allocated for Large Objects - size_t cInducedGCs; // number of explicit GCs - DWORD timeInGC; // Time in GC - DWORD timeInGCBase; // must follow time in GC counter - - size_t cPinnedObj; // # of Pinned Objects - size_t cSinkBlocks; // # of sink blocks - - Perf_GC(); - Perf_GC(Perf_GC_Wow64& copyFrom); -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -// -// Perf_Loading_Wow64 mimics in a 64 bit process, the layout of Perf_Loading -// in a 32 bit process. It does this by replacing all size_t by DWORD -// -// *** Keep contents of Perf_Loading_Wow64 and Perf_Loading in sync *** -struct Perf_Loading_Wow64 -{ -// Loading -public: - TRICOUNT cClassesLoaded; - TRICOUNT_IL cAppDomains; // Current # of AppDomains - TRICOUNT cAssemblies; // Current # of Assemblies. - UNALIGNED LONGLONG timeLoading; // % time loading - DWORD cAsmSearchLen; // Avg search length for assemblies - DUALCOUNT cLoadFailures; // Classes Failed to load - DWORD cbLoaderHeapSize; // Total size of heap used by the loader - DUALCOUNT cAppDomainsUnloaded; // Rate at which app domains are unloaded -}; - -// *** Keep contents of Perf_Loading_Wow64 and Perf_Loading in sync *** -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Loading -{ -// Loading -public: - TRICOUNT cClassesLoaded; - TRICOUNT_IL cAppDomains; // Current # of AppDomains - TRICOUNT cAssemblies; // Current # of Assemblies. - UNALIGNED LONGLONG timeLoading; // % time loading - DWORD cAsmSearchLen; // Avg search length for assemblies - DUALCOUNT cLoadFailures; // Classes Failed to load - size_t cbLoaderHeapSize; // Total size of heap used by the loader - DUALCOUNT cAppDomainsUnloaded; // Rate at which app domains are unloaded - - Perf_Loading(); - Perf_Loading(Perf_Loading_Wow64& copyFrom); -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Jit -{ -// Jitting - DWORD cMethodsJitted; // number of methods jitted - TRICOUNT cbILJitted; // IL jitted stats -// DUALCOUNT cbPitched; // Total bytes pitched - DWORD cJitFailures; // # of standard Jit failures - DWORD timeInJit; // Time in JIT since last sample - DWORD timeInJitBase; // Time in JIT base counter -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Excep -{ -// Exceptions - DUALCOUNT cThrown; // Number of Exceptions thrown - DWORD cFiltersExecuted; // Number of Filters executed - DWORD cFinallysExecuted; // Number of Finallys executed - DWORD cThrowToCatchStackDepth; // Delta from throw to catch site on stack -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Interop -{ -// Interop - DWORD cCCW; // Number of CCWs - DWORD cStubs; // Number of stubs - DWORD cMarshalling; // # of time marshalling args and return values. - DWORD cTLBImports; // Number of tlbs we import - DWORD cTLBExports; // Number of tlbs we export -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_LocksAndThreads -{ -// Locks - DUALCOUNT cContention; // # of times in AwareLock::EnterEpilogue() - TRICOUNT cQueueLength; // Lenght of queue -// Threads - DWORD cCurrentThreadsLogical; // Number (created - destroyed) of logical threads - DWORD cCurrentThreadsPhysical; // Number (created - destroyed) of OS threads - TRICOUNT cRecognizedThreads; // # of Threads execute in runtime's control -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - - -// IMPORTANT!!!!!!!: The first two fields in the struct have to be together -// and be the first two fields in the struct. The managed code in ChannelServices.cs -// depends on this. -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Contexts -{ -// Contexts & Remoting - DUALCOUNT cRemoteCalls; // # of remote calls - DWORD cChannels; // Number of current channels - DWORD cProxies; // Number of context proxies. - DWORD cClasses; // # of Context-bound classes - DWORD cObjAlloc; // # of context bound objects allocated - DWORD cContexts; // The current number of contexts. -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -// -// Perf_Security_Wow64 mimics in a 64 bit process, the layout of Perf_Security -// in a 32 bit process. It does this by packing all members on 4 byte boundary -// ("timeAuthorize" field which is 8 bytes in size, will get 8 byte aligned -// on 64 bit by default) -// -// *** Keep contents of Perf_Security_Wow64 and Perf_Security in sync *** -#include -struct Perf_Security_Wow64 -{ -// Security -public: - DWORD cTotalRTChecks; // Total runtime checks - UNALIGNED LONGLONG timeAuthorize; // % time authenticating - DWORD cLinkChecks; // link time checks - DWORD timeRTchecks; // % time in Runtime checks - DWORD timeRTchecksBase; // % time in Runtime checks base counter - DWORD stackWalkDepth; // depth of stack for security checks -}; -#include - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct Perf_Security -{ -// Security -public: - DWORD cTotalRTChecks; // Total runtime checks - UNALIGNED LONGLONG timeAuthorize; // % time authenticating - DWORD cLinkChecks; // link time checks - DWORD timeRTchecks; // % time in Runtime checks - DWORD timeRTchecksBase; // % time in Runtime checks base counter - DWORD stackWalkDepth; // depth of stack for security checks - - Perf_Security(); - Perf_Security(Perf_Security_Wow64& copyFrom); -}; -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - - -// -// PerfCounterWow64IPCControlBlock mimics in a 64 bit process, the layout of -// PerfCounterIPCControlBlock in a 32 bit process. -// -// *** Keep contents of PerfCounterWow64IPCControlBlock and PerfCounterIPCControlBlock in sync *** -#include -struct PerfCounterWow64IPCControlBlock -{ -public: -// Versioning info - WORD m_cBytes; // size of this entire block - WORD m_wAttrs; // attributes for this block - -// Counter Sections - Perf_GC_Wow64 m_GC; - Perf_Contexts m_Context; - Perf_Interop m_Interop; - Perf_Loading_Wow64 m_Loading; - Perf_Excep m_Excep; - Perf_LocksAndThreads m_LocksAndThreads; - Perf_Jit m_Jit; - Perf_Security_Wow64 m_Security; -}; -#include - -// Note: PerfMonDll marshalls data out of here by copying a continous block of memory. -// We can still add new members to the subsections above, but if we change their -// placement in the structure below, we may break PerfMon's marshalling - -// *** Keep contents of PerfCounterWow64IPCControlBlock and PerfCounterIPCControlBlock in sync *** -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 -struct PerfCounterIPCControlBlock -{ -public: -// Versioning info - WORD m_cBytes; // size of this entire block - WORD m_wAttrs; // attributes for this block - -// Counter Sections - Perf_GC m_GC; - Perf_Contexts m_Context; - Perf_Interop m_Interop; - Perf_Loading m_Loading; - Perf_Excep m_Excep; - Perf_LocksAndThreads m_LocksAndThreads; - Perf_Jit m_Jit; - Perf_Security m_Security; - - PerfCounterIPCControlBlock(); - PerfCounterIPCControlBlock(PerfCounterWow64IPCControlBlock& copyFrom); -}; - -#ifndef _WIN64 -#include -#endif //#ifndef _WIN64 - -// -// Inline definitions -// - -#include "perfcounterdefs.inl" - -#endif // _PerfCounterDefs_h_ diff --git a/src/inc/perfcounterdefs.inl b/src/inc/perfcounterdefs.inl deleted file mode 100644 index ab8f73d..0000000 --- a/src/inc/perfcounterdefs.inl +++ /dev/null @@ -1,89 +0,0 @@ -// 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. -//----------------------------------------------------------------------------- -// PerfCounterDefs.inl -// -// Internal Interface for CLR to use Performance counters -//----------------------------------------------------------------------------- - -#ifndef _PerfCounterDefs_inl_ -#define _PerfCounterDefs_inl_ - -#include "perfcounterdefs.h" - -inline Perf_GC::Perf_GC() {} - -inline Perf_GC::Perf_GC(Perf_GC_Wow64& copyFrom) -{ - for (int index = 0; index < MAX_TRACKED_GENS; index++) - { - cGenCollections[index] = (size_t)copyFrom.cGenCollections[index]; - cGenHeapSize[index] = (size_t)copyFrom.cGenHeapSize[index]; - } - for (int index = 0; index < MAX_TRACKED_GENS - 1; index++) - { - cbPromotedMem[index] = (size_t)copyFrom.cbPromotedMem[index]; - } - - cbPromotedFinalizationMem = (size_t) copyFrom.cbPromotedFinalizationMem; - cProcessID = (size_t) copyFrom.cProcessID; - cTotalCommittedBytes = (size_t) copyFrom.cTotalCommittedBytes; - cTotalReservedBytes = (size_t) copyFrom.cTotalReservedBytes; - cLrgObjSize = (size_t) copyFrom.cLrgObjSize; - cSurviveFinalize = (size_t) copyFrom.cSurviveFinalize; - cHandles = (size_t) copyFrom.cHandles; - cbAlloc = (size_t) copyFrom.cbAlloc; - cbLargeAlloc = (size_t) copyFrom.cbLargeAlloc; - cInducedGCs = (size_t) copyFrom.cInducedGCs; - timeInGC = copyFrom.timeInGC; - timeInGCBase = copyFrom.timeInGCBase; - cPinnedObj = (size_t) copyFrom.cPinnedObj; - cSinkBlocks = (size_t) copyFrom.cSinkBlocks; -} - -inline Perf_Loading::Perf_Loading() {} - -inline Perf_Loading::Perf_Loading(Perf_Loading_Wow64& copyFrom) -: cClassesLoaded(copyFrom.cClassesLoaded), - cAppDomains(copyFrom.cAppDomains), - cAssemblies(copyFrom.cAssemblies), - timeLoading(copyFrom.timeLoading), - cAsmSearchLen(copyFrom.cAsmSearchLen), - cLoadFailures (copyFrom.cLoadFailures), - cbLoaderHeapSize ((size_t) copyFrom.cbLoaderHeapSize), - cAppDomainsUnloaded (copyFrom.cAppDomainsUnloaded) -{ -} - -inline Perf_Security::Perf_Security() {}; - -inline Perf_Security::Perf_Security(Perf_Security_Wow64& copyFrom) -: cTotalRTChecks(copyFrom.cTotalRTChecks), - timeAuthorize(0), // Unused "reserved" field - cLinkChecks(copyFrom.cLinkChecks), - timeRTchecks(copyFrom.timeRTchecks), - timeRTchecksBase(copyFrom.timeRTchecksBase), - stackWalkDepth (copyFrom.stackWalkDepth) -{ -} - -inline PerfCounterIPCControlBlock::PerfCounterIPCControlBlock() {} - -inline PerfCounterIPCControlBlock::PerfCounterIPCControlBlock(PerfCounterWow64IPCControlBlock& copyFrom) -: m_cBytes (copyFrom.m_cBytes), - m_wAttrs (copyFrom.m_wAttrs), - m_GC (copyFrom.m_GC), - m_Context (copyFrom.m_Context), - m_Interop (copyFrom.m_Interop), - m_Loading (copyFrom.m_Loading), - m_Excep (copyFrom.m_Excep), - m_LocksAndThreads (copyFrom.m_LocksAndThreads), - m_Jit (copyFrom.m_Jit), - m_Security (copyFrom.m_Security) -{ - _ASSERTE((size_t)m_cBytes == sizeof(PerfCounterWow64IPCControlBlock)); -} - -#endif // _PerfCounterDefs_inl_ - diff --git a/src/inc/perfcounters.h b/src/inc/perfcounters.h deleted file mode 100644 index 29fc767..0000000 --- a/src/inc/perfcounters.h +++ /dev/null @@ -1,122 +0,0 @@ -// 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. -//----------------------------------------------------------------------------- -// PerfCounters.h -// -// Internal Interface for CLR to use Performance counters -//----------------------------------------------------------------------------- - - -#ifndef _PerfCounters_h_ -#define _PerfCounters_h_ - -#include "perfcounterdefs.h" - -#ifdef ENABLE_PERF_COUNTERS -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// This code section active iff we're using Perf Counters -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PerfCounter class serves as namespace with data protection. -// Enforce this by making constructor private -//----------------------------------------------------------------------------- -class PerfCounters -{ -private: - PerfCounters(); - -public: - static HRESULT Init(); - static void Terminate(); - - static PerfCounterIPCControlBlock * GetPrivatePerfCounterPtr(); - -private: - static HANDLE m_hPrivateMapPerf; - - static PerfCounterIPCControlBlock * m_pPrivatePerf; - - static BOOL m_fInit; - -// Set pointers to garbage so they're never null. - static PerfCounterIPCControlBlock m_garbage; - - friend PerfCounterIPCControlBlock & GetPerfCounters(); -}; - -//----------------------------------------------------------------------------- -// Utility functions -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Get the perf counters specific to our process -//----------------------------------------------------------------------------- -inline PerfCounterIPCControlBlock & GetPerfCounters() -{ - LIMITED_METHOD_CONTRACT; - - return *PerfCounters::m_pPrivatePerf; -} - -inline PerfCounterIPCControlBlock *PerfCounters::GetPrivatePerfCounterPtr() -{ - LIMITED_METHOD_CONTRACT; - - return m_pPrivatePerf; -}; - -#define COUNTER_ONLY(x) x - -#define PERF_COUNTER_NUM_OF_ITERATIONS 10 - -#if defined(_X86_) && defined(_MSC_VER) - -inline UINT64 GetCycleCount_UINT64() -{ - LIMITED_METHOD_CONTRACT; - return __rdtsc(); -} - -#else // defined(_X86_) && defined(_MSC_VER) -inline UINT64 GetCycleCount_UINT64() -{ - LIMITED_METHOD_CONTRACT; - - LARGE_INTEGER qwTmp; - QueryPerformanceCounter(&qwTmp); - return qwTmp.QuadPart; -} -#endif // defined(_X86_) && defined(_MSC_VER) - -#define PERF_COUNTER_TIMER_PRECISION UINT64 -#define GET_CYCLE_COUNT GetCycleCount_UINT64 - -#define PERF_COUNTER_TIMER_START() \ -PERF_COUNTER_TIMER_PRECISION _startPerfCounterTimer = GET_CYCLE_COUNT(); - -#define PERF_COUNTER_TIMER_STOP(global) \ -global = (GET_CYCLE_COUNT() - _startPerfCounterTimer); - - - - -#else // ENABLE_PERF_COUNTERS -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// This code section active iff we're NOT using Perf Counters -// Note, not even a class definition, so all usages of PerfCounters in client -// should be in #ifdef or COUNTER_ONLY(). -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- - -#define COUNTER_ONLY(x) - - -#endif // ENABLE_PERF_COUNTERS - - -#endif // _PerfCounters_h_ diff --git a/src/strongname/api/common.h b/src/strongname/api/common.h index 16f571a..26c545c 100644 --- a/src/strongname/api/common.h +++ b/src/strongname/api/common.h @@ -301,7 +301,6 @@ namespace Loader #endif #include "typehandle.h" -#include "perfcounters.h" #include "methodtable.h" #include "typectxt.h" diff --git a/src/utilcode/loaderheap.cpp b/src/utilcode/loaderheap.cpp index 0f3a069..e2d242d 100644 --- a/src/utilcode/loaderheap.cpp +++ b/src/utilcode/loaderheap.cpp @@ -4,7 +4,6 @@ #include "stdafx.h" // Precompiled header key. #include "loaderheap.h" -#include "perfcounters.h" #include "ex.h" #include "pedecoder.h" #define DONOT_DEFINE_ETW_CALLBACK diff --git a/src/vm/amd64/excepamd64.cpp b/src/vm/amd64/excepamd64.cpp index 003edce..9424c8d 100644 --- a/src/vm/amd64/excepamd64.cpp +++ b/src/vm/amd64/excepamd64.cpp @@ -23,7 +23,6 @@ #include "siginfo.hpp" #include "gcheaputilities.h" #include "eedbginterfaceimpl.h" //so we can clearexception in COMPlusThrow -#include "perfcounters.h" #include "asmconstants.h" #include "exceptionhandling.h" diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 6d68dff..0be5fd2 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -13,7 +13,6 @@ #include "eeconfig.h" #include "gcheaputilities.h" #include "eventtrace.h" -#include "perfcounters.h" #include "assemblyname.hpp" #include "eeprofinterfaces.h" #include "dbginterface.h" @@ -3742,7 +3741,6 @@ void AppDomain::Init() SetStage(STAGE_READYFORMANAGEDCODE); #ifndef CROSSGEN_COMPILE - COUNTER_ONLY(GetPerfCounters().m_Loading.cAppDomains++); #ifdef FEATURE_TIERED_COMPILATION m_tieredCompilationManager.Init(GetId()); diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index cdbcbf4..1326dfb 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -18,7 +18,6 @@ #include "assembly.hpp" #include "appdomain.hpp" -#include "perfcounters.h" #include "assemblyname.hpp" @@ -173,8 +172,6 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat m_pClassLoader = new ClassLoader(this); m_pClassLoader->Init(pamTracker); - COUNTER_ONLY(GetPerfCounters().m_Loading.cAssemblies++); - #ifndef CROSSGEN_COMPILE if (GetManifestFile()->IsDynamic()) // manifest modules of dynamic assemblies are always transient @@ -356,8 +353,6 @@ void Assembly::Terminate( BOOL signalProfiler ) m_pClassLoader = NULL; } - COUNTER_ONLY(GetPerfCounters().m_Loading.cAssemblies--); - #ifdef PROFILING_SUPPORTED if (CORProfilerTrackAssemblyLoads()) { diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 916cae6..6d1643b 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -25,7 +25,6 @@ #include "dbginterface.h" #include "dllimport.h" #include "eeprofinterfaces.h" -#include "perfcounters.h" #include "encee.h" #include "jitinterface.h" #include "eeconfig.h" @@ -4056,18 +4055,8 @@ void Module::BuildClassForModule() // If we have any work to do... if (cFunctions > 0 || cFields > 0) { - COUNTER_ONLY(size_t _HeapSize = 0); - TypeKey typeKey(this, COR_GLOBAL_PARENT_TOKEN); TypeHandle typeHnd = GetClassLoader()->LoadTypeHandleForTypeKeyNoLock(&typeKey); - -#ifdef ENABLE_PERF_COUNTERS - - _HeapSize = GetLoaderAllocator()->GetHighFrequencyHeap()->GetSize(); - - GetPerfCounters().m_Loading.cbLoaderHeapSize = _HeapSize; -#endif // ENABLE_PERF_COUNTERS - } } @@ -6816,8 +6805,6 @@ LoaderHeap *Module::GetThunkHeap() size_t * pPrivatePCLBytes = NULL; size_t * pGlobalPCLBytes = NULL; - COUNTER_ONLY(pPrivatePCLBytes = &(GetPerfCounters().m_Loading.cbLoaderHeapSize)); - LoaderHeap *pNewHeap = new LoaderHeap(VIRTUAL_ALLOC_RESERVE_GRANULARITY, // DWORD dwReserveBlockSize 0, // DWORD dwCommitBlockSize pPrivatePCLBytes, diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 3b50c02..41b6fe0 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -144,7 +144,6 @@ #include "cordbpriv.h" #include "comdelegate.h" #include "appdomain.hpp" -#include "perfcounters.h" #include "eventtrace.h" #include "corhost.h" #include "binder.h" @@ -795,12 +794,6 @@ void EEStartupHelper(COINITIEE fFlags) } #endif // FEATURE_PREJIT -#ifdef ENABLE_PERF_COUNTERS - hr = PerfCounters::Init(); - _ASSERTE(SUCCEEDED(hr)); - IfFailGo(hr); -#endif - #ifdef FEATURE_INTERPRETER Interpreter::Initialize(); #endif // FEATURE_INTERPRETER @@ -1779,11 +1772,6 @@ part2: } #endif /* SHOULD_WE_CLEANUP */ -#ifdef ENABLE_PERF_COUNTERS - // Terminate Perf Counters as late as we can (to get the most data) - PerfCounters::Terminate(); -#endif // ENABLE_PERF_COUNTERS - //@TODO: find the right place for this VirtualCallStubManager::UninitStatic(); diff --git a/src/vm/class.h b/src/vm/class.h index 03c0da2..6f61437 100644 --- a/src/vm/class.h +++ b/src/vm/class.h @@ -42,7 +42,6 @@ #include "slist.h" #include "spinlock.h" #include "typehandle.h" -#include "perfcounters.h" #include "methodtable.h" #include "eeconfig.h" #include "typectxt.h" diff --git a/src/vm/classcompat.h b/src/vm/classcompat.h index 13801f1..f16fcd0 100644 --- a/src/vm/classcompat.h +++ b/src/vm/classcompat.h @@ -24,7 +24,6 @@ #include "slist.h" #include "spinlock.h" #include "typehandle.h" -#include "perfcounters.h" #include "methodtable.h" #include "eeconfig.h" #include "typectxt.h" diff --git a/src/vm/clrex.cpp b/src/vm/clrex.cpp index d3a1ea5..299b072 100644 --- a/src/vm/clrex.cpp +++ b/src/vm/clrex.cpp @@ -1623,8 +1623,6 @@ OBJECTREF EETypeLoadException::CreateThrowable() } CONTRACTL_END; - COUNTER_ONLY(GetPerfCounters().m_Loading.cLoadFailures++); - MethodTable *pMT = MscorlibBinder::GetException(kTypeLoadException); struct _gc { @@ -1823,8 +1821,6 @@ OBJECTREF EEFileLoadException::CreateThrowable() MODE_COOPERATIVE; } CONTRACTL_END; - - COUNTER_ONLY(GetPerfCounters().m_Loading.cLoadFailures++); // Fetch any log info from the fusion log SString logText; diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 7b35d18..4ffbb3f 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -30,7 +30,6 @@ #include "jitinterface.h" #include "vars.hpp" #include "assembly.hpp" -#include "perfcounters.h" #include "eeprofinterfaces.h" #include "eehash.h" #include "typehash.h" @@ -523,8 +522,6 @@ TypeHandle ClassLoader::LoadTypeHandleThrowIfFailed(NameHandle* pName, ClassLoad #endif #ifndef DACCESS_COMPILE - COUNTER_ONLY(GetPerfCounters().m_Loading.cLoadFailures++); - m_pAssembly->ThrowTypeLoadException(pName, IDS_CLASSLOAD_GENERAL); #else DacNotImpl(); @@ -3655,10 +3652,6 @@ void ClassLoader::Notify(TypeHandle typeHnd) typeHnd.NotifyDebuggerLoad(NULL, FALSE); } #endif // DEBUGGING_SUPPORTED - -#if defined(ENABLE_PERF_COUNTERS) - GetPerfCounters().m_Loading.cClassesLoaded ++; -#endif } } diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp index 24987a8..415cfa8 100644 --- a/src/vm/comcallablewrapper.cpp +++ b/src/vm/comcallablewrapper.cpp @@ -35,7 +35,6 @@ #include "eeconfig.h" #include "interoputil.h" #include "dispex.h" -#include "perfcounters.h" #include "guidfromname.h" #include "comconnectionpoints.h" #include // IID_IObjctSafe @@ -3777,8 +3776,6 @@ LONG ComCallWrapperCache::AddRef() } CONTRACTL_END; - COUNTER_ONLY(GetPerfCounters().m_Interop.cCCW++); - LONG i = FastInterlockIncrement(&m_cbRef); LOG((LF_INTEROP, LL_INFO100, "ComCallWrapperCache::Addref %8.8x with %d in loader allocator [%d] %8.8x\n", this, i, GetLoaderAllocator()?GetLoaderAllocator()->GetCreationNumber() : 0, GetLoaderAllocator())); @@ -3799,8 +3796,6 @@ LONG ComCallWrapperCache::Release() MODE_ANY; } CONTRACTL_END; - - COUNTER_ONLY(GetPerfCounters().m_Interop.cCCW--); LONG i = FastInterlockDecrement(&m_cbRef); _ASSERTE(i >= 0); diff --git a/src/vm/common.h b/src/vm/common.h index a04da0a..94617c3 100644 --- a/src/vm/common.h +++ b/src/vm/common.h @@ -319,7 +319,6 @@ namespace Loader #endif #include "typehandle.h" -#include "perfcounters.h" #include "methodtable.h" #include "typectxt.h" diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index 9f8aeb7..d92b2e0 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -1752,44 +1752,8 @@ public: ENTRY_POINT; } CONTRACTL_END; - - HRESULT hr = S_OK; - BEGIN_ENTRYPOINT_NOTHROW; - - #if defined(ENABLE_PERF_COUNTERS) - - Perf_GC *pgc = &GetPerfCounters().m_GC; - - if (!pStats) - IfFailGo(E_INVALIDARG); - - if (pStats->Flags & COR_GC_COUNTS) - { - pStats->ExplicitGCCount = pgc->cInducedGCs; - - for (int idx=0; idx<3; idx++) - pStats->GenCollectionsTaken[idx] = pgc->cGenCollections[idx]; - } - - if (pStats->Flags & COR_GC_MEMORYUSAGE) - { - pStats->CommittedKBytes = SizeInKBytes(pgc->cTotalCommittedBytes); - pStats->ReservedKBytes = SizeInKBytes(pgc->cTotalReservedBytes); - pStats->Gen0HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[0]); - pStats->Gen1HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[1]); - pStats->Gen2HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[2]); - pStats->LargeObjectHeapSizeKBytes = SizeInKBytes(pgc->cLrgObjSize); - pStats->KBytesPromotedFromGen0 = SizeInKBytes(pgc->cbPromotedMem[0]); - pStats->KBytesPromotedFromGen1 = SizeInKBytes(pgc->cbPromotedMem[1]); - } - hr = S_OK; -ErrExit: - #else - hr = E_NOTIMPL; - #endif // ENABLE_PERF_COUNTERS - - END_ENTRYPOINT_NOTHROW; - return hr; + + return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE SetGCStartupLimits( DWORD SegmentSize, diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 019ec25..7db5e90 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -22,7 +22,6 @@ #include "siginfo.hpp" #include "gcheaputilities.h" #include "eedbginterfaceimpl.h" //so we can clearexception in RealCOMPlusThrow -#include "perfcounters.h" #include "dllimportcallback.h" #include "stackwalk.h" //for CrawlFrame, in SetIPFromSrcToDst #include "shimload.h" @@ -3627,7 +3626,6 @@ BOOL StackTraceInfo::AppendElement(BOOL bAllowAllocMem, UINT_PTR currentIP, UINT ++m_dFrameCount; bRetVal = TRUE; - COUNTER_ONLY(GetPerfCounters().m_Excep.cThrowToCatchStackDepth++); } #ifndef FEATURE_PAL // Watson is supported on Windows only diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index 10e35bb..7950182 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -13,7 +13,6 @@ #include "asmconstants.h" #include "eetoprofinterfacewrapper.inl" #include "eedbginterfaceimpl.inl" -#include "perfcounters.h" #include "eventtrace.h" #include "virtualcallstub.h" #include "utilcode.h" @@ -198,7 +197,6 @@ void FreeTrackerMemory(ExceptionTracker* pTracker, TrackerMemoryType mem) static inline void UpdatePerformanceMetrics(CrawlFrame *pcfThisFrame, BOOL bIsRethrownException, BOOL bIsNewException) { WRAPPER_NO_CONTRACT; - COUNTER_ONLY(GetPerfCounters().m_Excep.cThrown++); // Fire an exception thrown ETW event when an exception occurs ETW::ExceptionLog::ExceptionThrown(pcfThisFrame, bIsRethrownException, bIsNewException); @@ -4147,8 +4145,6 @@ void ExceptionTracker::MakeCallbacksRelatedToHandler( EEToDebuggerExceptionInterfaceWrapper::ExceptionFilter(pMD, (TADDR) dwHandlerStartPC, pEHClause->FilterOffset, (BYTE*)sf.SP); EEToProfilerExceptionInterfaceWrapper::ExceptionSearchFilterEnter(pMD); - - COUNTER_ONLY(GetPerfCounters().m_Excep.cFiltersExecuted++); } else { @@ -4158,7 +4154,6 @@ void ExceptionTracker::MakeCallbacksRelatedToHandler( { m_EHClauseInfo.SetEHClauseType(COR_PRF_CLAUSE_FINALLY); EEToProfilerExceptionInterfaceWrapper::ExceptionUnwindFinallyEnter(pMD); - COUNTER_ONLY(GetPerfCounters().m_Excep.cFinallysExecuted++); } else { diff --git a/src/vm/genmeth.cpp b/src/vm/genmeth.cpp index 8f282fa..5d09cdf 100644 --- a/src/vm/genmeth.cpp +++ b/src/vm/genmeth.cpp @@ -12,7 +12,6 @@ #include "method.hpp" #include "field.h" #include "eeconfig.h" -#include "perfcounters.h" #include "crst.h" #include "generics.h" #include "genericdict.h" diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp index c837b55..b08f5ef 100644 --- a/src/vm/i386/excepx86.cpp +++ b/src/vm/i386/excepx86.cpp @@ -21,7 +21,6 @@ #include "siginfo.hpp" #include "gcheaputilities.h" #include "eedbginterfaceimpl.h" //so we can clearexception in COMPlusThrow -#include "perfcounters.h" #include "eventtrace.h" #include "eetoprofinterfacewrapper.inl" #include "eedbginterfaceimpl.inl" @@ -431,13 +430,6 @@ CPFH_AdjustContextForThreadSuspensionRace(CONTEXT *pContext, Thread *pThread) -static inline void -CPFH_UpdatePerformanceCounters() { - WRAPPER_NO_CONTRACT; - COUNTER_ONLY(GetPerfCounters().m_Excep.cThrown++); -} - - //****************************************************************************** EXCEPTION_DISPOSITION COMPlusAfterUnwind( EXCEPTION_RECORD *pExceptionRecord, @@ -1063,7 +1055,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc. EEToProfilerExceptionInterfaceWrapper::ExceptionThrown(pThread); - CPFH_UpdatePerformanceCounters(); } // End of case-1-or-3 { @@ -2607,8 +2598,6 @@ StackWalkAction COMPlusThrowCallback( // SWA value if (fGiveDebuggerAndProfilerNotification) EEToProfilerExceptionInterfaceWrapper::ExceptionSearchFilterEnter(pFunc); - COUNTER_ONLY(GetPerfCounters().m_Excep.cFiltersExecuted++); - STRESS_LOG3(LF_EH, LL_INFO10, "COMPlusThrowCallback: calling filter code, EHClausePtr:%08x, Start:%08x, End:%08x\n", &EHClause, EHClause.HandlerStartPC, EHClause.HandlerEndPC); @@ -2947,8 +2936,6 @@ StackWalkAction COMPlusUnwindCallback (CrawlFrame *pCf, ThrowCallbackType *pData if (IsFaultOrFinally(&EHClause)) { - COUNTER_ONLY(GetPerfCounters().m_Excep.cFinallysExecuted++); - if (fGiveDebuggerAndProfilerNotification) EEToDebuggerExceptionInterfaceWrapper::ExceptionHandle(pFunc, pMethodAddr, EHClause.HandlerStartPC, pHandlerEBP); diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index ea1d2da..0144d96 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -32,7 +32,6 @@ #include "process.h" #endif // !FEATURE_PAL -#include "perfcounters.h" #ifdef PROFILING_SUPPORTED #include "proftoeeinterfaceimpl.h" #endif diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 49d4857..31f6d1a 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -30,7 +30,6 @@ #include "jitperf.h" // to track jit perf #include "corprof.h" #include "eeprofinterfaces.h" -#include "perfcounters.h" #ifdef PROFILING_SUPPORTED #include "proftoeeinterfaceimpl.h" #include "eetoprofinterfaceimpl.h" @@ -103,12 +102,6 @@ GARY_IMPL(VMHELPDEF, hlpDynamicFuncTable, DYNAMIC_CORINFO_HELP_COUNT); /*********************************************************************/ -#if defined(ENABLE_PERF_COUNTERS) -LARGE_INTEGER g_lastTimeInJitCompilation; -#endif - -/*********************************************************************/ - inline CORINFO_MODULE_HANDLE GetScopeHandle(MethodDesc* method) { LIMITED_METHOD_CONTRACT; @@ -12873,15 +12866,6 @@ PCODE UnsafeJitFunction(NativeCodeVersion nativeCodeVersion, COR_ILMETHOD_DECODE QueryPerformanceCounter (&methodJitTimeStart); #endif -#if defined(ENABLE_PERF_COUNTERS) - START_JIT_PERF(); -#endif - -#if defined(ENABLE_PERF_COUNTERS) - LARGE_INTEGER CycleStart; - QueryPerformanceCounter (&CycleStart); -#endif // defined(ENABLE_PERF_COUNTERS) - // Note on debuggerTrackInfo arg: if we're only importing (ie, verifying/ // checking to make sure we could JIT, but not actually generating code ( // eg, for inlining), then DON'T TELL THE DEBUGGER about this. @@ -12902,20 +12886,6 @@ PCODE UnsafeJitFunction(NativeCodeVersion nativeCodeVersion, COR_ILMETHOD_DECODE } #endif -#if defined(ENABLE_PERF_COUNTERS) - LARGE_INTEGER CycleStop; - QueryPerformanceCounter(&CycleStop); - GetPerfCounters().m_Jit.timeInJitBase = GetPerfCounters().m_Jit.timeInJit; - GetPerfCounters().m_Jit.timeInJit += static_cast(CycleStop.QuadPart - CycleStart.QuadPart); - GetPerfCounters().m_Jit.cMethodsJitted++; - GetPerfCounters().m_Jit.cbILJitted+=methodInfo.ILCodeSize; - -#endif // defined(ENABLE_PERF_COUNTERS) - -#if defined(ENABLE_PERF_COUNTERS) - STOP_JIT_PERF(); -#endif - #ifdef PERF_TRACK_METHOD_JITTIMES //store the time in the string buffer. Module name and token are unique enough. Also, do not //capture importing time, just actual compilation time. @@ -12941,8 +12911,6 @@ PCODE UnsafeJitFunction(NativeCodeVersion nativeCodeVersion, COR_ILMETHOD_DECODE if (!SUCCEEDED(res)) { - COUNTER_ONLY(GetPerfCounters().m_Jit.cJitFailures++); - #ifndef CROSSGEN_COMPILE jitInfo.BackoutJitData(jitMgr); #endif diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp index 7d08e46..ac894b2 100644 --- a/src/vm/peimage.cpp +++ b/src/vm/peimage.cpp @@ -739,8 +739,6 @@ LoaderHeap *PEImage::IJWFixupData::GetThunkHeap() size_t * pPrivatePCLBytes = NULL; size_t * pGlobalPCLBytes = NULL; - COUNTER_ONLY(pPrivatePCLBytes = &(GetPerfCounters().m_Loading.cbLoaderHeapSize)); - LoaderHeap *pNewHeap = new LoaderHeap(VIRTUAL_ALLOC_RESERVE_GRANULARITY, // DWORD dwReserveBlockSize 0, // DWORD dwCommitBlockSize pPrivatePCLBytes, diff --git a/src/vm/stublink.cpp b/src/vm/stublink.cpp index 963555c..218848a 100644 --- a/src/vm/stublink.cpp +++ b/src/vm/stublink.cpp @@ -12,7 +12,6 @@ #include "threads.h" #include "excep.h" #include "stublink.h" -#include "perfcounters.h" #include "stubgen.h" #include "stublink.inl" @@ -1969,8 +1968,6 @@ VOID Stub::DeleteStub() } CONTRACTL_END; - COUNTER_ONLY(GetPerfCounters().m_Interop.cStubs--); - #ifdef STUBLINKER_GENERATES_UNWIND_INFO if (HasUnwindInfo()) { @@ -2149,8 +2146,6 @@ Stub* Stub::NewStub(PTR_VOID pCode, DWORD flags) _ASSERTE(!nUnwindInfoSize || !pHeap || pHeap->m_fPermitStubsWithUnwindInfo); #endif // STUBLINKER_GENERATES_UNWIND_INFO - COUNTER_ONLY(GetPerfCounters().m_Interop.cStubs++); - S_SIZE_T size = S_SIZE_T(sizeof(Stub)); if (flags & NEWSTUB_FL_INTERCEPT) diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp index 30b2930..69defcf 100644 --- a/src/vm/syncblk.cpp +++ b/src/vm/syncblk.cpp @@ -22,7 +22,6 @@ #include "syncblk.h" #include "interoputil.h" #include "encee.h" -#include "perfcounters.h" #include "eventtrace.h" #include "dllimportcallback.h" #include "comcallablewrapper.h" @@ -309,7 +308,6 @@ inline WaitEventLink *ThreadQueue::DequeueThread(SyncBlock *psb) #endif ret = WaitEventLinkForLink(pLink); _ASSERTE(ret->m_WaitSB == psb); - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cQueueLength--); } return ret; } @@ -334,8 +332,6 @@ inline void ThreadQueue::EnqueueThread(WaitEventLink *pWaitEventLink, SyncBlock // it must be valid even if the lock is held. Be careful if you change the way the queue is updated. SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache()); - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cQueueLength++); - SLink *pPrior = &psb->m_Link; while (pPrior->m_pNext) @@ -382,7 +378,6 @@ BOOL ThreadQueue::RemoveThread (Thread *pThread, SyncBlock *psb) pLink->m_pNext = (SLink *)POISONC; #endif _ASSERTE(pWaitEventLink->m_WaitSB == psb); - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cQueueLength--); res = TRUE; break; } @@ -3043,8 +3038,6 @@ BOOL AwareLock::EnterEpilogHelper(Thread* pCurThread, INT32 timeOut) // the object associated with this lock. _ASSERTE(pCurThread->PreemptiveGCDisabled()); - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cContention++); - // Fire a contention start event for a managed contention FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId()); diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 8bb63b7..7b99d2b 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -23,7 +23,6 @@ #include "corprof.h" // profiling #include "eeprofinterfaces.h" #include "eeconfig.h" -#include "perfcounters.h" #include "corhost.h" #include "win32threadpool.h" #include "jitinterface.h" @@ -1494,9 +1493,6 @@ Thread::Thread() _ASSERTE((((size_t) &m_State) & 3) == 0); _ASSERTE((((size_t) &m_ThreadTasks) & 3) == 0); - // Track perf counter for the logical thread object. - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cCurrentThreadsLogical++); - // On all callbacks, call the trap code, which we now have // wired to cause a GC. Thus we will do a GC on all Transition Frame Transitions (and more). if (GCStress::IsEnabled()) @@ -1654,15 +1650,6 @@ BOOL Thread::InitThread(BOOL fInternal) // log will not allocate memory at these critical times an avoid deadlock. STRESS_LOG2(LF_ALWAYS, LL_ALWAYS, "SetupThread managed Thread %p Thread Id = %x\n", this, GetThreadId()); - if ((m_State & TS_WeOwn) == 0) - { - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cRecognizedThreads++); - } - else - { - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cCurrentThreadsPhysical++); - } - #ifndef FEATURE_PAL // workaround: Remove this when we flow impersonation token to host. BOOL reverted = FALSE; @@ -2609,20 +2596,6 @@ Thread::~Thread() m_pFrame = (Frame *)POISONC; #endif - // Update Perfmon counters. - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cCurrentThreadsLogical--); - - // Current recognized threads are non-runtime threads that are alive and ran under the - // runtime. Check whether this Thread was one of them. - if ((m_State & TS_WeOwn) == 0) - { - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cRecognizedThreads--); - } - else - { - COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cCurrentThreadsPhysical--); - } - // Normally we shouldn't get here with a valid thread handle; however if SetupThread // failed (due to an OOM for example) then we need to CloseHandle the thread // handle if we own it. diff --git a/src/vm/virtualcallstub.cpp b/src/vm/virtualcallstub.cpp index 6eab546..4c6ad0d 100644 --- a/src/vm/virtualcallstub.cpp +++ b/src/vm/virtualcallstub.cpp @@ -721,12 +721,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder indcell_heap_holder( new LoaderHeap(indcell_heap_reserve_size, indcell_heap_commit_size, initReservedMem, indcell_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else - NULL, -#endif - NULL, FALSE)); + NULL, NULL, FALSE)); initReservedMem += indcell_heap_reserve_size; @@ -734,11 +729,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder cache_entry_heap_holder( new LoaderHeap(cache_entry_heap_reserve_size, cache_entry_heap_commit_size, initReservedMem, cache_entry_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else NULL, -#endif &cache_entry_rangeList, FALSE)); initReservedMem += cache_entry_heap_reserve_size; @@ -747,11 +738,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder lookup_heap_holder( new LoaderHeap(lookup_heap_reserve_size, lookup_heap_commit_size, initReservedMem, lookup_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else NULL, -#endif &lookup_rangeList, TRUE)); initReservedMem += lookup_heap_reserve_size; @@ -760,11 +747,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder dispatch_heap_holder( new LoaderHeap(dispatch_heap_reserve_size, dispatch_heap_commit_size, initReservedMem, dispatch_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else NULL, -#endif &dispatch_rangeList, TRUE)); initReservedMem += dispatch_heap_reserve_size; @@ -773,11 +756,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder resolve_heap_holder( new LoaderHeap(resolve_heap_reserve_size, resolve_heap_commit_size, initReservedMem, resolve_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else NULL, -#endif &resolve_rangeList, TRUE)); initReservedMem += resolve_heap_reserve_size; @@ -786,11 +765,7 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA NewHolder vtable_heap_holder( new LoaderHeap(vtable_heap_reserve_size, vtable_heap_commit_size, initReservedMem, vtable_heap_reserve_size, -#ifdef ENABLE_PERF_COUNTERS - &(GetPerfCounters().m_Loading.cbLoaderHeapSize), -#else NULL, -#endif &vtable_rangeList, TRUE)); initReservedMem += vtable_heap_reserve_size;