Package com.mysql.cj.log
Class ProfilerEventImpl
java.lang.Object
com.mysql.cj.log.ProfilerEventImpl
- All Implemented Interfaces:
ProfilerEvent
public class ProfilerEventImpl extends java.lang.Object implements ProfilerEvent
-
Field Summary
Fields inherited from interface com.mysql.cj.log.ProfilerEvent
NA, TYPE_EXECUTE, TYPE_FETCH, TYPE_OBJECT_CREATION, TYPE_PREPARE, TYPE_QUERY, TYPE_SLOW_QUERY, TYPE_USAGE -
Constructor Summary
Constructors Constructor Description ProfilerEventImpl(byte eventType, java.lang.String hostName, java.lang.String db, long connectionId, int statementId, int resultSetId, long eventDuration, java.lang.String durationUnits, java.lang.Throwable eventCreationPoint, java.lang.String message)Creates a new profiler event -
Method Summary
Modifier and Type Method Description longgetConnectionId()Returns the id of the associated connection (-1 for none).java.lang.StringgetDatabase()Returns the database the event occurred on.java.lang.StringgetDurationUnits()Returns the units for getEventDuration()java.lang.StringgetEventCreationPointAsString()Returns the description of where the event was created.longgetEventCreationTime()Returns the time (in System.currentTimeMillis() form) when this event was created.longgetEventDuration()Returns the duration of the event in millisecondsbytegetEventType()Returns the event typejava.lang.StringgetHostName()Returns the host name the event occurred on.java.lang.StringgetMessage()Returns the optional message for this eventintgetResultSetId()Returns the id of the associated result set (-1 for none).intgetStatementId()Returns the id of the associated statement (-1 for none).byte[]pack()Creates a binary representation of this event.java.lang.StringtoString()Returns a representation of this event as a String.static ProfilerEventunpack(byte[] buf)Unpacks a binary representation of this event.
-
Constructor Details
-
ProfilerEventImpl
public ProfilerEventImpl(byte eventType, java.lang.String hostName, java.lang.String db, long connectionId, int statementId, int resultSetId, long eventDuration, java.lang.String durationUnits, 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 occursdb- the database in useconnectionId- the connection id (-1 if N/A)statementId- the statement id (-1 if N/A)resultSetId- the result set id (-1 if N/A)eventDuration- how long did the event last?durationUnits- time units user for eventDurationeventCreationPoint- event creation point as a Throwablemessage- optional message
-
-
Method Details
-
getEventType
public byte getEventType()Description copied from interface:ProfilerEventReturns the event type- Specified by:
getEventTypein interfaceProfilerEvent- Returns:
- the event type
-
getHostName
public java.lang.String getHostName()Description copied from interface:ProfilerEventReturns the host name the event occurred on.- Specified by:
getHostNamein interfaceProfilerEvent- Returns:
- host name
-
getDatabase
public java.lang.String getDatabase()Description copied from interface:ProfilerEventReturns the database the event occurred on.- Specified by:
getDatabasein interfaceProfilerEvent- Returns:
- the database in use
-
getConnectionId
public long getConnectionId()Description copied from interface:ProfilerEventReturns the id of the associated connection (-1 for none).- Specified by:
getConnectionIdin interfaceProfilerEvent- Returns:
- the connection in use
-
getStatementId
public int getStatementId()Description copied from interface:ProfilerEventReturns the id of the associated statement (-1 for none).- Specified by:
getStatementIdin interfaceProfilerEvent- Returns:
- the statement in use
-
getResultSetId
public int getResultSetId()Description copied from interface:ProfilerEventReturns the id of the associated result set (-1 for none).- Specified by:
getResultSetIdin interfaceProfilerEvent- Returns:
- the result set in use
-
getEventCreationTime
public long getEventCreationTime()Description copied from interface:ProfilerEventReturns the time (in System.currentTimeMillis() form) when this event was created.- Specified by:
getEventCreationTimein interfaceProfilerEvent- Returns:
- the time this event was created
-
getEventDuration
public long getEventDuration()Description copied from interface:ProfilerEventReturns the duration of the event in milliseconds- Specified by:
getEventDurationin interfaceProfilerEvent- Returns:
- the duration of the event in milliseconds
-
getDurationUnits
public java.lang.String getDurationUnits()Description copied from interface:ProfilerEventReturns the units for getEventDuration()- Specified by:
getDurationUnitsin interfaceProfilerEvent- Returns:
- name of duration units
-
getEventCreationPointAsString
public java.lang.String getEventCreationPointAsString()Description copied from interface:ProfilerEventReturns the description of where the event was created.- Specified by:
getEventCreationPointAsStringin interfaceProfilerEvent- Returns:
- a description of where this event was created.
-
getMessage
public java.lang.String getMessage()Description copied from interface:ProfilerEventReturns the optional message for this event- Specified by:
getMessagein interfaceProfilerEvent- Returns:
- the message stored in this event
-
toString
public java.lang.String toString()Returns a representation of this event as a String.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String representation of this event.
-
unpack
Unpacks a binary representation of this event.- Parameters:
buf- the binary representation of this event- Returns:
- the unpacked Event
-
pack
public byte[] pack()Description copied from interface:ProfilerEventCreates a binary representation of this event.- Specified by:
packin interfaceProfilerEvent- Returns:
- a binary representation of this event
-