Class PerformanceProfiler

java.lang.Object
org.eclipse.persistence.sessions.SessionProfilerAdapter
org.eclipse.persistence.tools.profiler.PerformanceProfiler
All Implemented Interfaces:
Serializable, Cloneable, SessionProfiler

public class PerformanceProfiler extends SessionProfilerAdapter implements Serializable, Cloneable

Purpose: A tool used to provide high level performance profiling information.

See Also:
Author:
James Sutherland
  • Field Details

    • profiles

      protected List<Profile> profiles
    • session

      protected transient org.eclipse.persistence.internal.sessions.AbstractSession session
    • shouldLogProfile

      protected boolean shouldLogProfile
    • nestLevel

      protected int nestLevel
    • nestTime

      protected long nestTime
    • profileTime

      protected long profileTime
    • operationTimingsByThread

      protected Map<Integer,Map<String,Long>> operationTimingsByThread
    • operationStartTimesByThread

      protected Map<Integer,Map<String,Long>> operationStartTimesByThread
  • Constructor Details

    • PerformanceProfiler

      public PerformanceProfiler()
      PUBLIC: Create a new profiler. The profiler can be registered with a session to log performance information on queries.
    • PerformanceProfiler

      public PerformanceProfiler(boolean shouldLogProfile)
      PUBLIC: Create a new profiler. The profiler can be registered with a session to log performance information on queries.
  • Method Details

    • addProfile

      protected void addProfile(Profile profile)
    • buildProfileSummary

      public Profile buildProfileSummary()
      INTERNAL: Return a summary profile reporting on the profiles contained.
    • buildProfileSummaryByClass

      public Hashtable buildProfileSummaryByClass()
      INTERNAL: Return a map of summary profiles reporting on the profile contained.
    • buildProfileSummaryByQuery

      public Hashtable buildProfileSummaryByQuery()
      INTERNAL: Return a map of summary profiles reporting on the profile contained.
    • clone

      public PerformanceProfiler clone()
      Overrides:
      clone in class Object
    • dontLogProfile

      public void dontLogProfile()
      PUBLIC: Set whether after each query execution the profile result should be logged. By default this is false.
    • endOperationProfile

      public void endOperationProfile(String operationName)
      INTERNAL: End the operation timing.
      Specified by:
      endOperationProfile in interface SessionProfiler
      Overrides:
      endOperationProfile in class SessionProfilerAdapter
    • endOperationProfile

      public void endOperationProfile(String operationName, DatabaseQuery query, int weight)
      INTERNAL: End the operation timing.
      Specified by:
      endOperationProfile in interface SessionProfiler
      Overrides:
      endOperationProfile in class SessionProfilerAdapter
    • getNestLevel

      protected int getNestLevel()
    • getNestTime

      protected long getNestTime()
    • getOperationStartTimes

      protected Map<String,Long> getOperationStartTimes()
    • getOperationStartTimesByThread

      protected Map<Integer,Map<String,Long>> getOperationStartTimesByThread()
    • getOperationTimings

      protected Map<String,Long> getOperationTimings()
    • getOperationTimingsByThread

      protected Map<Integer,Map<String,Long>> getOperationTimingsByThread()
    • getProfiles

      public List<Profile> getProfiles()
      Return the profiles logged in this profiler.
    • getProfileTime

      protected long getProfileTime()
    • getSession

      public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
    • logProfile

      public void logProfile()
      PUBLIC: Set whether after each query execution the profile result should be logged. By default this is true.
    • logProfileSummary

      public void logProfileSummary()
      PUBLIC: Log a profile summary.
    • logProfileSummaryByClass

      public void logProfileSummaryByClass()
      PUBLIC: Log a profile summary by class.
    • logProfileSummaryByQuery

      public void logProfileSummaryByQuery()
      PUBLIC: Log a profile summary by query.
    • profileExecutionOfQuery

      public Object profileExecutionOfQuery(DatabaseQuery query, Record row, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Finish a profile operation if profiling. This assumes the start operation proceeds on the stack. The session must be passed to allow units of work etc. to share their parents profiler.
      Specified by:
      profileExecutionOfQuery in interface SessionProfiler
      Overrides:
      profileExecutionOfQuery in class SessionProfilerAdapter
      Returns:
      the execution result of the query.
    • setNestLevel

      protected void setNestLevel(int nestLevel)
    • setNestTime

      protected void setNestTime(long nestTime)
    • setOperationStartTimes

      protected void setOperationStartTimes(Map<String,Long> operationStartTimes)
    • setOperationStartTimesByThread

      protected void setOperationStartTimesByThread(Hashtable operationStartTimesByThread)
    • setOperationTimings

      protected void setOperationTimings(Map<String,Long> operationTimings)
    • setOperationTimingsByThread

      protected void setOperationTimingsByThread(Hashtable operationTimingsByThread)
    • setProfiles

      protected void setProfiles(Vector profiles)
    • setProfileTime

      protected void setProfileTime(long profileTime)
    • setSession

      public void setSession(Session session)
      Description copied from class: SessionProfilerAdapter
      INTERNAL: Set the session.
      Specified by:
      setSession in interface SessionProfiler
      Overrides:
      setSession in class SessionProfilerAdapter
    • setShouldLogProfile

      public void setShouldLogProfile(boolean shouldLogProfile)
      PUBLIC: Set whether after each query execution the profile result should be logged. By default this is true.
    • shouldLogProfile

      public boolean shouldLogProfile()
    • startOperationProfile

      public void startOperationProfile(String operationName)
      INTERNAL: Start the operation timing.
      Specified by:
      startOperationProfile in interface SessionProfiler
      Overrides:
      startOperationProfile in class SessionProfilerAdapter
    • startOperationProfile

      public void startOperationProfile(String operationName, DatabaseQuery query, int weight)
      INTERNAL: Start the operation timing.
      Specified by:
      startOperationProfile in interface SessionProfiler
      Overrides:
      startOperationProfile in class SessionProfilerAdapter
    • writeNestingTabs

      protected void writeNestingTabs(Writer writer)
    • getProfileWeight

      public int getProfileWeight()
      Description copied from class: SessionProfilerAdapter
      INTERNAL: Return DMS sensor weight(DMS)
      Specified by:
      getProfileWeight in interface SessionProfiler
      Overrides:
      getProfileWeight in class SessionProfilerAdapter
    • initialize

      public void initialize()
      Description copied from class: SessionProfilerAdapter
      INTERNAL: Initialize EclipseLink noun tree(DMS)
      Specified by:
      initialize in interface SessionProfiler
      Overrides:
      initialize in class SessionProfilerAdapter