Class Table

java.lang.Object
com.yourkit.probes.Table
Direct Known Subclasses:
ResourceTable, TableIntBytes, TableLongBytes

public class Table extends Object

Data storage table instance.

You should extend this class and declare user columns as its instance fields. The fields must be initialized before the constructor of the extending class returns. The fields will be gathered automatically via reflection on first access to the table object. It makes sense to have the table object instance singleton, so declare a static field to hold the table.

See source code of built-in probes to learn more how to use the tables.

  • Field Details

    • LASTING_EVENTS

      public static final long LASTING_EVENTS

      Set this bit in the table mask constructor parameter if the table rows are intended to describe lasting events, i.e. those which have start and end, and thus duration in time. If the bit is not set, the table will describe point events, i.e those which correspond to some "facts" which just happen but do not have any duration in time. More about event kinds....

      If this bit is set, high-precision process uptime will be automatically recorded for each row of the table when the row is created and when the row is closed, thus allowing to determine the event duration.

      If this bit is not set, process uptime will be recorded only when a row is created, thus it will only be possible to determine the event's position on the timeline, but not the event duration.

      See Also:
    • RECORD_THREAD

      public static final long RECORD_THREAD
      Set this bit in the table mask constructor parameter to record current thread for each row of the table when the row is created.
      See Also:
    • RECORD_STACK_TRACE

      public static final long RECORD_STACK_TRACE
      Set this bit in the table mask constructor parameter to record current stack trace for each row of the table when the row is created.
      See Also:
    • MASK_FOR_POINT_EVENTS

      public static final long MASK_FOR_POINT_EVENTS
      Pass this bit mask as the constructor parameter to create a table for point events (more about event kinds). Uptime, thread and stack trace will be recorded when the row is created. More about event kinds....
      See Also:
    • MASK_FOR_LASTING_EVENTS

      public static final long MASK_FOR_LASTING_EVENTS
      Pass this bit mask as the constructor parameter to create a table for lasting events (more about event kinds). Current thread and stack trace will be recorded when the table row is created. Uptime will be recorded when the row is created and when it is closed. Thread and stack trace are recorded only once because probes are intended to create and close rows in callbacks for the same method call.
      See Also:
    • NO_ROW

      public static final int NO_ROW
      No existing row index is equal to this value
      See Also:
  • Method Details

    • shouldIgnoreRow

      public static boolean shouldIgnoreRow(int row)
      Use for optimization purposes: there is no need to obtain values for such rows, thus they will not be stored.
      Returns:
      Whether the row is NO_ROW.
    • createRow

      public final int createRow()
    • createRow

      public final int createRow(int foreignKey)
      Create a row in a dependent table, i.e. having a foreign key column. The method is a shortcut for:
      
         int row = table.createRow();
         table.myForeignKeyColumn.set(row, foreignKey);
      Parameters:
      foreignKey - master table row index on which the row being created will depend
    • closeRow

      public final void closeRow(int row, @Nullable Throwable exception)
      Invoke this method when a lasting event ends.
    • setEventTableRowException

      public final void setEventTableRowException(int row, @Nullable Throwable exception)
      Invoke this method only for a lasting event.
    • setMinimumRecordedLastingEventTime

      public final void setMinimumRecordedLastingEventTime(int wallTimeMs)
      Specifies whether lasting events taking less than the given number of milliseconds should be dropped as the result of their closeRow(int, Throwable). This helps to limit the number of rows in the table in case when there are very many events of some kind, but only few of them deserve attention. Otherwise, recording all events would waste resources by storing non-useful information. UI event queue is a good example of such events: there are thousands of them, but only longest should be examined to investigate irresponsible UI.
      Parameters:
      wallTimeMs - specifies the number of milliseconds that must pass to ensure the events are retained in the table; specify 0 to retain all events (default behavior)
    • deleteRow

      public void deleteRow(int rowIndex)