@@ -251,6 +251,14 @@ struct ThreadContextSwitchRateEntry {
251
251
float switchRate;
252
252
};
253
253
254
+ struct ThreadStatisticsEntry {
255
+ I_64 ticks;
256
+ U_32 activeThreadCount;
257
+ U_32 daemonThreadCount;
258
+ U_32 accumulatedThreadCount;
259
+ U_32 peakThreadCount;
260
+ };
261
+
254
262
struct JVMInformationEntry {
255
263
const char *jvmName;
256
264
const char *jvmVersion;
@@ -338,6 +346,8 @@ class VM_JFRConstantPoolTypes {
338
346
UDATA _classLoadingStatisticsCount;
339
347
J9Pool *_threadContextSwitchRateTable;
340
348
U_32 _threadContextSwitchRateCount;
349
+ J9Pool *_threadStatisticsTable;
350
+ UDATA _threadStatisticsCount;
341
351
342
352
/* Processing buffers */
343
353
StackFrame *_currentStackFrameBuffer;
@@ -611,6 +621,8 @@ class VM_JFRConstantPoolTypes {
611
621
612
622
void addThreadContextSwitchRateEntry (J9JFRThreadContextSwitchRate *threadContextSwitchRateData);
613
623
624
+ void addThreadStatisticsEntry (J9JFRThreadStatistics *threadStatisticsData);
625
+
614
626
J9Pool *getExecutionSampleTable ()
615
627
{
616
628
return _executionSampleTable;
@@ -661,6 +673,11 @@ class VM_JFRConstantPoolTypes {
661
673
return _threadContextSwitchRateTable;
662
674
}
663
675
676
+ J9Pool *getThreadStatisticsTable ()
677
+ {
678
+ return _threadStatisticsTable;
679
+ }
680
+
664
681
UDATA getExecutionSampleCount ()
665
682
{
666
683
return _executionSampleCount;
@@ -711,6 +728,11 @@ class VM_JFRConstantPoolTypes {
711
728
return _threadContextSwitchRateCount;
712
729
}
713
730
731
+ UDATA getThreadStatisticsCount ()
732
+ {
733
+ return _threadStatisticsCount;
734
+ }
735
+
714
736
ClassloaderEntry *getClassloaderEntry ()
715
737
{
716
738
return _firstClassloaderEntry;
@@ -869,6 +891,9 @@ class VM_JFRConstantPoolTypes {
869
891
case J9JFR_EVENT_TYPE_THREAD_CONTEXT_SWITCH_RATE:
870
892
addThreadContextSwitchRateEntry ((J9JFRThreadContextSwitchRate *)event);
871
893
break ;
894
+ case J9JFR_EVENT_TYPE_THREAD_STATISTICS:
895
+ addThreadStatisticsEntry ((J9JFRThreadStatistics *)event);
896
+ break ;
872
897
default :
873
898
Assert_VM_unreachable ();
874
899
break ;
@@ -1201,6 +1226,8 @@ class VM_JFRConstantPoolTypes {
1201
1226
, _classLoadingStatisticsCount(0 )
1202
1227
, _threadContextSwitchRateTable(NULL )
1203
1228
, _threadContextSwitchRateCount(0 )
1229
+ , _threadStatisticsTable(NULL )
1230
+ , _threadStatisticsCount(0 )
1204
1231
, _previousStackTraceEntry(NULL )
1205
1232
, _firstStackTraceEntry(NULL )
1206
1233
, _previousThreadEntry(NULL )
@@ -1333,6 +1360,12 @@ class VM_JFRConstantPoolTypes {
1333
1360
goto done;
1334
1361
}
1335
1362
1363
+ _threadStatisticsTable = pool_new (sizeof (ThreadStatisticsEntry), 0 , sizeof (U_64), 0 , J9_GET_CALLSITE (), OMRMEM_CATEGORY_VM, POOL_FOR_PORT (privatePortLibrary));
1364
+ if (NULL == _threadStatisticsTable ) {
1365
+ _buildResult = OutOfMemory;
1366
+ goto done;
1367
+ }
1368
+
1336
1369
/* Add reserved index for default entries. For strings zero is the empty or NUll string.
1337
1370
* For package zero is the deafult package, for Module zero is the unnamed module. ThreadGroup
1338
1371
* zero is NULL threadGroup.
@@ -1424,6 +1457,7 @@ class VM_JFRConstantPoolTypes {
1424
1457
pool_kill (_threadCPULoadTable);
1425
1458
pool_kill (_classLoadingStatisticsTable);
1426
1459
pool_kill (_threadContextSwitchRateTable);
1460
+ pool_kill (_threadStatisticsTable);
1427
1461
j9mem_free_memory (_globalStringTable);
1428
1462
}
1429
1463
0 commit comments