Skip to content

Commit 0ce39a1

Browse files
authored
JIT: Add a simple Counter dumpable (#98350)
This allows easily measuring and outputting a single value at the end of all JIT compilations.
1 parent 28b6eef commit 0ce39a1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/coreclr/jit/compiler.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,19 @@ class Dumpable
294294
virtual void dump(FILE* output) = 0;
295295
};
296296

297+
// Helper class record and display a simple single value.
298+
class Counter : public Dumpable
299+
{
300+
public:
301+
int64_t Value;
302+
303+
Counter(int64_t initialValue = 0) : Value(initialValue)
304+
{
305+
}
306+
307+
void dump(FILE* output);
308+
};
309+
297310
// Helper class to record and display a histogram of different values.
298311
// Usage like:
299312
// static unsigned s_buckets[] = { 1, 2, 5, 10, 0 }; // Must have terminating 0

src/coreclr/jit/utils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,11 @@ void ConfigDoubleArray::Dump()
10981098

10991099
#if CALL_ARG_STATS || COUNT_BASIC_BLOCKS || COUNT_LOOPS || EMITTER_STATS || MEASURE_NODE_SIZE || MEASURE_MEM_ALLOC
11001100

1101+
void Counter::dump(FILE* output)
1102+
{
1103+
fprintf(output, "%lld\n", (long long)Value);
1104+
}
1105+
11011106
/*****************************************************************************
11021107
* Histogram class.
11031108
*/

0 commit comments

Comments
 (0)