Skip to content

Commit

Permalink
Merge pull request #11656 from LinHu2016/pgc_calibration_issue
Browse files Browse the repository at this point in the history
Fix PGC calibration issue
  • Loading branch information
amicic committed Jan 21, 2021
2 parents ae9ac34 + 770ec03 commit 339a3a6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions runtime/gc_vlhgc/SchedulingDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,25 @@ void
MM_SchedulingDelegate::measureScanRate(MM_EnvironmentVLHGC *env, double historicWeight)
{
Trc_MM_SchedulingDelegate_measureScanRate_Entry(env->getLanguageVMThread(), env->_cycleState->_collectionType);
MM_MarkVLHGCStats *markStats = &static_cast<MM_CycleStateVLHGC*>(env->_cycleState)->_vlhgcIncrementStats._markStats;

UDATA currentBytesScanned = markStats->_bytesScanned + markStats->_bytesCardClean;
UDATA currentBytesScanned = 0;
U_64 scantime = 0;
if (env->_cycleState->_collectionType == MM_CycleState::CT_PARTIAL_GARBAGE_COLLECTION) {
/* mark/compact PGC has been replaced with CopyForwardHybrid collector, so retrieve scan stats from */
MM_CopyForwardStats *copyforwardStats = &static_cast<MM_CycleStateVLHGC*>(env->_cycleState)->_vlhgcIncrementStats._copyForwardStats;
currentBytesScanned = copyforwardStats->_scanBytesTotal + copyforwardStats->_bytesCardClean;
scantime = copyforwardStats->_endTime - copyforwardStats->_startTime;
} else {
MM_MarkVLHGCStats *markStats = &static_cast<MM_CycleStateVLHGC*>(env->_cycleState)->_vlhgcIncrementStats._markStats;
currentBytesScanned = markStats->_bytesScanned + markStats->_bytesCardClean;
scantime = markStats->getScanTime();
}

if (0 != currentBytesScanned) {
PORT_ACCESS_FROM_ENVIRONMENT(env);
UDATA historicalBytesScanned = _scanRateStats.historicalBytesScanned;
U_64 historicalScanMicroseconds = _scanRateStats.historicalScanMicroseconds;
/* NOTE: scan time is the total time all threads spent scanning */
U_64 currentScanMicroseconds = j9time_hires_delta(0, markStats->getScanTime(), J9PORT_TIME_DELTA_IN_MICROSECONDS);
U_64 currentScanMicroseconds = j9time_hires_delta(0, scantime, J9PORT_TIME_DELTA_IN_MICROSECONDS);

if (0 != historicalBytesScanned) {
/* Keep a historical count of bytes scanned and scan times and re-derive microsecondsperBytes every time we receive new data */
Expand Down

0 comments on commit 339a3a6

Please sign in to comment.