summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2016-03-03 12:54:34 -0800
committerPat Gavlin <pagavlin@microsoft.com>2016-03-04 11:18:56 -0800
commit225a9f0752ae64919b50935953748dbadfb2ffa7 (patch)
tree81685b5100215a11543499747d8c23e5ef97efdc
parentabd29485cbaa727c36e844e7bae6a0f76a6b5747 (diff)
downloadcoreclr-225a9f0752ae64919b50935953748dbadfb2ffa7.tar.gz
coreclr-225a9f0752ae64919b50935953748dbadfb2ffa7.tar.bz2
coreclr-225a9f0752ae64919b50935953748dbadfb2ffa7.zip
Clean up the JIT's histogram type.
-rw-r--r--src/jit/compiler.cpp58
-rw-r--r--src/jit/compiler.h12
-rw-r--r--src/jit/emit.cpp38
-rw-r--r--src/jit/jit.h23
-rw-r--r--src/jit/optimizer.cpp4
-rw-r--r--src/jit/utils.cpp99
6 files changed, 107 insertions, 127 deletions
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 0d8b9b8992..fb7e5b90ab 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -247,10 +247,10 @@ NodeSizeStats genNodeSizeStats;
NodeSizeStats genNodeSizeStatsPerFunc;
unsigned genTreeNcntHistBuckets[] = { 10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 1000, 5000, 10000, 0 };
-histo genTreeNcntHist(HostAllocator::getHostAllocator(), genTreeNcntHistBuckets);
+Histogram genTreeNcntHist(HostAllocator::getHostAllocator(), genTreeNcntHistBuckets);
unsigned genTreeNsizHistBuckets[] = { 1000, 5000, 10000, 50000, 100000, 500000, 1000000, 0 };
-histo genTreeNsizHist(HostAllocator::getHostAllocator(), genTreeNsizHistBuckets);
+Histogram genTreeNsizHist(HostAllocator::getHostAllocator(), genTreeNsizHistBuckets);
#endif // MEASURE_NODE_SIZE
/*****************************************************************************
@@ -301,16 +301,16 @@ unsigned argTotalGTF_ASGinArgs;
unsigned argMaxTempsPerMethod;
unsigned argCntBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 10, 0 };
-histo argCntTable(HostAllocator::getHostAllocator(), argCntBuckets);
+Histogram argCntTable(HostAllocator::getHostAllocator(), argCntBuckets);
unsigned argDWordCntBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 10, 0 };
-histo argDWordCntTable(HostAllocator::getHostAllocator(), argDWordCntBuckets);
+Histogram argDWordCntTable(HostAllocator::getHostAllocator(), argDWordCntBuckets);
unsigned argDWordLngCntBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 10, 0 };
-histo argDWordLngCntTable(HostAllocator::getHostAllocator(), argDWordLngCntBuckets);
+Histogram argDWordLngCntTable(HostAllocator::getHostAllocator(), argDWordLngCntBuckets);
unsigned argTempsCntBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 10, 0 };
-histo argTempsCntTable(HostAllocator::getHostAllocator(), argTempsCntBuckets);
+Histogram argTempsCntTable(HostAllocator::getHostAllocator(), argTempsCntBuckets);
#endif // CALL_ARG_STATS
@@ -337,12 +337,12 @@ histo argTempsCntTable(HostAllocator::getHostAllocator(), argTempsCntBucke
// --------------------------------------------------
unsigned bbCntBuckets[] = { 1, 2, 3, 5, 10, 20, 50, 100, 1000, 10000, 0 };
-histo bbCntTable(HostAllocator::getHostAllocator(), bbCntBuckets);
+Histogram bbCntTable(HostAllocator::getHostAllocator(), bbCntBuckets);
/* Histogram for the IL opcode size of methods with a single basic block */
unsigned bbSizeBuckets[] = { 1, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 0 };
-histo bbOneBBSizeTable(HostAllocator::getHostAllocator(), bbSizeBuckets);
+Histogram bbOneBBSizeTable(HostAllocator::getHostAllocator(), bbSizeBuckets);
#endif // COUNT_BASIC_BLOCKS
@@ -374,12 +374,12 @@ bool loopOverflowThisMethod; // True if we exceeded the max # of loop
/* Histogram for number of loops in a method */
unsigned loopCountBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0 };
-histo loopCountTable(HostAllocator::getHostAllocator(), loopCountBuckets);
+Histogram loopCountTable(HostAllocator::getHostAllocator(), loopCountBuckets);
/* Histogram for number of loop exits */
unsigned loopExitCountBuckets[] = { 0, 1, 2, 3, 4, 5, 6, 0 };
-histo loopExitCountTable(HostAllocator::getHostAllocator(), loopExitCountBuckets);
+Histogram loopExitCountTable(HostAllocator::getHostAllocator(), loopExitCountBuckets);
#endif // COUNT_LOOPS
@@ -891,7 +891,7 @@ void Compiler::compShutdown()
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "Basic block count frequency table:\n");
fprintf(fout, "--------------------------------------------------\n");
- bbCntTable.histoDsp(fout);
+ bbCntTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "\n");
@@ -899,7 +899,7 @@ void Compiler::compShutdown()
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "IL method size frequency table for methods with a single basic block:\n");
fprintf(fout, "--------------------------------------------------\n");
- bbOneBBSizeTable.histoDsp(fout);
+ bbOneBBSizeTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
#endif // COUNT_BASIC_BLOCKS
@@ -923,11 +923,11 @@ void Compiler::compShutdown()
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "Loop count frequency table:\n");
fprintf(fout, "--------------------------------------------------\n");
- loopCountTable.histoDsp(fout);
+ loopCountTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "Loop exit count frequency table:\n");
fprintf(fout, "--------------------------------------------------\n");
- loopExitCountTable.histoDsp(fout);
+ loopExitCountTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
#endif // COUNT_LOOPS
@@ -961,12 +961,12 @@ void Compiler::compShutdown()
fprintf(fout, "\n");
fprintf(fout, "---------------------------------------------------\n");
fprintf(fout, "Distribution of per-method GenTree node counts:\n");
- genTreeNcntHist.histoDsp(fout);
+ genTreeNcntHist.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "---------------------------------------------------\n");
fprintf(fout, "Distribution of per-method GenTree node allocations (in bytes):\n");
- genTreeNsizHist.histoDsp(fout);
+ genTreeNsizHist.dump(fout);
#endif // MEASURE_NODE_SIZE
@@ -4519,8 +4519,8 @@ void Compiler::compCompileFinish()
#endif // LOOP_HOIST_STATS
#if MEASURE_NODE_SIZE
- genTreeNcntHist.histoRec(genNodeSizeStatsPerFunc.genTreeNodeCnt, 1);
- genTreeNsizHist.histoRec(genNodeSizeStatsPerFunc.genTreeNodeSize, 1);
+ genTreeNcntHist.record(static_cast<unsigned>(genNodeSizeStatsPerFunc.genTreeNodeCnt));
+ genTreeNsizHist.record(static_cast<unsigned>(genNodeSizeStatsPerFunc.genTreeNodeSize));
#endif
#if defined(DEBUG)
@@ -5006,11 +5006,11 @@ int Compiler::compCompileHelper (CORINFO_MODULE_HANDLE clas
compSetOptimizationLevel();
#if COUNT_BASIC_BLOCKS
- bbCntTable.histoRec(fgBBcount, 1);
+ bbCntTable.record(fgBBcount);
if (fgBBcount == 1)
{
- bbOneBBSizeTable.histoRec(methodInfo->ILCodeSize, 1);
+ bbOneBBSizeTable.record(methodInfo->ILCodeSize);
}
#endif // COUNT_BASIC_BLOCKS
@@ -6316,15 +6316,15 @@ void Compiler::compCallArgStats()
argTempsThisMethod+= regArgTemp;
- argCntTable.histoRec(argNum, 1);
- argDWordCntTable.histoRec(argDWordNum, 1);
- argDWordLngCntTable.histoRec(argDWordNum + 2*argLngNum, 1);
+ argCntTable.record(argNum);
+ argDWordCntTable.record(argDWordNum);
+ argDWordLngCntTable.record(argDWordNum + (2 * argLngNum));
#endif // LEGACY_BACKEND
}
}
}
- argTempsCntTable.histoRec(argTempsThisMethod, 1);
+ argTempsCntTable.record(argTempsThisMethod);
if (argMaxTempsPerMethod < argTempsThisMethod)
{
@@ -6350,7 +6350,7 @@ void Compiler::compDispCallArgStats(FILE* fout)
fprintf(fout, "Percentage of virtual calls = %4.2f %%\n", (float)(100 * argVirtualCalls ) / argTotalCalls);
fprintf(fout, "Percentage of non-virtual calls = %4.2f %%\n\n", (float)(100 * argNonVirtualCalls) / argTotalCalls);
- fprintf(fout, "Average # of arguments per call = %.2f%\n\n", (float) argTotalArgs / argTotalCalls);
+ fprintf(fout, "Average # of arguments per call = %.2f%%\n\n", (float) argTotalArgs / argTotalCalls);
fprintf(fout, "Percentage of DWORD arguments = %.2f %%\n", (float)(100 * argTotalDWordArgs ) / argTotalArgs);
fprintf(fout, "Percentage of LONG arguments = %.2f %%\n", (float)(100 * argTotalLongArgs ) / argTotalArgs);
@@ -6384,26 +6384,26 @@ void Compiler::compDispCallArgStats(FILE* fout)
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "Argument count frequency table (includes ObjPtr):\n");
fprintf(fout, "--------------------------------------------------\n");
- argCntTable.histoDsp(fout);
+ argCntTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "DWORD argument count frequency table (w/o LONG):\n");
fprintf(fout, "--------------------------------------------------\n");
- argDWordCntTable.histoDsp(fout);
+ argDWordCntTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "Temps count frequency table (per method):\n");
fprintf(fout, "--------------------------------------------------\n");
- argTempsCntTable.histoDsp(fout);
+ argTempsCntTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
/*
fprintf(fout, "--------------------------------------------------\n");
fprintf(fout, "DWORD argument count frequency table (w/ LONG):\n");
fprintf(fout, "--------------------------------------------------\n");
- argDWordLngCntTable.histoDsp(fout);
+ argDWordLngCntTable.dump(fout);
fprintf(fout, "--------------------------------------------------\n");
*/
}
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 39f1e37365..0347785843 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -8853,8 +8853,8 @@ extern size_t gcPtrMapNSize;
*/
#if COUNT_BASIC_BLOCKS
-extern histo bbCntTable;
-extern histo bbOneBBSizeTable;
+extern Histogram bbCntTable;
+extern Histogram bbOneBBSizeTable;
#endif
@@ -8881,8 +8881,8 @@ extern unsigned constIterLoopCount; // counts the # of loops with a
extern bool hasMethodLoops; // flag to keep track if we already counted a method as having loops
extern unsigned loopsThisMethod; // counts the number of loops in the current method
extern bool loopOverflowThisMethod; // True if we exceeded the max # of loops in the method.
-extern histo loopCountTable; // Histogram of loop counts
-extern histo loopExitCountTable; // Histogram of loop exit counts
+extern Histogram loopCountTable; // Histogram of loop counts
+extern Histogram loopExitCountTable; // Histogram of loop exit counts
#endif // COUNT_LOOPS
@@ -8920,8 +8920,8 @@ struct NodeSizeStats
};
extern NodeSizeStats genNodeSizeStats; // Total node size stats
extern NodeSizeStats genNodeSizeStatsPerFunc; // Per-function node size stats
-extern histo genTreeNcntHist;
-extern histo genTreeNsizHist;
+extern Histogram genTreeNcntHist;
+extern Histogram genTreeNsizHist;
#endif // MEASURE_NODE_SIZE
/*****************************************************************************
diff --git a/src/jit/emit.cpp b/src/jit/emit.cpp
index e5b6842b14..2cd045b59a 100644
--- a/src/jit/emit.cpp
+++ b/src/jit/emit.cpp
@@ -265,13 +265,13 @@ static unsigned totActualSize;
unsigned emitter::emitIFcounts[emitter::IF_COUNT];
static unsigned emitSizeBuckets[] = { 100, 1024*1, 1024*2, 1024*3, 1024*4, 1024*5, 1024*10, 0 };
-static histo emitSizeTable(HostAllocator::getHostAllocator(), emitSizeBuckets);
+static Histogram emitSizeTable(HostAllocator::getHostAllocator(), emitSizeBuckets);
static unsigned GCrefsBuckets[] = { 0, 1, 2, 5, 10, 20, 50, 128, 256, 512, 1024, 0 };
-static histo GCrefsTable(HostAllocator::getHostAllocator(), GCrefsBuckets);
+static Histogram GCrefsTable(HostAllocator::getHostAllocator(), GCrefsBuckets);
static unsigned stkDepthBuckets[] = { 0, 1, 2, 5, 10, 16, 32, 128, 1024, 0 };
-static histo stkDepthTable(HostAllocator::getHostAllocator(), stkDepthBuckets);
+static Histogram stkDepthTable(HostAllocator::getHostAllocator(), stkDepthBuckets);
size_t emitter::emitSizeMethod;
@@ -319,16 +319,16 @@ void emitterStaticStats(FILE* fout)
fprintf(fout, "\n");
fprintf(fout, "insPlaceholderGroupData:\n");
- fprintf(fout, "Offset of igPhNext = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhNext ));
- fprintf(fout, "Offset of igPhBB = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhBB ));
- fprintf(fout, "Offset of igPhInitGCrefVars = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhInitGCrefVars ));
- fprintf(fout, "Offset of igPhInitGCrefRegs = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhInitGCrefRegs ));
- fprintf(fout, "Offset of igPhInitByrefRegs = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhInitByrefRegs ));
- fprintf(fout, "Offset of igPhPrevGCrefVars = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhPrevGCrefVars ));
- fprintf(fout, "Offset of igPhPrevGCrefRegs = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhPrevGCrefRegs ));
- fprintf(fout, "Offset of igPhPrevByrefRegs = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhPrevByrefRegs ));
- fprintf(fout, "Offset of igPhType = %2u\n", offsetof(emitter::insPlaceholderGroupData, igPhType ));
- fprintf(fout, "Size of insPlaceholderGroupData = %u\n", sizeof( emitter::insPlaceholderGroupData ));
+ fprintf(fout, "Offset of igPhNext = %2u\n", offsetof(insPlaceholderGroupData, igPhNext ));
+ fprintf(fout, "Offset of igPhBB = %2u\n", offsetof(insPlaceholderGroupData, igPhBB ));
+ fprintf(fout, "Offset of igPhInitGCrefVars = %2u\n", offsetof(insPlaceholderGroupData, igPhInitGCrefVars ));
+ fprintf(fout, "Offset of igPhInitGCrefRegs = %2u\n", offsetof(insPlaceholderGroupData, igPhInitGCrefRegs ));
+ fprintf(fout, "Offset of igPhInitByrefRegs = %2u\n", offsetof(insPlaceholderGroupData, igPhInitByrefRegs ));
+ fprintf(fout, "Offset of igPhPrevGCrefVars = %2u\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefVars ));
+ fprintf(fout, "Offset of igPhPrevGCrefRegs = %2u\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefRegs ));
+ fprintf(fout, "Offset of igPhPrevByrefRegs = %2u\n", offsetof(insPlaceholderGroupData, igPhPrevByrefRegs ));
+ fprintf(fout, "Offset of igPhType = %2u\n", offsetof(insPlaceholderGroupData, igPhType ));
+ fprintf(fout, "Size of insPlaceholderGroupData = %u\n", sizeof( insPlaceholderGroupData ));
fprintf(fout, "\n");
fprintf(fout, "Size of tinyID = %2u\n", TINY_IDSC_SIZE);
@@ -422,15 +422,15 @@ void emitterStats(FILE* fout)
}
fprintf(fout, "Descriptor size distribution:\n");
- emitSizeTable.histoDsp(fout);
+ emitSizeTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "GC ref frame variable counts:\n");
- GCrefsTable.histoDsp(fout);
+ GCrefsTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "Max. stack depth distribution:\n");
- stkDepthTable.histoDsp(fout);
+ stkDepthTable.dump(fout);
fprintf(fout, "\n");
int i;
@@ -4395,9 +4395,9 @@ unsigned emitter::emitEndCodeGen(Compiler *comp,
emitFullGCinfo = fullPtrMap;
#if EMITTER_STATS
- GCrefsTable.histoRec(emitGCrFrameOffsCnt, 1);
- emitSizeTable.histoRec(emitSizeMethod , 1);
- stkDepthTable.histoRec(emitMaxStackDepth , 1);
+ GCrefsTable.record(emitGCrFrameOffsCnt);
+ emitSizeTable.record(static_cast<unsigned>(emitSizeMethod));
+ stkDepthTable.record(emitMaxStackDepth);
#endif // EMITTER_STATS
// Default values, correct even if EMIT_TRACK_STACK_DEPTH is 0.
diff --git a/src/jit/jit.h b/src/jit/jit.h
index af78504aa0..19a4f332d8 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -634,25 +634,22 @@ size_t unsigned_abs(ssize_t x)
#if CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE
-class histo
+class Histogram
{
public:
- histo(IAllocator* alloc, unsigned* sizeTab, unsigned sizeCnt = 0);
- ~histo();
+ Histogram(IAllocator* allocator, const unsigned* const sizeTable);
+ ~Histogram();
- void histoClr();
- void histoDsp(FILE* fout);
- void histoRec(unsigned __int64 siz, unsigned cnt);
- void histoRec(unsigned siz, unsigned cnt);
+ void dump(FILE* output);
+ void record(unsigned size);
private:
+ void ensureAllocated();
- void histoEnsureAllocated();
-
- IAllocator* histoAlloc;
- unsigned histoSizCnt;
- unsigned* histoSizTab;
- unsigned* histoCounts;
+ IAllocator* m_allocator;
+ unsigned m_sizeCount;
+ const unsigned* const m_sizeTable;
+ unsigned* m_counts;
};
#endif // CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index ca4c43fcfa..6c2d579521 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -1855,7 +1855,7 @@ void Compiler::optFindNaturalLoops()
loopsThisMethod++;
/* keep track of the number of exits */
- loopExitCountTable.histoRec((unsigned)exitCount, 1);
+ loopExitCountTable.record(static_cast<unsigned>(exitCount));
#endif // COUNT_LOOPS
}
@@ -1865,7 +1865,7 @@ NO_LOOP: ;
}
#if COUNT_LOOPS
- loopCountTable.histoRec(loopsThisMethod, 1);
+ loopCountTable.record(loopsThisMethod);
if (maxLoopsPerMethod < loopsThisMethod)
{
maxLoopsPerMethod = loopsThisMethod;
diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp
index 85ccdb75c3..ce5b149f5d 100644
--- a/src/jit/utils.cpp
+++ b/src/jit/utils.cpp
@@ -778,109 +778,92 @@ void ConfigMethodRange::initRanges(__in_z LPCWSTR rangeStr)
* Histogram class.
*/
-histo::histo(IAllocator* alloc, unsigned * sizeTab, unsigned sizeCnt) :
- histoAlloc(alloc),
- histoCounts(nullptr)
+Histogram::Histogram(IAllocator* allocator, const unsigned* const sizeTable)
+ : m_allocator(allocator)
+ , m_sizeTable(sizeTable)
+ , m_counts(nullptr)
{
- if (sizeCnt == 0)
+ unsigned sizeCount = 0;
+ do
{
- do
- {
- sizeCnt++;
- }
- while ((sizeTab[sizeCnt] != 0) && (sizeCnt < 1000));
+ sizeCount++;
}
+ while ((sizeTable[sizeCount] != 0) && (sizeCount < 1000));
- histoSizCnt = sizeCnt;
- histoSizTab = sizeTab;
+ m_sizeCount = sizeCount;
}
-histo::~histo()
+Histogram::~Histogram()
{
- histoAlloc->Free(histoCounts);
+ m_allocator->Free(m_counts);
}
-// We need to lazy allocate the histogram data so static "histo" variables don't try to call the CLR memory allocator
-// in the loader lock, which doesn't work.
-void histo::histoEnsureAllocated()
+// We need to lazy allocate the histogram data so static `Histogram` variables don't try to
+// call the host memory allocator in the loader lock, which doesn't work.
+void Histogram::ensureAllocated()
{
- if (histoCounts == nullptr)
+ if (m_counts == nullptr)
{
- histoCounts = new (histoAlloc) unsigned[histoSizCnt + 1];
- histoClr();
+ m_counts = new (m_allocator) unsigned[m_sizeCount + 1];
+ memset(m_counts, 0, (m_sizeCount + 1) * sizeof(*m_counts));
}
}
-void histo::histoClr()
+void Histogram::dump(FILE* output)
{
- histoEnsureAllocated();
- memset(histoCounts, 0, (histoSizCnt + 1) * sizeof(*histoCounts));
-}
+ ensureAllocated();
-void histo::histoDsp(FILE* fout)
-{
- histoEnsureAllocated();
-
- unsigned i;
- unsigned c;
- unsigned t;
-
- for (i = t = 0; i <= histoSizCnt; i++)
+ unsigned t = 0;
+ for (unsigned i = 0; i < m_sizeCount; i++)
{
- t += histoCounts[i];
+ t += m_counts[i];
}
- for (i = c = 0; i <= histoSizCnt; i++)
+ for (unsigned c = 0, i = 0; i <= m_sizeCount; i++)
{
- if (i == histoSizCnt)
+ if (i == m_sizeCount)
{
- if (!histoCounts[i])
+ if (m_counts[i] == 0)
+ {
break;
+ }
- fprintf(fout, " > %7u", histoSizTab[i-1]);
+ fprintf(output, " > %7u", m_sizeTable[i - 1]);
}
else
{
if (i == 0)
{
- fprintf(fout, " <= ");
+ fprintf(output, " <= ");
}
else
{
- fprintf(fout, "%7u .. ", histoSizTab[i-1]+1);
+ fprintf(output, "%7u .. ", m_sizeTable[i - 1] + 1);
}
- fprintf(fout, "%7u", histoSizTab[i]);
+ fprintf(output, "%7u", m_sizeTable[i]);
}
- c += histoCounts[i];
+ c += m_counts[i];
- fprintf(fout, " ===> %7u count (%3u%% of total)\n", histoCounts[i], (int)(100.0 * c / t));
+ fprintf(output, " ===> %7u count (%3u%% of total)\n", m_counts[i], (int)(100.0 * c / t));
}
}
-void histo::histoRec(unsigned __int64 siz, unsigned cnt)
-{
- assert(FitsIn<unsigned>(siz));
- histoRec((unsigned)siz, cnt);
-}
-
-void histo::histoRec(unsigned siz, unsigned cnt)
+void Histogram::record(unsigned size)
{
- histoEnsureAllocated();
+ ensureAllocated();
- unsigned i;
- unsigned * t;
-
- for (i = 0, t = histoSizTab;
- i < histoSizCnt;
- i++ , t++)
+ unsigned i;
+ for (i = 0; i < m_sizeCount; i++)
{
- if (*t >= siz)
+ if (m_sizeTable[i] >= size)
+ {
break;
+ }
}
- histoCounts[i] += cnt;
+ m_counts[i]++;
}
#endif // CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE