MySQL Connector/J size='-1'>5.0.8

com.mysql.jdbc.profiler
Class ProfilerEvent

java.lang.Object
  extended bycom.mysql.jdbc.profiler.ProfilerEvent

public class ProfilerEvent
extends java.lang.Object

Author:
mmatthew

Field Summary
protected  java.lang.String catalog
          The catalog the event occurred on
protected  int catalogIndex
          The catalog the event occurred on (as an index into a dictionary, used by 'remote' profilers for efficiency)?
protected  long connectionId
          Associated connection (-1 for none)
protected  java.lang.String durationUnits
          What units was the duration measured in?
protected  java.lang.Throwable eventCreationPoint
          Where was the event created (as a Throwable)?
protected  java.lang.String eventCreationPointDesc
          Where was the event created (as a string description of the eventCreationPoint)?
protected  int eventCreationPointIndex
          Where was the event created (as an index into a dictionary, used by 'remote' profilers for efficiency)?
protected  long eventCreationTime
          When was the event created?
protected  long eventDuration
          How long did the event last?
protected  byte eventType
          Type of event
protected  java.lang.String hostName
          The hostname the event occurred on
protected  int hostNameIndex
          The hostname the event occurred on (as an index into a dictionary, used by 'remote' profilers for efficiency)?
protected  java.lang.String message
          Optional event message
protected  int resultSetId
          Associated result set (-1 for none)
protected  int statementId
          Associated statement (-1 for none)
static byte TYPE_EXECUTE
          Profiler event for prepared statements being executed
static byte TYPE_FETCH
          Profiler event for result sets being retrieved
static byte TYPE_OBJECT_CREATION
          Profiler creating object type event
static byte TYPE_PREPARE
          Profiler event for prepared statements being prepared
static byte TYPE_QUERY
          Profiler event for a query being executed
static byte TYPE_SLOW_QUERY
          Profiler event for slow query
static byte TYPE_WARN
          A Profiler warning event
 
Constructor Summary
ProfilerEvent(byte eventType, java.lang.String hostName, java.lang.String catalog, long connectionId, int statementId, int resultSetId, long eventCreationTime, long eventDuration, java.lang.String durationUnits, java.lang.String eventCreationPointDesc, java.lang.Throwable eventCreationPoint, java.lang.String message)
          Creates a new profiler event
 
Method Summary
 java.lang.String getCatalog()
          Returns the catalog in use
 long getConnectionId()
          Returns the id of the connection in use when this event was created.
 java.lang.String getDurationUnits()
          Returns the units for getEventDuration()
 java.lang.Throwable getEventCreationPoint()
          Returns the point (as a Throwable stacktrace) where this event was created.
 java.lang.String getEventCreationPointAsString()
          Returns the description of when this event was created.
 long getEventCreationTime()
          Returns the time (in System.currentTimeMillis() form) when this event was created
 long getEventDuration()
          Returns the duration of the event in milliseconds
 byte getEventType()
          Returns the event type flag
 java.lang.String getMessage()
          Returns the optional message for this event
 int getResultSetId()
          Returns the id of the result set in use when this event was created.
 int getStatementId()
          Returns the id of the statement in use when this event was created.
 byte[] pack()
          Creates a binary representation of this event.
 java.lang.String toString()
          Returns a representation of this event as a String.
static ProfilerEvent unpack(byte[] buf)
          Unpacks a binary representation of this event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_WARN

public static final byte TYPE_WARN
A Profiler warning event

See Also:
Constant Field Values

TYPE_OBJECT_CREATION

public static final byte TYPE_OBJECT_CREATION
Profiler creating object type event

See Also:
Constant Field Values

TYPE_PREPARE

public static final byte TYPE_PREPARE
Profiler event for prepared statements being prepared

See Also:
Constant Field Values

TYPE_QUERY

public static final byte TYPE_QUERY
Profiler event for a query being executed

See Also:
Constant Field Values

TYPE_EXECUTE

public static final byte TYPE_EXECUTE
Profiler event for prepared statements being executed

See Also:
Constant Field Values

TYPE_FETCH

public static final byte TYPE_FETCH
Profiler event for result sets being retrieved

See Also:
Constant Field Values

TYPE_SLOW_QUERY

public static final byte TYPE_SLOW_QUERY
Profiler event for slow query

See Also:
Constant Field Values

eventType

protected byte eventType
Type of event


connectionId

protected long connectionId
Associated connection (-1 for none)


statementId

protected int statementId
Associated statement (-1 for none)


resultSetId

protected int resultSetId
Associated result set (-1 for none)


eventCreationTime

protected long eventCreationTime
When was the event created?


eventDuration

protected long eventDuration
How long did the event last?


durationUnits

protected java.lang.String durationUnits
What units was the duration measured in?


hostNameIndex

protected int hostNameIndex
The hostname the event occurred on (as an index into a dictionary, used by 'remote' profilers for efficiency)?


hostName

protected java.lang.String hostName
The hostname the event occurred on


catalogIndex

protected int catalogIndex
The catalog the event occurred on (as an index into a dictionary, used by 'remote' profilers for efficiency)?


catalog

protected java.lang.String catalog
The catalog the event occurred on


eventCreationPointIndex

protected int eventCreationPointIndex
Where was the event created (as an index into a dictionary, used by 'remote' profilers for efficiency)?


eventCreationPoint

protected java.lang.Throwable eventCreationPoint
Where was the event created (as a Throwable)?


eventCreationPointDesc

protected java.lang.String eventCreationPointDesc
Where was the event created (as a string description of the eventCreationPoint)?


message

protected java.lang.String message
Optional event message

Constructor Detail

ProfilerEvent

public ProfilerEvent(byte eventType,
                     java.lang.String hostName,
                     java.lang.String catalog,
                     long connectionId,
                     int statementId,
                     int resultSetId,
                     long eventCreationTime,
                     long eventDuration,
                     java.lang.String durationUnits,
                     java.lang.String eventCreationPointDesc,
                     java.lang.Throwable eventCreationPoint,
                     java.lang.String message)
Creates a new profiler event

Parameters:
eventType - the event type (from the constants TYPE_????)
hostName - the hostname where the event occurs
catalog - the catalog in use
connectionId - the connection id (-1 if N/A)
statementId - the statement id (-1 if N/A)
resultSetId - the result set id (-1 if N/A)
eventCreationTime - when was the event created?
eventCreationPointDesc - event creation point as a string
eventCreationPoint - event creation point as a Throwable
message - optional message
Method Detail

getEventCreationPointAsString

public java.lang.String getEventCreationPointAsString()
Returns the description of when this event was created.

Returns:
a description of when this event was created.

toString

public java.lang.String toString()
Returns a representation of this event as a String.

Returns:
a String representation of this event.

unpack

public static ProfilerEvent unpack(byte[] buf)
                            throws java.lang.Exception
Unpacks a binary representation of this event.

Parameters:
buf - the binary representation of this event
Returns:
the unpacked Event
Throws:
java.lang.Exception - if an error occurs while unpacking the event

pack

public byte[] pack()
            throws java.lang.Exception
Creates a binary representation of this event.

Returns:
a binary representation of this event
Throws:
java.lang.Exception - if an error occurs while packing this event.

getCatalog

public java.lang.String getCatalog()
Returns the catalog in use

Returns:
the catalog in use

getConnectionId

public long getConnectionId()
Returns the id of the connection in use when this event was created.

Returns:
the connection in use

getEventCreationPoint

public java.lang.Throwable getEventCreationPoint()
Returns the point (as a Throwable stacktrace) where this event was created.

Returns:
the point where this event was created

getEventCreationTime

public long getEventCreationTime()
Returns the time (in System.currentTimeMillis() form) when this event was created

Returns:
the time this event was created

getEventDuration

public long getEventDuration()
Returns the duration of the event in milliseconds

Returns:
the duration of the event in milliseconds

getDurationUnits

public java.lang.String getDurationUnits()
Returns the units for getEventDuration()


getEventType

public byte getEventType()
Returns the event type flag

Returns:
the event type flag

getResultSetId

public int getResultSetId()
Returns the id of the result set in use when this event was created.

Returns:
the result set in use

getStatementId

public int getStatementId()
Returns the id of the statement in use when this event was created.

Returns:
the statement in use

getMessage

public java.lang.String getMessage()
Returns the optional message for this event

Returns:
the message stored in this event

MySQL Connector/J size='-1'>5.0.8