Skip to content

Commit 1f961de

Browse files
Merge pull request #20675 from amicic/classunload_cumulative_stats_49
(0.49) Add j9gc_get_cumulative_class_unloading_stats()
2 parents be066e8 + 305f0ee commit 1f961de

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

runtime/gc/gctable.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ J9MemoryManagerFunctions MemoryManagerFunctions = {
251251
#endif /* J9VM_GC_OBJECT_ACCESS_BARRIER */
252252
j9gc_get_bytes_allocated_by_thread,
253253
j9gc_get_cumulative_bytes_allocated_by_thread,
254+
j9gc_get_cumulative_class_unloading_stats,
254255
j9mm_iterate_all_ownable_synchronizer_objects,
255256
j9mm_iterate_all_continuation_objects,
256257
ownableSynchronizerObjectCreated,

runtime/gc_base/ClassLoaderManager.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ MM_ClassLoaderManager::cleanUpClassLoadersStart(MM_EnvironmentBase *env, J9Class
365365
TRIGGER_J9HOOK_VM_CLASS_LOADERS_UNLOAD(_javaVM->hookInterface, vmThread, classLoaderUnloadList);
366366
}
367367

368-
classUnloadStats->_classesUnloadedCount = classUnloadCount;
369-
classUnloadStats->_classLoaderUnloadedCount = classLoaderUnloadCount;
370-
classUnloadStats->_anonymousClassesUnloadedCount = anonymousClassUnloadCount;
368+
classUnloadStats->updateUnloadedCounters(anonymousClassUnloadCount, classUnloadCount, classLoaderUnloadCount);
371369

372370
/* Ensure that the vm has an accurate number of currently loaded anonymous classes */
373371
_javaVM->anonClassCount -= anonymousClassUnloadCount;

runtime/gc_base/gc_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ extern BOOLEAN j9gc_stringHashEqualFn (void *leftKey, void *rightKey, void *user
293293
/* modronapi.cpp */
294294
extern J9_CFUNC UDATA j9gc_get_bytes_allocated_by_thread(J9VMThread* vmThread);
295295
extern J9_CFUNC BOOLEAN j9gc_get_cumulative_bytes_allocated_by_thread(J9VMThread *vmThread, UDATA *cumulativeValue);
296+
extern J9_CFUNC BOOLEAN j9gc_get_cumulative_class_unloading_stats(J9VMThread *vmThread, UDATA *anonymous, UDATA *classes, UDATA *classloaders);
296297

297298
#ifdef __cplusplus
298299
}

runtime/gc_base/modronapi.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,20 @@ j9gc_get_cumulative_bytes_allocated_by_thread(J9VMThread *vmThread, UDATA *cumul
978978
return MM_EnvironmentBase::getEnvironment(vmThread->omrVMThread)->_objectAllocationInterface->getAllocationStats()->bytesAllocatedCumulative(cumulativeValue);
979979
}
980980

981+
/**
982+
* @param[in] vmThread the vmThread we are querying about
983+
* @param[out] anonymous cumulative value pointer for unloaded anonymous classes
984+
* @param[out] classes cumulative value pointer for unloaded classes (including anonymous)
985+
* @param[out] classloaders cumulative value pointer for unloaded classesloaders
986+
*/
987+
BOOLEAN
988+
j9gc_get_cumulative_class_unloading_stats(J9VMThread *vmThread, UDATA *anonymous, UDATA *classes, UDATA *classloaders)
989+
{
990+
MM_GCExtensions *ext = MM_GCExtensions::getExtensions(vmThread->javaVM);
991+
ext->globalGCStats.classUnloadStats.getUnloadedCountersCumulative(anonymous, classes, classloaders);
992+
return true;
993+
}
994+
981995
/**
982996
* Return information about the total CPU time consumed by GC threads, as well
983997
* as the number of GC threads. The time for the main and worker threads is

runtime/gc_glue_java/MetronomeDelegate.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,8 @@ MM_MetronomeDelegate::updateClassUnloadStats(MM_EnvironmentBase *env, UDATA clas
615615
MM_ClassUnloadStats *classUnloadStats = &_extensions->globalGCStats.classUnloadStats;
616616

617617
/* TODO CRGTMP move global stats into super class implementation once it is created */
618-
classUnloadStats->_classesUnloadedCount = classUnloadCount;
619-
classUnloadStats->_anonymousClassesUnloadedCount = anonymousClassUnloadCount;
620-
classUnloadStats->_classLoaderUnloadedCount = classLoaderUnloadCount;
618+
classUnloadStats->updateUnloadedCounters(anonymousClassUnloadCount, classUnloadCount, classLoaderUnloadCount);
619+
621620

622621
/* Record increment stats */
623622
_extensions->globalGCStats.metronomeStats.classesUnloadedCount = classUnloadCount;

runtime/oti/j9nonbuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4801,6 +4801,7 @@ typedef struct J9MemoryManagerFunctions {
48014801
#endif /* defined(J9VM_GC_OBJECT_ACCESS_BARRIER) */
48024802
UDATA ( *j9gc_get_bytes_allocated_by_thread)(struct J9VMThread *vmThread) ;
48034803
BOOLEAN ( *j9gc_get_cumulative_bytes_allocated_by_thread)(struct J9VMThread *vmThread, UDATA *cumulativeValue) ;
4804+
BOOLEAN ( *j9gc_get_cumulative_class_unloading_stats)(struct J9VMThread *vmThread, UDATA *anonumous, UDATA *classes, UDATA *classloaders) ;
48044805

48054806
jvmtiIterationControl ( *j9mm_iterate_all_ownable_synchronizer_objects)(struct J9VMThread *vmThread, J9PortLibrary *portLibrary, UDATA flags, jvmtiIterationControl (*func)(struct J9VMThread *vmThread, struct J9MM_IterateObjectDescriptor *object, void *userData), void *userData) ;
48064807
jvmtiIterationControl ( *j9mm_iterate_all_continuation_objects)(struct J9VMThread *vmThread, J9PortLibrary *portLibrary, UDATA flags, jvmtiIterationControl (*func)(struct J9VMThread *vmThread, struct J9MM_IterateObjectDescriptor *object, void *userData), void *userData) ;

0 commit comments

Comments
 (0)