Permalink
Browse files

Improve printing of trace stats.

  • Loading branch information...
1 parent 6ce6557 commit 3114514bc142e632952734fc1d36e11f78aafbd5 @nominolo committed Sep 20, 2012
Showing with 19 additions and 2 deletions.
  1. +2 −0 vm/jit.hh
  2. +17 −2 vm/main.cc
View
@@ -268,6 +268,8 @@ public:
return snaps_[n];
}
+ inline uint32_t numExits() const { return nsnaps_; }
+
#ifdef LC_TRACE_STATS
inline uint64_t traceCompletions() const { return stats_[0]; }
inline uint64_t traceExitsAt(ExitNo n) const {
View
@@ -154,16 +154,31 @@ void
printTraceStats(FILE *out)
{
#ifdef LC_TRACE_STATS
- fprintf(out, "Trace Statistics:\n");
+ fprintf(out, "Trace Statistics:\n"
+ " TRACE Completions C.Rate Exits"
+ " Exit Points\n");
for (uint32_t traceId = 0; traceId < Jit::numFragments(); ++traceId) {
Fragment *F = Jit::traceById(traceId);
uint64_t completions = F->traceCompletions();
uint64_t exits = F->traceExits();
+ uint64_t entries = completions + exits;
char completionsString[30];
char exitsString[30];
formatWithThousands(completionsString, completions);
formatWithThousands(exitsString, exits);
- fprintf(out, " %04d: %20s %20s\n", traceId, completionsString, exitsString);
+ fprintf(out, " %04d %15s %5.1f%% %14s ",
+ traceId, completionsString, exitsString,
+ 100 * (double)completions / (double)entries);
+ if (exits > 0) {
+ for (uint32_t e = 0; e < F->numExits(); ++e) {
+ uint64_t snapExits = F->traceExitsAt(e);
+ if (snapExits > 0) {
+ fprintf(out, " #%d " COL_GREY "%3.1f%%" COL_RESET, e,
+ 100 * (double)snapExits / (double)exits);
+ }
+ }
+ }
+ fprintf(out, "\n");
}
fprintf(out, "\n");
#else

0 comments on commit 3114514

Please sign in to comment.