Skip to content

Commit

Permalink
Merge pull request #9870 from EmanElsaban/serverStats
Browse files Browse the repository at this point in the history
Modified printJITServerMsgStats to print at shutdown on server
  • Loading branch information
mpirvu committed Jun 18, 2020
2 parents 79566c7 + facc2a4 commit 4d40192
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/control/HookedByTheJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4164,8 +4164,8 @@ void JitShutdown(J9JITConfig * jitConfig)

#if defined(J9VM_OPT_JITSERVER)
static char * isPrintJITServerMsgStats = feGetEnv("TR_PrintJITServerMsgStats");
if (isPrintJITServerMsgStats && compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT)
JITServerHelpers::printJITServerMsgStats(jitConfig);
if (isPrintJITServerMsgStats)
JITServerHelpers::printJITServerMsgStats(jitConfig, compInfo);
static char * isPrintJITServerCHTableStats = feGetEnv("TR_PrintJITServerCHTableStats");
if (isPrintJITServerCHTableStats)
JITServerHelpers::printJITServerCHTableStats(jitConfig, compInfo);
Expand Down
49 changes: 36 additions & 13 deletions runtime/compiler/control/JITServerHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,56 @@ JITServerHelpers::insertIntoOOSequenceEntryList(ClientSessionData *clientData, T
}

void
JITServerHelpers::printJITServerMsgStats(J9JITConfig *jitConfig)
JITServerHelpers::printJITServerMsgStats(J9JITConfig *jitConfig, TR::CompilationInfo *compInfo)
{
int totalMsgCount = 0;
unsigned totalMsgCount = 0;
PORT_ACCESS_FROM_JITCONFIG(jitConfig);
j9tty_printf(PORTLIB, "JITServer Message Type Statistics:\n");
j9tty_printf(PORTLIB, "Type# #called");
#ifdef MESSAGE_SIZE_STATS
#ifdef MESSAGE_SIZE_STATS
j9tty_printf(PORTLIB, "\t\tMax\t\tMin\t\tMean\t\tStdDev\t\tSum");
#endif
#endif // defined(MESSAGE_SIZE_STATS)
j9tty_printf(PORTLIB, "\t\tTypeName\n");
for (int i = 0; i < JITServer::MessageType_ARRAYSIZE; ++i)
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT)
{
if (JITServerHelpers::serverMsgTypeCount[i] > 0)
for (int i = 0; i < JITServer::MessageType_ARRAYSIZE; ++i)
{
j9tty_printf(PORTLIB, "#%04d %7u", i, JITServerHelpers::serverMsgTypeCount[i]);
if (JITServerHelpers::serverMsgTypeCount[i] > 0)
{
j9tty_printf(PORTLIB, "#%04d %7u", i, JITServerHelpers::serverMsgTypeCount[i]);
#ifdef MESSAGE_SIZE_STATS
j9tty_printf(PORTLIB, "\t%f\t%f\t%f\t%f\t%f", JITServer::CommunicationStream::collectMsgStat[i].maxVal(),
j9tty_printf(PORTLIB, "\t%f\t%f\t%f\t%f\t%f", JITServer::CommunicationStream::collectMsgStat[i].maxVal(),
JITServer::CommunicationStream::collectMsgStat[i].minVal(), JITServer::CommunicationStream::collectMsgStat[i].mean(),
JITServer::CommunicationStream::collectMsgStat[i].stddev(), JITServer::CommunicationStream::collectMsgStat[i].sum());
#endif
j9tty_printf(PORTLIB, "\t\t%s\n", JITServer::messageNames[i]);
totalMsgCount += JITServerHelpers::serverMsgTypeCount[i];
#endif // defined(MESSAGE_SIZE_STATS)
j9tty_printf(PORTLIB, "\t\t%s\n", JITServer::messageNames[i]);
totalMsgCount += JITServerHelpers::serverMsgTypeCount[i];
}
}
if (JITServerHelpers::serverMsgTypeCount[0])
j9tty_printf(PORTLIB, "Total number of messages: %d. Average number of messages per compilation:%f\n", totalMsgCount, totalMsgCount/float(JITServerHelpers::serverMsgTypeCount[0]));
}
if (JITServerHelpers::serverMsgTypeCount[0])
j9tty_printf(PORTLIB, "Total number of messages: %d. Average number of messages per compilation:%f\n", totalMsgCount, totalMsgCount/float(JITServerHelpers::serverMsgTypeCount[0]));
else if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER)
{
// to print in server, run ./jitserver -Xdump:jit:events=user
// then kill -3 <pidof jitserver>
#ifdef MESSAGE_SIZE_STATS
for (int i = 0; i < JITServer::MessageType_ARRAYSIZE; ++i)
{
if (JITServer::CommunicationStream::collectMsgStat[i].samples() > 0)
{
j9tty_printf(PORTLIB, "#%04d %7u", i, JITServer::CommunicationStream::collectMsgStat[i].samples());
j9tty_printf(PORTLIB, "\t%f\t%f\t%f\t%f\t%f", JITServer::CommunicationStream::collectMsgStat[i].maxVal(),
JITServer::CommunicationStream::collectMsgStat[i].minVal(), JITServer::CommunicationStream::collectMsgStat[i].mean(),
JITServer::CommunicationStream::collectMsgStat[i].stddev(), JITServer::CommunicationStream::collectMsgStat[i].sum());

j9tty_printf(PORTLIB, "\t\t%s\n", JITServer::messageNames[i]);
totalMsgCount += JITServer::CommunicationStream::collectMsgStat[i].samples();
}
}
j9tty_printf(PORTLIB, "Total number of messages: %u\n", totalMsgCount);
#endif // defined(MESSAGE_SIZE_STATS)
}
}

void
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/control/JITServerHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class JITServerHelpers
static void postStreamConnectionSuccess();
static bool isServerAvailable() { return _serverAvailable; }

static void printJITServerMsgStats(J9JITConfig *);
static void printJITServerMsgStats(J9JITConfig *, TR::CompilationInfo *);
static void printJITServerCHTableStats(J9JITConfig *, TR::CompilationInfo *);
static void printJITServerCacheStats(J9JITConfig *, TR::CompilationInfo *);

Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/control/JitDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ runJitdump(char *label, J9RASdumpContext *context, J9RASdumpAgent *agent)
if (compInfo)
{
static char * isPrintJITServerMsgStats = feGetEnv("TR_PrintJITServerMsgStats");
if (isPrintJITServerMsgStats && compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT)
JITServerHelpers::printJITServerMsgStats(jitConfig);
if (isPrintJITServerMsgStats)
JITServerHelpers::printJITServerMsgStats(jitConfig, compInfo);
if (feGetEnv("TR_PrintJITServerCHTableStats"))
JITServerHelpers::printJITServerCHTableStats(jitConfig, compInfo);
if (feGetEnv("TR_PrintJITServerIPMsgStats"))
Expand Down

0 comments on commit 4d40192

Please sign in to comment.