Skip to content

Commit

Permalink
Revert invocations of cpu util calculation
Browse files Browse the repository at this point in the history
eclipse-omr#7420 seems to cause perf regression,
and since investigation is not trivial and revert of the original change
would drag 3 more PRs to be reverted this is just a partial revert, that
basically gets the same run-time behavior, although it does not revert
some other code this will not be used/invoked.

Signed-off-by: Aleksandar Micic <Aleksandar_Micic@ca.ibm.com>
  • Loading branch information
Aleksandar Micic authored and Aleksandar Micic committed Aug 1, 2024
1 parent 4a25bae commit c994f9d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 17 deletions.
40 changes: 31 additions & 9 deletions gc/base/standard/ParallelGlobalGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1712,12 +1712,23 @@ MM_ParallelGlobalGC::reportGCStart(MM_EnvironmentBase *env)
void
MM_ParallelGlobalGC::reportGCIncrementStart(MM_EnvironmentBase *env)
{
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
MM_CollectionStatisticsStandard *stats = (MM_CollectionStatisticsStandard *)env->_cycleState->_collectionStatistics;
stats->collectCollectionStatistics(env, stats);
/* Among other things this will get process and elapse time info&timestamps that are not only needed for
* mutator CPU util calc but also needed for GC STW user/system/stall breakdown reporting
*/
_extensions->cpuUtilStats.calculateProcessAndCpuUtilizationDelta(env, stats);
stats->_startTime = omrtime_hires_clock();

intptr_t rc = omrthread_get_process_times(&stats->_startProcessTimes);
switch (rc){
case -1: /* Error: Function un-implemented on architecture */
case -2: /* Error: getrusage() or GetProcessTimes() returned error value */
stats->_startProcessTimes._userTime = I_64_MAX;
stats->_startProcessTimes._systemTime = I_64_MAX;
break;
case 0:
break; /* Success */
default:
Assert_MM_unreachable();
}

TRIGGER_J9HOOK_MM_PRIVATE_GC_INCREMENT_START(
_extensions->privateHookInterface,
Expand All @@ -1730,14 +1741,25 @@ MM_ParallelGlobalGC::reportGCIncrementStart(MM_EnvironmentBase *env)
void
MM_ParallelGlobalGC::reportGCIncrementEnd(MM_EnvironmentBase *env)
{
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
MM_CollectionStatisticsStandard *stats = (MM_CollectionStatisticsStandard *)env->_cycleState->_collectionStatistics;
stats->collectCollectionStatistics(env, stats);
/* Among other things this will get process and elapse time info&timestamps that are not only needed for
* mutator CPU util calc but also needed for GC STW user/system/stall breakdown reporting
*/
_extensions->cpuUtilStats.recordProcessAndCpuUtilization(env, stats);

intptr_t rc = omrthread_get_process_times(&stats->_endProcessTimes);
switch (rc){
case -1: /* Error: Function un-implemented on architecture */
case -2: /* Error: getrusage() or GetProcessTimes() returned error value */
stats->_endProcessTimes._userTime = 0;
stats->_endProcessTimes._systemTime = 0;
break;
case 0:
break; /* Success */
default:
Assert_MM_unreachable();
}

stats->_endTime = omrtime_hires_clock();
stats->_stallTime = _extensions->globalGCStats.getStallTime();

TRIGGER_J9HOOK_MM_PRIVATE_GC_INCREMENT_END(
_extensions->privateHookInterface,
env->getOmrVMThread(),
Expand Down
40 changes: 32 additions & 8 deletions gc/base/standard/Scavenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4967,12 +4967,24 @@ MM_Scavenger::calculateTiltRatio()
void
MM_Scavenger::reportGCIncrementStart(MM_EnvironmentStandard *env)
{
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
MM_CollectionStatisticsStandard *stats = (MM_CollectionStatisticsStandard *)env->_cycleState->_collectionStatistics;
stats->collectCollectionStatistics(env, stats);
/* Among other things this will get process and elapse time info&timestamps that are not only needed for
* mutator CPU util calc but also needed for GC STW user/system/stall breakdown reporting
*/
_extensions->cpuUtilStats.calculateProcessAndCpuUtilizationDelta(env, stats);
stats->_startTime = omrtime_hires_clock();

intptr_t rc = omrthread_get_process_times(&stats->_startProcessTimes);
switch (rc){
case -1: /* Error: Function un-implemented on architecture */
case -2: /* Error: getrusage() or GetProcessTimes() returned error value */
stats->_startProcessTimes._userTime = I_64_MAX;
stats->_startProcessTimes._systemTime = I_64_MAX;
break;
case 0:
break; /* Success */
default:
Assert_MM_unreachable();
}

TRIGGER_J9HOOK_MM_PRIVATE_GC_INCREMENT_START(
_extensions->privateHookInterface,
env->getOmrVMThread(),
Expand All @@ -4984,12 +4996,24 @@ MM_Scavenger::reportGCIncrementStart(MM_EnvironmentStandard *env)
void
MM_Scavenger::reportGCIncrementEnd(MM_EnvironmentStandard *env)
{
OMRPORT_ACCESS_FROM_ENVIRONMENT(env);
MM_CollectionStatisticsStandard *stats = (MM_CollectionStatisticsStandard *)env->_cycleState->_collectionStatistics;
stats->collectCollectionStatistics(env, stats);
/* Among other things this will get process and elapse time info&timestamps that are not only needed for
* mutator CPU util calc but also needed for GC STW user/system/stall breakdown reporting
*/
_extensions->cpuUtilStats.recordProcessAndCpuUtilization(env, stats);

intptr_t rc = omrthread_get_process_times(&stats->_endProcessTimes);
switch (rc){
case -1: /* Error: Function un-implemented on architecture */
case -2: /* Error: getrusage() or GetProcessTimes() returned error value */
stats->_endProcessTimes._userTime = 0;
stats->_endProcessTimes._systemTime = 0;
break;
case 0:
break; /* Success */
default:
Assert_MM_unreachable();
}

stats->_endTime = omrtime_hires_clock();
stats->_stallTime = _extensions->scavengerStats.getStallTime();

TRIGGER_J9HOOK_MM_PRIVATE_GC_INCREMENT_END(
Expand Down

0 comments on commit c994f9d

Please sign in to comment.