Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7551 from dmitripivkine/master
Browse files Browse the repository at this point in the history
Add cumulative counters to class unloading stats
  • Loading branch information
babsingh authored Nov 20, 2024
2 parents eb8a833 + f4a968c commit af52690
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
29 changes: 28 additions & 1 deletion gc/stats/ClassUnloadStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,31 @@ MM_ClassUnloadStats::clear()
_startPostTime = 0;
_endPostTime = 0;
_classUnloadMutexQuiesceTime = 0;
};
}

void
MM_ClassUnloadStats::updateUnloadedCounters(uintptr_t anonymous, uintptr_t classes, uintptr_t classloaders)
{
_classLoaderUnloadedCount = classloaders;
_classesUnloadedCount = classes;
_anonymousClassesUnloadedCount = anonymous;

_classLoaderUnloadedCountCumulative += classloaders;
_classesUnloadedCountCumulative += classes;
_anonymousClassesUnloadedCountCumulative += anonymous;

}

void
MM_ClassUnloadStats::getUnloadedCountersCumulative(uintptr_t *anonymous, uintptr_t *classes, uintptr_t *classloaders)
{
if (NULL != anonymous) {
*anonymous = _anonymousClassesUnloadedCountCumulative;
}
if (NULL != classes) {
*classes = _classesUnloadedCountCumulative;
}
if (NULL != classloaders) {
*classloaders = _classLoaderUnloadedCountCumulative;
}
}
28 changes: 27 additions & 1 deletion gc/stats/ClassUnloadStats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ class MM_ClassUnloadStats : public MM_Base {
public:
uintptr_t _classLoaderUnloadedCount; /**< number of unloaded class loaders */
uintptr_t _classLoaderCandidates; /**< number of class loaders visited */
uintptr_t _classesUnloadedCount; /**< number of unloaded classes */
uintptr_t _classesUnloadedCount; /**< number of unloaded classes (including anonymous) */
uintptr_t _anonymousClassesUnloadedCount; /**< number of anonymous classes unloaded */

uintptr_t _classLoaderUnloadedCountCumulative; /**< number of unloaded class loaders since JVM start */
uintptr_t _classesUnloadedCountCumulative; /**< number of unloaded classes since JVM start */
uintptr_t _anonymousClassesUnloadedCountCumulative; /**< number of anonymous classes unloaded since JVM start */

uint64_t _startTime; /**< Class unloading start time */
uint64_t _endTime; /**< Class unloading end time */

Expand All @@ -52,14 +56,36 @@ class MM_ClassUnloadStats : public MM_Base {

uint64_t _classUnloadMutexQuiesceTime; /**< Time the GC spends waiting on the classUnloadMutex */

/**
* Set counters/times to zero at the beginning of cycle
*/
void clear();

/**
* Update unloaded counters for cycle as well as cumulative counters
* @param[out] anonymous unloaded anonymous classes counter value
* @param[out] classes unloaded classes counter value (including anonymous)
* @param[out] classloaders unloaded classesloaders counter value
*/
void updateUnloadedCounters(uintptr_t anonymous, uintptr_t classes, uintptr_t classloaders);

/**
* Returns cumulative counters
* @param[out] anonymous cumulative value pointer for unloaded anonymous classes
* @param[out] classes cumulative value pointer for unloaded classes (including anonymous)
* @param[out] classloaders cumulative value pointer for unloaded classesloaders
*/
void getUnloadedCountersCumulative(uintptr_t *anonymous, uintptr_t *classes, uintptr_t *classloaders);

MM_ClassUnloadStats()
: MM_Base()
, _classLoaderUnloadedCount(0)
, _classLoaderCandidates(0)
, _classesUnloadedCount(0)
, _anonymousClassesUnloadedCount(0)
, _classLoaderUnloadedCountCumulative(0)
, _classesUnloadedCountCumulative(0)
, _anonymousClassesUnloadedCountCumulative(0)
, _startTime(0)
, _endTime(0)
, _startSetupTime(0)
Expand Down

0 comments on commit af52690

Please sign in to comment.