org-netbeans-lib-profiler-common

16:39:42.816 INFO  jd.cli.Main - Decompiling org-netbeans-lib-profiler-common.jar
package org.netbeans.lib.profiler.common;

import java.util.Map;
import org.netbeans.lib.profiler.ProfilerEngineSettings;
import org.netbeans.lib.profiler.common.integration.IntegrationUtils;

public final class AttachSettings
{
  public static final String PROP_ATTACH_DIRECT = "profiler.attach.direct";
  public static final String PROP_ATTACH_REMOTE = "profiler.attach.remote";
  public static final String PROP_ATTACH_DYNAMIC_JDK16 = "profiler.attach.dynamic.jdk16";
  public static final String PROP_ATTACH_HOST = "profiler.attach.host";
  public static final String PROP_ATTACH_PORT = "profiler.attach.port";
  public static final String PROP_ATTACH_TARGET_TYPE = "profiler.attach.target.type";
  public static final String PROP_ATTACH_SERVER_TYPE = "profiler.attach.server.type";
  public static final String PROP_ATTACH_HOST_OS = "profiler.attach.host.os";
  private String host = "";
  private String hostOS = "";
  private String hostOS_dbl = new String(hostOS);
  private String host_dbl = new String(host);
  private String remoteHostOS = "";
  private String serverType = "";
  private String serverType_dbl = new String(serverType);
  private String targetType = "";
  private String targetType_dbl = new String(targetType);
  private boolean direct = true;
  private boolean direct_dbl = direct;
  private boolean dynamic16 = false;
  private boolean dynamic16_dbl = dynamic16;
  private boolean remote = false;
  private boolean remote_dbl = remote;
  private int pid = -1;
  private int pid_dbl = pid;
  private int transientPort = -1;
  private int transientPort_dbl = transientPort;
  
  public AttachSettings()
  {
    remote = false;
    direct = true;
    
    hostOS = IntegrationUtils.getLocalPlatform(-1);
  }
  
  public void setDirect(boolean paramBoolean)
  {
    direct = paramBoolean;
  }
  
  public boolean isDirect()
  {
    return direct;
  }
  
  public void setDynamic16(boolean paramBoolean)
  {
    dynamic16 = paramBoolean;
  }
  
  public boolean isDynamic16()
  {
    return dynamic16;
  }
  
  public void setHost(String paramString)
  {
    if (paramString == null) {
      throw new IllegalArgumentException();
    }
    host = paramString;
  }
  
  public String getHost()
  {
    return host;
  }
  
  public void setHostOS(String paramString)
  {
    if (paramString != null) {
      hostOS = paramString;
    } else if (remote) {
      hostOS = remoteHostOS;
    } else {
      hostOS = IntegrationUtils.getLocalPlatform(-1);
    }
  }
  
  public String getHostOS()
  {
    return hostOS;
  }
  
  public void setPid(int paramInt)
  {
    pid = paramInt;
  }
  
  public int getPid()
  {
    return pid;
  }
  
  public void setPort(int paramInt)
  {
    transientPort = paramInt;
  }
  
  public int getPort()
  {
    if (transientPort != -1) {
      return transientPort;
    }
    return Profiler.getDefault().getGlobalProfilingSettings().getPortNo();
  }
  
  public void setRemote(boolean paramBoolean)
  {
    remote = paramBoolean;
  }
  
  public boolean isRemote()
  {
    return remote;
  }
  
  public void setServerType(String paramString)
  {
    serverType = paramString;
  }
  
  public String getServerType()
  {
    return serverType;
  }
  
  public void setTargetType(String paramString)
  {
    targetType = paramString;
  }
  
  public String getTargetType()
  {
    return targetType;
  }
  
  public void applySettings(ProfilerEngineSettings paramProfilerEngineSettings)
  {
    paramProfilerEngineSettings.setPortNo(getPort());
    if (remote) {
      paramProfilerEngineSettings.setRemoteHost(host);
    } else {
      paramProfilerEngineSettings.setRemoteHost("");
    }
  }
  
  public boolean commit()
  {
    boolean bool = false;
    if (direct != direct_dbl)
    {
      bool = true;
      direct_dbl = direct;
    }
    if (remote != remote_dbl)
    {
      bool = true;
      remote_dbl = remote;
    }
    if (dynamic16 != dynamic16_dbl)
    {
      bool = true;
      dynamic16_dbl = dynamic16;
    }
    if ((host_dbl == null) || (!host.equalsIgnoreCase(host_dbl)))
    {
      bool = true;
      host_dbl = new String(host);
    }
    if (transientPort_dbl != transientPort)
    {
      bool = true;
      transientPort_dbl = transientPort;
    }
    if ((targetType_dbl == null) || (!targetType.equalsIgnoreCase(targetType_dbl)))
    {
      bool = true;
      targetType_dbl = new String(targetType);
    }
    if ((serverType_dbl == null) || (!serverType.equalsIgnoreCase(serverType_dbl)))
    {
      bool = true;
      serverType_dbl = new String(serverType);
    }
    if ((hostOS_dbl == null) || (!hostOS.equalsIgnoreCase(hostOS_dbl)))
    {
      bool = true;
      hostOS_dbl = new String(hostOS);
    }
    return bool;
  }
  
  public void copyInto(AttachSettings paramAttachSettings)
  {
    direct = direct;
    direct_dbl = direct_dbl;
    remote = remote;
    remote_dbl = remote_dbl;
    dynamic16 = dynamic16;
    dynamic16_dbl = dynamic16_dbl;
    pid = pid;
    pid_dbl = pid_dbl;
    host = host;
    host_dbl = host_dbl;
    targetType = targetType;
    targetType_dbl = targetType_dbl;
    serverType = serverType;
    serverType_dbl = serverType_dbl;
    hostOS = hostOS;
    hostOS_dbl = hostOS_dbl;
    remoteHostOS = remoteHostOS;
  }
  
  public String debug()
  {
    return toString();
  }
  
  public void load(Map paramMap)
  {
    direct = Boolean.valueOf(ProfilingSettings.getProperty(paramMap, "profiler.attach.direct", "true")).booleanValue();
    remote = Boolean.valueOf(ProfilingSettings.getProperty(paramMap, "profiler.attach.remote", "false")).booleanValue();
    dynamic16 = Boolean.valueOf(ProfilingSettings.getProperty(paramMap, "profiler.attach.dynamic.jdk16", "false")).booleanValue();
    host = ProfilingSettings.getProperty(paramMap, "profiler.attach.host", "");
    targetType = ProfilingSettings.getProperty(paramMap, "profiler.attach.target.type", "");
    serverType = ProfilingSettings.getProperty(paramMap, "profiler.attach.server.type", "");
    remoteHostOS = ProfilingSettings.getProperty(paramMap, "profiler.attach.host.os", IntegrationUtils.getLocalPlatform(-1));
  }
  
  public void store(Map paramMap)
  {
    paramMap.put("profiler.attach.direct", Boolean.toString(direct));
    paramMap.put("profiler.attach.remote", Boolean.toString(remote));
    paramMap.put("profiler.attach.dynamic.jdk16", Boolean.toString(dynamic16));
    paramMap.put("profiler.attach.host", host);
    paramMap.put("profiler.attach.target.type", targetType);
    paramMap.put("profiler.attach.server.type", serverType);
    paramMap.put("profiler.attach.host.os", hostOS);
  }
  
  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append("target type =" + targetType);
    localStringBuffer.append("\n");
    localStringBuffer.append("server type =" + serverType);
    localStringBuffer.append("\n");
    localStringBuffer.append("remote =" + remote);
    localStringBuffer.append("\n");
    localStringBuffer.append("direct =" + direct);
    localStringBuffer.append("\n");
    localStringBuffer.append("dynamic JDK16 =" + dynamic16);
    localStringBuffer.append("\n");
    localStringBuffer.append("pid =" + pid);
    localStringBuffer.append("\n");
    localStringBuffer.append("host =" + host);
    localStringBuffer.append("\n");
    localStringBuffer.append("host os =" + hostOS);
    localStringBuffer.append("\n");
    localStringBuffer.append("transient port =" + transientPort);
    localStringBuffer.append("\n");
    
    return localStringBuffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.AttachSettings
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.lang.reflect.InvocationTargetException;
import javax.swing.SwingUtilities;

public final class CommonUtils
{
  public static void runInEventDispatchThread(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      SwingUtilities.invokeLater(paramRunnable);
    }
  }
  
  public static void runInEventDispatchThreadAndWait(Runnable paramRunnable)
  {
    if (SwingUtilities.isEventDispatchThread()) {
      paramRunnable.run();
    } else {
      try
      {
        SwingUtilities.invokeAndWait(paramRunnable);
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        Profiler.getDefault().notifyException(8, localInvocationTargetException);
      }
      catch (InterruptedException localInterruptedException)
      {
        Profiler.getDefault().notifyException(8, localInterruptedException);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.CommonUtils
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

public abstract interface GlobalProfilingSettings
{
  public abstract void setCalibrationPortNo(int paramInt);
  
  public abstract int getCalibrationPortNo();
  
  public abstract void setJavaPlatformForProfiling(String paramString);
  
  public abstract String getJavaPlatformForProfiling();
  
  public abstract void setPortNo(int paramInt);
  
  public abstract int getPortNo();
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.GlobalProfilingSettings
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.util.Iterator;
import org.netbeans.lib.profiler.common.event.ProfilingStateListener;

class Profiler$1
  implements Runnable
{
  private final Profiler this$0;
  
  Profiler$1(Profiler paramProfiler, Iterator paramIterator, int paramInt1, int paramInt2) {}
  
  public void run()
  {
    while (val$iterator.hasNext()) {
      ((ProfilingStateListener)val$iterator.next()).instrumentationChanged(val$oldInstrType, val$currentInstrType);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.Profiler.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.util.Iterator;
import org.netbeans.lib.profiler.common.event.ProfilingStateEvent;
import org.netbeans.lib.profiler.common.event.ProfilingStateListener;

class Profiler$2
  implements Runnable
{
  private final Profiler this$0;
  
  Profiler$2(Profiler paramProfiler, Iterator paramIterator, ProfilingStateEvent paramProfilingStateEvent) {}
  
  public void run()
  {
    while (val$iterator.hasNext()) {
      ((ProfilingStateListener)val$iterator.next()).profilingStateChanged(val$event);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.Profiler.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.util.Iterator;
import org.netbeans.lib.profiler.common.event.ProfilingStateListener;

class Profiler$3
  implements Runnable
{
  private final Profiler this$0;
  
  Profiler$3(Profiler paramProfiler, Iterator paramIterator) {}
  
  public void run()
  {
    while (val$iterator.hasNext()) {
      ((ProfilingStateListener)val$iterator.next()).threadsMonitoringChanged();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.Profiler.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.awt.EventQueue;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.Vector;
import org.netbeans.lib.profiler.ProfilerClient;
import org.netbeans.lib.profiler.TargetAppRunner;
import org.netbeans.lib.profiler.client.ClientUtils.SourceCodeSelection;
import org.netbeans.lib.profiler.client.ClientUtils.TargetAppOrVMTerminated;
import org.netbeans.lib.profiler.common.event.ProfilingStateEvent;
import org.netbeans.lib.profiler.common.event.ProfilingStateListener;
import org.netbeans.lib.profiler.common.filters.DefinedFilterSets;
import org.netbeans.lib.profiler.common.filters.GlobalFilters;
import org.netbeans.lib.profiler.global.ProfilingSessionStatus;
import org.netbeans.lib.profiler.instrumentation.BadLocationException;
import org.netbeans.lib.profiler.instrumentation.InstrumentationException;
import org.netbeans.lib.profiler.results.monitor.VMTelemetryDataManager;
import org.netbeans.lib.profiler.results.threads.ThreadsDataManager;
import org.openide.util.Lookup;

public abstract class Profiler
{
  public static final int PROFILING_INACTIVE = 1;
  public static final int PROFILING_STARTED = 2;
  public static final int PROFILING_RUNNING = 4;
  public static final int PROFILING_PAUSED = 8;
  public static final int PROFILING_STOPPED = 16;
  public static final int PROFILING_IN_TRANSITION = 128;
  public static final int MODE_ATTACH = 0;
  public static final int MODE_PROFILE = 1;
  public static final int INFORMATIONAL = 1;
  public static final int WARNING = 2;
  public static final int USER = 4;
  public static final int EXCEPTION = 8;
  public static final int ERROR = 16;
  private static final boolean DEBUG = System.getProperty("org.netbeans.lib.profiler.common.Profiler") != null;
  private static Profiler defaultProfiler;
  private Vector profilingStateListeners;
  private int currentProfilingState = 1;
  
  public static synchronized Profiler getDefault()
  {
    if (defaultProfiler == null)
    {
      defaultProfiler = (Profiler)Lookup.getDefault().lookup(Profiler.class);
      if (defaultProfiler == null) {
        throw new InternalError("Should never happen");
      }
      if (DEBUG) {
        System.err.println("Default Profiler succesfully installed: " + defaultProfiler);
      }
    }
    return defaultProfiler;
  }
  
  public abstract int getAgentState(String paramString, int paramInt1, int paramInt2);
  
  public abstract SessionSettings getCurrentSessionSettings();
  
  public abstract DefinedFilterSets getDefinedFilterSets();
  
  public abstract GlobalFilters getGlobalFilters();
  
  public abstract GlobalProfilingSettings getGlobalProfilingSettings();
  
  public abstract ProfilingSettings getLastProfilingSettings();
  
  public abstract int getProfilingMode();
  
  public abstract int getProfilingState();
  
  public abstract TargetAppRunner getTargetAppRunner();
  
  public abstract ThreadsDataManager getThreadsManager();
  
  public abstract void setThreadsMonitoringEnabled(boolean paramBoolean);
  
  public abstract boolean getThreadsMonitoringEnabled();
  
  public abstract VMTelemetryDataManager getVMTelemetryManager();
  
  public abstract boolean attachToApp(ProfilingSettings paramProfilingSettings, AttachSettings paramAttachSettings);
  
  public abstract boolean connectToStartedApp(ProfilingSettings paramProfilingSettings, SessionSettings paramSessionSettings);
  
  public abstract void detachFromApp();
  
  public abstract void displayError(String paramString);
  
  public abstract void displayInfo(String paramString);
  
  public abstract void displayWarning(String paramString);
  
  public abstract void instrumentSelectedRoots(ClientUtils.SourceCodeSelection[] paramArrayOfSourceCodeSelection)
    throws ClassNotFoundException, InstrumentationException, BadLocationException, IOException, ClassFormatError, ClientUtils.TargetAppOrVMTerminated;
  
  public abstract void log(int paramInt, String paramString);
  
  public abstract void modifyCurrentProfiling(ProfilingSettings paramProfilingSettings);
  
  public abstract void notifyException(int paramInt, Exception paramException);
  
  public abstract void openJavaSource(String paramString1, String paramString2, String paramString3);
  
  public abstract boolean profileClass(ProfilingSettings paramProfilingSettings, SessionSettings paramSessionSettings);
  
  public abstract boolean rerunAvailable();
  
  public abstract boolean modifyAvailable();
  
  public abstract void rerunLastProfiling();
  
  public abstract boolean runCalibration(boolean paramBoolean, String paramString1, String paramString2, int paramInt);
  
  public abstract boolean shutdownBlockedAgent(String paramString, int paramInt1, int paramInt2);
  
  public abstract void stopApp();
  
  public final void addProfilingStateListener(ProfilingStateListener paramProfilingStateListener)
  {
    if (profilingStateListeners == null) {
      profilingStateListeners = new Vector();
    }
    if (!profilingStateListeners.contains(paramProfilingStateListener))
    {
      profilingStateListeners.add(paramProfilingStateListener);
      paramProfilingStateListener.profilingStateChanged(new ProfilingStateEvent(-1, currentProfilingState, defaultProfiler));
      paramProfilingStateListener.instrumentationChanged(-1, getTargetAppRunner().getProfilerClient().getCurrentInstrType());
    }
  }
  
  public boolean prepareInstrumentation(ProfilingSettings paramProfilingSettings)
  {
    try
    {
      ProfilerClient localProfilerClient = getTargetAppRunner().getProfilerClient();
      int i = getStatuscurrentInstrType;
      switch (paramProfilingSettings.getProfilingType())
      {
      case 1: 
        localProfilerClient.removeAllInstrumentation();
        
        break;
      case 2: 
        localProfilerClient.initiateMemoryProfInstrumentation(4);
        
        break;
      case 4: 
        localProfilerClient.initiateMemoryProfInstrumentation(5);
        
        break;
      case 8: 
      case 16: 
        instrumentSelectedRoots(paramProfilingSettings.getInstrumentationMethods());
        
        break;
      case 32: 
        ClientUtils.SourceCodeSelection[] arrayOfSourceCodeSelection = { paramProfilingSettings.getCodeFragmentSelection() };
        localProfilerClient.initiateCodeRegionInstrumentation(arrayOfSourceCodeSelection);
      }
      fireInstrumentationChanged(i, getStatuscurrentInstrType);
      
      return true;
    }
    catch (ClientUtils.TargetAppOrVMTerminated localTargetAppOrVMTerminated)
    {
      displayError(localTargetAppOrVMTerminated.getMessage());
      localTargetAppOrVMTerminated.printStackTrace(System.err);
    }
    catch (InstrumentationException localInstrumentationException)
    {
      displayError(localInstrumentationException.getMessage());
      localInstrumentationException.printStackTrace(System.err);
    }
    catch (BadLocationException localBadLocationException)
    {
      displayError(localBadLocationException.getMessage());
      localBadLocationException.printStackTrace(System.err);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      displayError(localClassNotFoundException.getMessage());
      localClassNotFoundException.printStackTrace(System.err);
    }
    catch (IOException localIOException)
    {
      displayError(localIOException.getMessage());
    }
    catch (ClassFormatError localClassFormatError)
    {
      displayError(localClassFormatError.getMessage());
    }
    return false;
  }
  
  public final boolean profilingInProgress()
  {
    int i = getProfilingState();
    
    return (i == 8) || (i == 4);
  }
  
  public final void removeProfilingStateListener(ProfilingStateListener paramProfilingStateListener)
  {
    if (profilingStateListeners != null) {
      profilingStateListeners.remove(paramProfilingStateListener);
    }
  }
  
  public static void debug(String paramString)
  {
    if (DEBUG) {
      System.err.println("Profiler.DEBUG: " + paramString);
    }
  }
  
  public static void debug(Exception paramException)
  {
    if (DEBUG)
    {
      System.err.print("Profiler.DEBUG: ");
      paramException.printStackTrace(System.err);
    }
  }
  
  public abstract String getLibsDir();
  
  public abstract int getPlatformArchitecture(String paramString);
  
  public abstract String getPlatformJDKVersion(String paramString);
  
  public abstract String getPlatformJavaFile(String paramString);
  
  protected final void fireInstrumentationChanged(final int paramInt1, final int paramInt2)
  {
    if (profilingStateListeners == null) {
      return;
    }
    Vector localVector;
    synchronized (this)
    {
      localVector = (Vector)profilingStateListeners.clone();
    }
    ??? = localVector.iterator();
    Runnable local1 = new Runnable()
    {
      public void run()
      {
        while (Ljava/lang/Object;.hasNext()) {
          ((ProfilingStateListener)Ljava/lang/Object;.next()).instrumentationChanged(paramInt1, paramInt2);
        }
      }
    };
    if (EventQueue.isDispatchThread()) {
      local1.run();
    } else {
      EventQueue.invokeLater(local1);
    }
  }
  
  protected final void fireProfilingStateChange(int paramInt1, int paramInt2)
  {
    currentProfilingState = paramInt2;
    if (profilingStateListeners == null) {
      return;
    }
    if (paramInt1 == paramInt2) {
      return;
    }
    Vector localVector;
    synchronized (this)
    {
      localVector = (Vector)profilingStateListeners.clone();
    }
    ??? = localVector.iterator();
    final ProfilingStateEvent localProfilingStateEvent = new ProfilingStateEvent(paramInt1, paramInt2, this);
    Runnable local2 = new Runnable()
    {
      public void run()
      {
        while (Ljava/lang/Object;.hasNext()) {
          ((ProfilingStateListener)Ljava/lang/Object;.next()).profilingStateChanged(localProfilingStateEvent);
        }
      }
    };
    if (EventQueue.isDispatchThread()) {
      local2.run();
    } else {
      EventQueue.invokeLater(local2);
    }
  }
  
  protected final void fireThreadsMonitoringChange()
  {
    if (profilingStateListeners == null) {
      return;
    }
    Vector localVector;
    synchronized (this)
    {
      localVector = (Vector)profilingStateListeners.clone();
    }
    ??? = localVector.iterator();
    Runnable local3 = new Runnable()
    {
      public void run()
      {
        while (Ljava/lang/Object;.hasNext()) {
          ((ProfilingStateListener)Ljava/lang/Object;.next()).threadsMonitoringChanged();
        }
      }
    };
    if (EventQueue.isDispatchThread()) {
      local3.run();
    } else {
      EventQueue.invokeLater(local3);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.lib.profiler.common.Profiler
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.lib.profiler.common;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import org.netbeans.lib.profiler.ProfilerEngineSettings;
import org.netbeans.lib.profiler.client.ClientUtils;
import org.netbeans.lib.profiler.client.ClientUtils.SourceCodeSelection;
import org.netbeans.lib.profiler.common.filters.FilterSet;
import org.netbeans.lib.profiler.common.filters.FilterUtils;
import org.netbeans.lib.profiler.common.filters.GlobalFilters;
import org.netbeans.lib.profiler.common.filters.SimpleFilter;
import org.netbeans.lib.profiler.global.InstrumentationFilter;

public class ProfilingSettings
{
  private static final ResourceBundle bundle = ResourceBundle.getBundle("org.netbeans.lib.profiler.common.Bundle");
  static final String DEFAULT_PROFILING_SETTINGS_NAME = bundle.getString("ProfilingSettings_DefaultProfilingSettingsName");
  private static final String UNKNOWN_PROFILING_SETTINGS_NAME = bundle.getString("ProfilingSettings_UnknownProfilingSettingsName");
  public static final int PROFILE_MONITOR = 1;
  public static final int PROFILE_MEMORY_ALLOCATIONS = 2;
  public static final int PROFILE_MEMORY_LIVENESS = 4;
  public static final int PROFILE_CPU_ENTIRE = 8;
  public static final int PROFILE_CPU_PART = 16;
  public static final int PROFILE_CPU_STOPWATCH = 32;
  public static final boolean QUICK_FILTER_INCLUSIVE = true;
  public static final boolean QUICK_FILTER_EXCLUSIVE = false;
  public static final String LINES_PREFIX = "[lines]";
  public static final String PROP_OVERRIDE_GLOBAL_SETTINGS = "profiler.settings.override";
  public static final String PROP_WORKING_DIR = "profiler.settings.override.working.dir";
  public static final String PROP_JVM_ARGS = "profiler.settings.override.jvm.args";
  public static final String PROP_JAVA_PLATFORM = "profiler.settings.override.java.platform";
  public static final String PROP_IS_PRESET = "profiler.settigns.ispreset";
  public static final String PROP_SETTINGS_NAME = "profiler.settings.settings.name";
  public static final String PROP_PROFILING_TYPE = "profiler.settings.profiling.type";
  public static final String PROP_THREADS_MONITORING_ENABLED = "profiler.settings.threads.monitoring.enabled";
  public static final String PROP_CPU_PROFILING_TYPE = "profiler.settings.cpu.profiling.type";
  public static final String PROP_EXCLUDE_WAIT_TIME = "profiler.settings.cpu.exclude.wait.time";
  public static final String PROP_INSTR_SCHEME = "profiler.settings.instr.scheme";
  public static final String PROP_THREAD_CPU_TIMER_ON = "profiler.settings.thread.cpu.timer.on";
  public static final String PROP_INSTRUMENT_GETTER_SETTER_METHODS = "profiler.settings.istrument.getter.setter.methods";
  public static final String PROP_INSTRUMENT_EMPTY_METHODS = "profiler.settings.instrument.empty.methods";
  public static final String PROP_INSTRUMENT_METHOD_INVOKE = "profiler.settings.instrument.method.invoke";
  public static final String PROP_INSTRUMENT_SPAWNED_THREADS = "profiler.settings.instrument.spawned.threads";
  public static final String PROP_N_PROFILED_THREADS_LIMIT = "profiler.settings.n.profiled.threads.limit";
  public static final String PROP_SORT_RESULTS_BY_THREAD_CPU_TIME = "profiler.settings.sort.results.by.thread.cpu.time";
  public static final String PROP_SAMPLING_INTERVAL = "profiler.settings.sampling.interval";
  public static final String PROP_INSTRUMENTATION_ROOT_METHODS_SIZE = "profiler.settings.instrumentation.root.methods.size";
  public static final String PROP_INSTRUMENTATION_ROOT_METHODS_PREFIX = "profiler.settings.istrumentation.root.methods-";
  public static final String PROP_INSTRUMENTATION_MARKER_METHODS_SIZE = "profiler.settings.instrumentation.marker.methods.size";
  public static final String PROP_INSTRUMENTATION_MARKER_METHODS_PREFIX = "profiler.settings.istrumentation.marker.methods-";
  public static final String PROP_FRAGMENT_SELECTION = "profiler.settings.fragment.selection";
  public static final String PROP_CODE_REGION_CPU_RES_BUF_SIZE = "profiler.settings.code.region.cpu.res.buf.size";
  public static final String PROP_RUN_GC_ON_GET_RESULTS_IN_MEMORY_PROFILING = "profiler.settings.run.gc.on.get.results.in.memory.profiling";
  public static final String PROP_OBJ_ALLOC_STACK_SAMPLING_INTERVAL = "profiler.settings.obj.alloc.stack.sampling.interval";
  public static final String PROP_OBJ_ALLOC_STACK_SAMPLING_DEPTH = "profiler.settings.obj.alloc.stack.sampling.depth";
  public static final String PROP_SELECTED_INSTR_FILTER = "profiler.settings.instrumentation.filter.selected";
  public static final String PROP_PROFILE_UNDERLYING_FRAMEWORK = "profiler.settings.profile.underlying.framework";
  public static final String PROP_PROFILING_POINTS_ENABLED = "profiler.settings.profilingpoints.enabled";
  public static final String PROP_QUICK_FILTER = "profiler.settings.cpu.quick.filter";
  public transient boolean instrRootMethodsPending = false;
  private ClientUtils.SourceCodeSelection fragmentSelection = null;
  private List instrumentationMarkerMethods = new ArrayList();
  private List instrumentationRootMethods = new ArrayList();
  private Object selectedInstrumentationFilter = SimpleFilter.NO_FILTER;
  private SimpleFilter quickFilter = FilterUtils.QUICK_FILTER;
  private String jvmArgs = "";
  private String platformName = null;
  private String settingsName = DEFAULT_PROFILING_SETTINGS_NAME;
  private String workingDir = "";
  private boolean excludeWaitTime = true;
  private boolean instrumentEmptyMethods = false;
  private boolean instrumentGetterSetterMethods = false;
  private boolean instrumentMethodInvoke = true;
  private boolean instrumentSpawnedThreads = false;
  private boolean isPreset = false;
  private boolean overrideGlobalSettings = false;
  private boolean profileUnderlyingFramework = false;
  private boolean runGCOnGetResultsInMemoryProfiling = true;
  private boolean sortResultsByThreadCPUTime = false;
  private boolean threadCPUTimerOn = false;
  private boolean threadsMonitoringEnabled = false;
  private boolean useProfilingPoints = true;
  private int allocStackTraceLimit = 0;
  private int allocTrackEvery = 10;
  private int codeRegionCPUResBufSize = 1000;
  private int cpuProfilingType = 0;
  private int instrScheme = 1;
  private int nProfiledThreadsLimit = 32;
  private int profilingType = 8;
  private int samplingInterval = 10;
  
  public ProfilingSettings() {}
  
  public ProfilingSettings(String paramString)
  {
    settingsName = paramString;
  }
  
  public void setAllocStackTraceLimit(int paramInt)
  {
    allocStackTraceLimit = paramInt;
  }
  
  public int getAllocStackTraceLimit()
  {
    return allocStackTraceLimit;
  }
  
  public void setAllocTrackEvery(int paramInt)
  {
    allocTrackEvery = paramInt;
  }
  
  public int getAllocTrackEvery()
  {
    return allocTrackEvery;
  }
  
  public void setCPUProfilingType(int paramInt)
  {
    cpuProfilingType = paramInt;
  }
  
  public int getCPUProfilingType()
  {
    return cpuProfilingType;
  }
  
  public void setCodeFragmentSelection(ClientUtils.SourceCodeSelection paramSourceCodeSelection)
  {
    fragmentSelection = paramSourceCodeSelection;
  }
  
  public ClientUtils.SourceCodeSelection getCodeFragmentSelection()
  {
    return fragmentSelection;
  }
  
  public void setCodeRegionCPUResBufSize(int paramInt)
  {
    codeRegionCPUResBufSize = paramInt;
  }
  
  public int getCodeRegionCPUResBufSize()
  {
    return codeRegionCPUResBufSize;
  }
  
  public void setExcludeWaitTime(boolean paramBoolean)
  {
    excludeWaitTime = paramBoolean;
  }
  
  public boolean getExcludeWaitTime()
  {
    return excludeWaitTime;
  }
  
  public void setInstrScheme(int paramInt)
  {
    instrScheme = paramInt;
  }
  
  public int getInstrScheme()
  {
    return instrScheme;
  }
  
  public void setInstrumentEmptyMethods(boolean paramBoolean)
  {
    instrumentEmptyMethods = paramBoolean;
  }
  
  public boolean getInstrumentEmptyMethods()
  {
    return instrumentEmptyMethods;
  }
  
  public void setInstrumentGetterSetterMethods(boolean paramBoolean)
  {
    instrumentGetterSetterMethods = paramBoolean;
  }
  
  public boolean getInstrumentGetterSetterMethods()
  {
    return instrumentGetterSetterMethods;
  }
  
  public void setInstrumentMethodInvoke(boolean paramBoolean)
  {
    instrumentMethodInvoke = paramBoolean;
  }
  
  public boolean getInstrumentMethodInvoke()
  {
    return instrumentMethodInvoke;
  }
  
  public void setInstrumentSpawnedThreads(boolean paramBoolean)
  {
    instrumentSpawnedThreads = paramBoolean;
  }
  
  public boolean getInstrumentSpawnedThreads()
  {
    return instrumentSpawnedThreads;
  }
  
  public void setInstrumentationMarkerMethods(ClientUtils.SourceCodeSelection[] paramArrayOfSourceCodeSelection)
  {
    instrumentationMarkerMethods.clear();
    for (int i = 0; i < paramArrayOfSourceCodeSelection.length; i++)
    {
      ClientUtils.SourceCodeSelection localSourceCodeSelection = paramArrayOfSourceCodeSelection[i];
      if (localSourceCodeSelection.isMarkerMethod()) {
        instrumentationMarkerMethods.add(localSourceCodeSelection);
      }
    }
  }
  
  public ClientUtils.SourceCodeSelection[] getInstrumentationMarkerMethods()
  {
    return (ClientUtils.SourceCodeSelection[])instrumentationMarkerMethods.toArray(new ClientUtils.SourceCodeSelection[instrumentationMarkerMethods.size()]);
  }
  
  public ClientUtils.SourceCodeSelection[] getInstrumentationMethods()
  {
    HashSet localHashSet = new HashSet();
    
    localHashSet.addAll(instrumentationRootMethods);
    localHashSet.addAll(instrumentationMarkerMethods);
    
    return (ClientUtils.SourceCodeSelection[])localHashSet.toArray(new ClientUtils.SourceCodeSelection[localHashSet.size()]);
  }
  
  public void setInstrumentationRootMethods(ClientUtils.SourceCodeSelection[] paramArrayOfSourceCodeSelection)
  {
    instrRootMethodsPending = false;
    instrumentationRootMethods.clear();
    for (int i = 0; i < paramArrayOfSourceCodeSelection.length; i++)
    {
      ClientUtils.SourceCodeSelection localSourceCodeSelection = paramArrayOfSourceCodeSelection[i];
      if (!localSourceCodeSelection.isMarkerMethod()) {
        instrumentationRootMethods.add(localSourceCodeSelection);
      }
    }
  }
  
  public ClientUtils.SourceCodeSelection[] getInstrumentationRootMethods()
  {
    return (ClientUtils.SourceCodeSelection[])instrumentationRootMethods.toArray(new ClientUtils.SourceCodeSelection[instrumentationRootMethods.size()]);
  }
  
  public void setIsPreset(boolean paramBoolean)
  {
    isPreset = paramBoolean;
  }
  
  public void setJVMArgs(String paramString)
  {
    jvmArgs = paramString;
  }
  
  public String getJVMArgs()
  {
    return jvmArgs;
  }
  
  public void setJavaPlatformName(String paramString)
  {
    platformName = paramString;
  }
  
  public String getJavaPlatformName()
  {
    return platformName;
  }
  
  public void setNProfiledThreadsLimit(int paramInt)
  {
    nProfiledThreadsLimit = paramInt;
  }
  
  public int getNProfiledThreadsLimit()
  {
    return nProfiledThreadsLimit;
  }
  
  public void setOverrideGlobalSettings(boolean paramBoolean)
  {
    overrideGlobalSettings = paramBoolean;
  }
  
  public boolean getOverrideGlobalSettings()
  {
    return overrideGlobalSettings;
  }
  
  public boolean isPreset()
  {
    return isPreset;
  }
  
  public void setProfileUnderlyingFramework(boolean paramBoolean)
  {
    profileUnderlyingFramework = paramBoolean;
  }
  
  public boolean getProfileUnderlyingFramework()
  {
    return profileUnderlyingFramework;
  }
  
  public void setProfilingType(int paramInt)
  {
    profilingType = paramInt;
  }
  
  public int getProfilingType()
  {
    return profilingType;
  }
  
  public void setQuickFilter(SimpleFilter paramSimpleFilter)
  {
    quickFilter = paramSimpleFilter;
  }
  
  public SimpleFilter getQuickFilter()
  {
    return quickFilter;
  }
  
  public void setRunGCOnGetResultsInMemoryProfiling(boolean paramBoolean)
  {
    runGCOnGetResultsInMemoryProfiling = paramBoolean;
  }
  
  public boolean getRunGCOnGetResultsInMemoryProfiling()
  {
    return runGCOnGetResultsInMemoryProfiling;
  }
  
  public void setSamplingInterval(int paramInt)
  {
    samplingInterval = paramInt;
  }
  
  public int getSamplingInterval()
  {
    return samplingInterval;
  }
  
  public void setSelectedInstrumentationFilter(Object paramObject)
  {
    selectedInstrumentationFilter = (paramObject != null ? paramObject : SimpleFilter.NO_FILTER);
  }
  
  public Object getSelectedInstrumentationFilter()
  {
    return selectedInstrumentationFilter;
  }
  
  public void setSettingsName(String paramString)
  {
    settingsName = paramString;
  }
  
  public String getSettingsName()
  {
    return settingsName;
  }
  
  public void setSortResultsByThreadCPUTime(boolean paramBoolean)
  {
    sortResultsByThreadCPUTime = paramBoolean;
  }
  
  public boolean getSortResultsByThreadCPUTime()
  {
    return sortResultsByThreadCPUTime;
  }
  
  public void setThreadCPUTimerOn(boolean paramBoolean)
  {
    threadCPUTimerOn = paramBoolean;
  }
  
  public boolean getThreadCPUTimerOn()
  {
    return threadCPUTimerOn;
  }
  
  public void setThreadsMonitoringEnabled(boolean paramBoolean)
  {
    threadsMonitoringEnabled = paramBoolean;
  }
  
  public boolean getThreadsMonitoringEnabled()
  {
    return threadsMonitoringEnabled;
  }
  
  public void setUseProfilingPoints(boolean paramBoolean)
  {
    useProfilingPoints = paramBoolean;
  }
  
  public void setWorkingDir(String paramString)
  {
    workingDir = paramString;
  }
  
  public String getWorkingDir()
  {
    return workingDir;
  }
  
  public void addRootMethod(String paramString1, String paramString2, String paramString3)
  {
    ClientUtils.SourceCodeSelection localSourceCodeSelection = new ClientUtils.SourceCodeSelection(paramString1, paramString2, paramString3);
    if (!instrumentationRootMethods.contains(localSourceCodeSelection)) {
      instrumentationRootMethods.add(localSourceCodeSelection);
    }
  }
  
  public void addRootMethods(ClientUtils.SourceCodeSelection[] paramArrayOfSourceCodeSelection)
  {
    for (int i = 0; i < paramArrayOfSourceCodeSelection.length; i++) {
      if (!instrumentationRootMethods.contains(paramArrayOfSourceCodeSelection[i])) {
        instrumentationRootMethods.add(paramArrayOfSourceCodeSelection[i]);
      }
    }
  }
  
  public void applySettings(ProfilerEngineSettings paramProfilerEngineSettings)
  {
    if (getOverrideGlobalSettings())
    {
      paramProfilerEngineSettings.setWorkingDir(getWorkingDir());
      paramProfilerEngineSettings.setJVMArgs(getJVMArgs());
      if (getJavaPlatformName() != null)
      {
        paramProfilerEngineSettings.setTargetJVMExeFile(Profiler.getDefault().getPlatformJavaFile(getJavaPlatformName()));
        paramProfilerEngineSettings.setTargetJDKVersionString(Profiler.getDefault().getPlatformJDKVersion(getJavaPlatformName()));
        paramProfilerEngineSettings.setSystemArchitecture(Profiler.getDefault().getPlatformArchitecture(getJavaPlatformName()));
      }
    }
    paramProfilerEngineSettings.setExcludeWaitTime(getExcludeWaitTime());
    paramProfilerEngineSettings.setCPUProfilingType(getCPUProfilingType());
    paramProfilerEngineSettings.setInstrScheme(getInstrScheme());
    paramProfilerEngineSettings.setAbsoluteTimerOn(true);
    paramProfilerEngineSettings.setThreadCPUTimerOn(getThreadCPUTimerOn());
    paramProfilerEngineSettings.setInstrumentGetterSetterMethods(getInstrumentGetterSetterMethods());
    paramProfilerEngineSettings.setInstrumentEmptyMethods(getInstrumentEmptyMethods());
    paramProfilerEngineSettings.setInstrumentMethodInvoke(getInstrumentMethodInvoke());
    paramProfilerEngineSettings.setInstrumentSpawnedThreads(getInstrumentSpawnedThreads());
    if (getNProfiledThreadsLimit() > 0) {
      paramProfilerEngineSettings.setNProfiledThreadsLimit(getNProfiledThreadsLimit());
    } else {
      paramProfilerEngineSettings.setNProfiledThreadsLimit(Integer.MAX_VALUE);
    }
    paramProfilerEngineSettings.setSortResultsByThreadCPUTime(getSortResultsByThreadCPUTime());
    
    paramProfilerEngineSettings.setSamplingInterval(getSamplingInterval());
    
    paramProfilerEngineSettings.setCodeRegionCPUResBufSize(getCodeRegionCPUResBufSize());
    
    paramProfilerEngineSettings.setRunGCOnGetResultsInMemoryProfiling(getRunGCOnGetResultsInMemoryProfiling());
    paramProfilerEngineSettings.setAllocTrackEvery(getAllocTrackEvery());
    paramProfilerEngineSettings.setAllocStackTraceLimit(getAllocStackTraceLimit());
    
    paramProfilerEngineSettings.setInstrumentationRootMethods(getInstrumentationMethods());
    
    InstrumentationFilter localInstrumentationFilter = paramProfilerEngineSettings.getInstrumentationFilter();
    localInstrumentationFilter.clearFilter();
    if (getSelectedInstrumentationFilter().equals(FilterUtils.NONE_FILTER))
    {
      localInstrumentationFilter.setFilterType(0);
      localInstrumentationFilter.setFilterStrings("");
      
      return;
    }
    if (getSelectedInstrumentationFilter().equals(quickFilter))
    {
      if (quickFilter.getFilterValue().length() > 0)
      {
        localInstrumentationFilter.setFilterType(quickFilter.getFilterType() == 1 ? 10 : 20);
        
        localInstrumentationFilter.setFilterStrings(quickFilter.getFilterValue());
      }
      else
      {
        localInstrumentationFilter.setFilterType(0);
        localInstrumentationFilter.setFilterStrings("");
      }
      return;
    }
    Object localObject;
   
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd