@@ -234,6 +234,11 @@ struct ClassLoadingStatisticsEntry {
234
234
I_64 unloadedClassCount;
235
235
};
236
236
237
+ struct ThreadContextSwitchRateEntry {
238
+ I_64 ticks;
239
+ float switchRate;
240
+ };
241
+
237
242
struct JVMInformationEntry {
238
243
const char *jvmName;
239
244
const char *jvmVersion;
@@ -317,6 +322,8 @@ class VM_JFRConstantPoolTypes {
317
322
UDATA _threadCPULoadCount;
318
323
J9Pool *_classLoadingStatisticsTable;
319
324
UDATA _classLoadingStatisticsCount;
325
+ J9Pool *_threadContextSwitchRateTable;
326
+ U_32 _threadContextSwitchRateCount;
320
327
321
328
/* Processing buffers */
322
329
StackFrame *_currentStackFrameBuffer;
@@ -586,6 +593,8 @@ class VM_JFRConstantPoolTypes {
586
593
587
594
U_32 addClassLoadingStatisticsEntry (J9JFRClassLoadingStatistics *classLoadingStatisticsData);
588
595
596
+ void addThreadContextSwitchRateEntry (J9JFRThreadContextSwitchRate *threadContextSwitchRateData);
597
+
589
598
J9Pool *getExecutionSampleTable ()
590
599
{
591
600
return _executionSampleTable;
@@ -626,6 +635,11 @@ class VM_JFRConstantPoolTypes {
626
635
return _classLoadingStatisticsTable;
627
636
}
628
637
638
+ J9Pool *getThreadContextSwitchRateTable ()
639
+ {
640
+ return _threadContextSwitchRateTable;
641
+ }
642
+
629
643
UDATA getExecutionSampleCount ()
630
644
{
631
645
return _executionSampleCount;
@@ -666,6 +680,11 @@ class VM_JFRConstantPoolTypes {
666
680
return _classLoadingStatisticsCount;
667
681
}
668
682
683
+ U_32 getThreadContextSwitchRateCount ()
684
+ {
685
+ return _threadContextSwitchRateCount;
686
+ }
687
+
669
688
ClassloaderEntry *getClassloaderEntry ()
670
689
{
671
690
return _firstClassloaderEntry;
@@ -818,6 +837,9 @@ class VM_JFRConstantPoolTypes {
818
837
case J9JFR_EVENT_TYPE_CLASS_LOADING_STATISTICS:
819
838
addClassLoadingStatisticsEntry ((J9JFRClassLoadingStatistics *)event);
820
839
break ;
840
+ case J9JFR_EVENT_TYPE_THREAD_CONTEXT_SWITCH_RATE:
841
+ addThreadContextSwitchRateEntry ((J9JFRThreadContextSwitchRate *)event);
842
+ break ;
821
843
default :
822
844
Assert_VM_unreachable ();
823
845
break ;
@@ -1143,6 +1165,8 @@ class VM_JFRConstantPoolTypes {
1143
1165
, _threadCPULoadCount(0 )
1144
1166
, _classLoadingStatisticsTable(NULL )
1145
1167
, _classLoadingStatisticsCount(0 )
1168
+ , _threadContextSwitchRateTable(NULL )
1169
+ , _threadContextSwitchRateCount(0 )
1146
1170
, _previousStackTraceEntry(NULL )
1147
1171
, _firstStackTraceEntry(NULL )
1148
1172
, _previousThreadEntry(NULL )
@@ -1263,6 +1287,12 @@ class VM_JFRConstantPoolTypes {
1263
1287
goto done;
1264
1288
}
1265
1289
1290
+ _threadContextSwitchRateTable = pool_new (sizeof (ThreadContextSwitchRateEntry), 0 , sizeof (U_64), 0 , J9_GET_CALLSITE (), OMRMEM_CATEGORY_VM, POOL_FOR_PORT (privatePortLibrary));
1291
+ if (NULL == _threadContextSwitchRateTable ) {
1292
+ _buildResult = OutOfMemory;
1293
+ goto done;
1294
+ }
1295
+
1266
1296
/* Add reserved index for default entries. For strings zero is the empty or NUll string.
1267
1297
* For package zero is the deafult package, for Module zero is the unnamed module. ThreadGroup
1268
1298
* zero is NULL threadGroup.
@@ -1352,6 +1382,7 @@ class VM_JFRConstantPoolTypes {
1352
1382
pool_kill (_cpuLoadTable);
1353
1383
pool_kill (_threadCPULoadTable);
1354
1384
pool_kill (_classLoadingStatisticsTable);
1385
+ pool_kill (_threadContextSwitchRateTable);
1355
1386
j9mem_free_memory (_globalStringTable);
1356
1387
}
1357
1388
0 commit comments