Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close and Reopen JIT log files across a checkpoint/restore #20935

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
61 changes: 61 additions & 0 deletions runtime/compiler/runtime/CRRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "infra/Assert.hpp"
#include "infra/CriticalSection.hpp"
#include "infra/Monitor.hpp"
#include "runtime/CodeRuntime.hpp"
#include "runtime/CRRuntime.hpp"
#include "runtime/IProfiler.hpp"
#include "runtime/J9VMAccess.hpp"
Expand Down Expand Up @@ -677,6 +678,62 @@ TR::CRRuntime::resetStartTime()
_restoreTime = persistentInfo->getElapsedTime();
}

void
TR::CRRuntime::closeLogFiles()
{
TR_JitPrivateConfig *privateConfig = (TR_JitPrivateConfig*)getJITConfig()->privateConfig;

if (privateConfig->vLogFileName)
{
TR_VerboseLog::vlogAcquire();
j9jit_fclose(privateConfig->vLogFile);
privateConfig->vLogFile = NULL;
TR_VerboseLog::vlogRelease();
}

if (privateConfig->rtLogFileName)
{
JITRT_LOCK_LOG(getJITConfig());
j9jit_fclose(privateConfig->rtLogFile);
privateConfig->rtLogFile = NULL;
JITRT_UNLOCK_LOG(getJITConfig());

TR::CompilationInfoPerThread * const * arrayOfCompInfoPT = getCompInfo()->getArrayOfCompilationInfoPerThread();
for (int32_t i = 0; i < getCompInfo()->getNumTotalAllocatedCompilationThreads(); i++)
{
TR::CompilationInfoPerThread *compThreadInfoPT = arrayOfCompInfoPT[i];
compThreadInfoPT->closeRTLogFile();
}
}
}

void
TR::CRRuntime::reopenLogFiles()
{
TR_JitPrivateConfig *privateConfig = (TR_JitPrivateConfig*)getJITConfig()->privateConfig;

if (privateConfig->vLogFileName)
{
TR_VerboseLog::vlogAcquire();
privateConfig->vLogFile = fileOpen(TR::Options::getCmdLineOptions(), getJITConfig(), privateConfig->vLogFileName, "wb", true);
TR_VerboseLog::vlogRelease();
}

if (privateConfig->rtLogFileName)
{
JITRT_LOCK_LOG(getJITConfig());
privateConfig->rtLogFile = fileOpen(TR::Options::getCmdLineOptions(), getJITConfig(), privateConfig->rtLogFileName, "wb", true);
JITRT_UNLOCK_LOG(getJITConfig());

TR::CompilationInfoPerThread * const * arrayOfCompInfoPT = getCompInfo()->getArrayOfCompilationInfoPerThread();
for (int32_t i = 0; i < getCompInfo()->getNumTotalAllocatedCompilationThreads(); i++)
{
TR::CompilationInfoPerThread *compThreadInfoPT = arrayOfCompInfoPT[i];
compThreadInfoPT->openRTLogFile();
}
}
}

void
TR::CRRuntime::prepareForCheckpoint()
{
Expand Down Expand Up @@ -751,6 +808,8 @@ TR::CRRuntime::prepareForCheckpoint()

if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseCheckpointRestore))
TR_VerboseLog::writeLineLocked(TR_Vlog_CHECKPOINT_RESTORE, "Ready for checkpoint");

closeLogFiles();
}

void
Expand All @@ -762,6 +821,8 @@ TR::CRRuntime::prepareForRestore()
PORT_ACCESS_FROM_JAVAVM(vm);
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);

reopenLogFiles();

if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseCheckpointRestore))
TR_VerboseLog::writeLineLocked(TR_Vlog_CHECKPOINT_RESTORE, "Preparing for restore");

Expand Down
10 changes: 10 additions & 0 deletions runtime/compiler/runtime/CRRuntime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ class CRRuntime
*/
void resetStartTime();

/**
* @brief Closes various log files
*/
void closeLogFiles();

/**
* @brief Reopens log files closed at checkpoint
*/
void reopenLogFiles();

/**
* @brief Helper method to push a J9Method onto the front of list that is
* used to memoize a future compilation of said J9Method. This method
Expand Down