Skip to content

Commit

Permalink
[profiler] Add inProfilingSession to check whether profiler is recording
Browse files Browse the repository at this point in the history
  • Loading branch information
orionpapadakis authored and zakkak committed Nov 29, 2019
1 parent 553e2fb commit 523dda4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions com.sun.max/src/com/sun/max/vm/MaxineVM.java
Expand Up @@ -127,9 +127,11 @@ public boolean parseValue(Pointer optionValue) {
/**
* The Dynamic AllocationProfiler object. It's initialized during Java Run Scheme initialization (if it's needed).
*/
public static boolean useProfiler;
public static AllocationProfiler allocationProfiler;

public static boolean useProfiler;
public static boolean inProfilingSession = false;

/**
* This method is used to guard object allocation code sections.
*
Expand Down Expand Up @@ -159,9 +161,11 @@ public static boolean profileThatObject(Hub hub) {
assert isRunning() && CompilationBroker.AllocationProfilerEntryPoint != null || AllocationProfiler.profileAll() :
"The Allocation Profiler should only be initialized when the VM is running and profiling is enabled";
int profilerTLA = VmThreadLocal.PROFILER_TLA.load(VmThread.currentTLA()).toInt();
return (profilerTLA == 1 || AllocationProfiler.profileAll()) && AllocationProfiler.warmupFinished() && AllocationProfiler.objectWarmupFinished() && VmThread.current() != VmThread.vmOperationThread;
inProfilingSession = (profilerTLA == 1 || AllocationProfiler.profileAll()) && AllocationProfiler.warmupFinished() && AllocationProfiler.objectWarmupFinished() && VmThread.current() != VmThread.vmOperationThread;
return inProfilingSession;
}
return false;
inProfilingSession = false;
return inProfilingSession;
}

/**
Expand Down

0 comments on commit 523dda4

Please sign in to comment.