Skip to content

Commit

Permalink
Fix VirtualCallStubManager stats capturing on EE shutdown (dotnet#102073
Browse files Browse the repository at this point in the history
)

* Fix VirtualCallStubManager stats capturing on EE shutdown

Before this change logging stats to StubLog file doesn't work because on EE shutdown
we don't shut down manager. Since it's only about logging we can perform uninit earlier.

* Address code review comments
  • Loading branch information
yurai007 authored and Ruihan-Yin committed May 30, 2024
1 parent 195b55c commit fd0482c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/coreclr/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,8 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
// This will check a flag and do nothing if not enabled.
Interpreter::PrintPostMortemData();
#endif // FEATURE_INTERPRETER
VirtualCallStubManager::LogFinalStats();
WriteJitHelperCountToSTRESSLOG();

#ifdef PROFILING_SUPPORTED
// If profiling is enabled, then notify of shutdown first so that the
Expand Down Expand Up @@ -1349,11 +1351,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
TerminateDebugger();
#endif // DEBUGGING_SUPPORTED

//@TODO: find the right place for this
VirtualCallStubManager::UninitStatic();

WriteJitHelperCountToSTRESSLOG();

STRESS_LOG0(LF_STARTUP, LL_INFO10, "EEShutdown shutting down logging");

#if 0 // Dont clean up the stress log, so that even at process exit we have a log (after all the process is going away
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/vm/virtualcallstub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,7 @@ void VirtualCallStubManager::InitStatic()
VirtualCallStubManagerManager::InitStatic();
}

// Static shutdown code.
// At the moment, this doesn't do anything more than log statistics.
void VirtualCallStubManager::UninitStatic()
void VirtualCallStubManager::LogFinalStats()
{
CONTRACTL
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/virtualcallstub.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ class VirtualCallStubManager : public StubManager

// Set up static data structures - called during EEStartup
static void InitStatic();
static void UninitStatic();
static void LogFinalStats();

// Per instance initialization - called during AppDomain::Init and ::Uninit and for collectible loader allocators
void Init(BaseDomain* pDomain, LoaderAllocator *pLoaderAllocator);
void Uninit();

//@TODO: the logging should be tied into the VMs normal loggin mechanisms,
//@TODO: the logging should be tied into the VMs normal logging mechanisms,
//@TODO: for now we just always write a short log file called "StubLog_<pid>.log"
static void StartupLogging();
static void LoggingDump();
Expand Down

0 comments on commit fd0482c

Please sign in to comment.