Skip to content

Commit

Permalink
Collect stats about sizes of different types of messages sent
Browse files Browse the repository at this point in the history
I'm keeping track of the size of different types of messages sent using msg.type()
and I'm using the class TR_Stats to store avg,min,max and stddev of every type of message.
I declared a static array in CommunicationStream.hpp and I'm using that to store in.
issue: eclipse-openj9#9708

Signed-off-by: Eman Elsabban <eman.elsaban1@gmail.com>
  • Loading branch information
EmanElsaban committed Jun 5, 2020
1 parent 67cfc35 commit a5cd649
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
17 changes: 15 additions & 2 deletions runtime/compiler/control/JITServerHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "control/JITServerCompilationThread.hpp"
#include "control/MethodToBeCompiled.hpp"
#include "infra/CriticalSection.hpp"
#include "infra/Statistics.hpp"
#include "net/CommunicationStream.hpp"



uint32_t JITServerHelpers::serverMsgTypeCount[] = {};
Expand Down Expand Up @@ -123,12 +126,22 @@ JITServerHelpers::printJITServerMsgStats(J9JITConfig *jitConfig)
int totalMsgCount = 0;
PORT_ACCESS_FROM_JITCONFIG(jitConfig);
j9tty_printf(PORTLIB, "JITServer Message Type Statistics:\n");
j9tty_printf(PORTLIB, "Type# #called TypeName\n");
j9tty_printf(PORTLIB, "Type# #called");
#ifdef MESSAGE_SIZE_STATS
j9tty_printf(PORTLIB, "\t\tMax\t\tMin\t\tMean\t\tStdDev\t\tSum");
#endif
j9tty_printf(PORTLIB, "\t\tTypeName\n");
for (int i = 0; i < JITServer::MessageType_ARRAYSIZE; ++i)
{
if (JITServerHelpers::serverMsgTypeCount[i] > 0)
{
j9tty_printf(PORTLIB, "#%04d %7u %s\n", i, JITServerHelpers::serverMsgTypeCount[i], JITServer::messageNames[i]);
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(),
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];
}
}
Expand Down
8 changes: 8 additions & 0 deletions runtime/compiler/net/CommunicationStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
namespace JITServer
{
uint32_t CommunicationStream::CONFIGURATION_FLAGS = 0;
#ifdef MESSAGE_SIZE_STATS
TR_Stats JITServer::CommunicationStream::collectMsgStat[];
#endif

void
CommunicationStream::initConfigurationFlags()
Expand Down Expand Up @@ -73,6 +76,11 @@ CommunicationStream::readMessage(Message &msg)

// rebuild the message
msg.deserialize();

// collect message size
#ifdef MESSAGE_SIZE_STATS
collectMsgStat[int(msg.type())].update(messageSize);
#endif
}

void
Expand Down
5 changes: 5 additions & 0 deletions runtime/compiler/net/CommunicationStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <openssl/err.h>
#include "net/LoadSSLLibs.hpp"
#include "net/Message.hpp"
#include "infra/Statistics.hpp"


namespace JITServer
Expand All @@ -43,6 +44,10 @@ class CommunicationStream
public:
static bool useSSL();
static void initSSL();

#ifdef MESSAGE_SIZE_STATS
static TR_Stats collectMsgStat[JITServer::MessageType_ARRAYSIZE];
#endif

static void initConfigurationFlags();

Expand Down

0 comments on commit a5cd649

Please sign in to comment.