Skip to content

Commit

Permalink
Refactors JITRuntime::printStat()
Browse files Browse the repository at this point in the history
Issue: #17
Issue: #92
  • Loading branch information
0x7CFE committed Jul 21, 2016
1 parent 9741b46 commit 206db1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions include/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ class MethodCompiler {
}
};

type::TypeSystem& getTypeSystem() { return m_typeSystem; }

private:
JITRuntime& m_runtime;
Expand Down
26 changes: 12 additions & 14 deletions src/JITRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,23 @@ static bool compareByHitCount(const JITRuntime::THotMethod* m1, const JITRuntime

void JITRuntime::printStat()
{
float hitRatio = 100.0 * m_cacheHits / (m_cacheHits + m_cacheMisses);
float blockHitRatio = 100.0 * m_blockCacheHits / (m_blockCacheHits + m_blockCacheMisses);
float messagehitRatio = 100.0 * m_cacheHits / (m_cacheHits + m_cacheMisses);
float blockHitRatio = 100.0 * m_blockCacheHits / (m_blockCacheHits + m_blockCacheMisses);

std::printf(
"JIT Runtime stat:\n"
"\tMessages dispatched: %12d\n"
"\tObjects allocated: %12d\n"
"\tBlocks invoked: %12d\n"
"\tBlockReturn emitted: %12d\n"
"\tBlock cache hits: %12d misses %10d ratio %6.2f %%\n"
"\tMessage cache hits: %12d misses %10d ratio %6.2f %%\n",

m_messagesDispatched,
m_objectsAllocated,
m_blocksInvoked, m_blockReturnsEmitted,
m_blockCacheHits, m_blockCacheMisses, blockHitRatio,
m_cacheHits, m_cacheMisses, hitRatio
"\tDynamic messages: %12d total, %12d hits, %10d misses, hit ratio %6.2f %%\n"
"\tDynamic blocks: %12d total, %12d hits, %10d misses, hit ratio %6.2f %%\n"
"\tObjects allocated: %12d\n",

m_messagesDispatched, m_cacheHits, m_cacheMisses, messagehitRatio,
m_blocksInvoked, m_blockCacheHits, m_blockCacheMisses, blockHitRatio,
m_objectsAllocated
);

m_methodCompiler->getTypeSystem().dumpAllContexts();
m_methodCompiler->getTypeSystem().drawCallGraph();

std::vector<THotMethod*> hotMethods;

for (THotMethodsMap::iterator iMethod = m_hotMethods.begin(); iMethod != m_hotMethods.end(); ++iMethod)
Expand Down

0 comments on commit 206db1c

Please sign in to comment.