001package io.ebean;
002
003/**
004 * A location for profiling transactions and queries.
005 * <p>
006 * Typically represents a class method in the form of class file and line of code that started
007 * the transaction or invoked the query.
008 * </p>
009 */
010public interface ProfileLocation {
011
012  /**
013   * Create and return a new ProfileLocation.
014   */
015  static ProfileLocation create() {
016    return XServiceProvider.profileLocationFactory().create();
017  }
018
019  /**
020   * Create and return a new ProfileLocation with a given lineNumber and label.
021   */
022  static ProfileLocation create(int lineNumber, String label) {
023    return XServiceProvider.profileLocationFactory().create(lineNumber, label);
024  }
025
026  /**
027   * Create and return a new ProfileLocation with a given location.
028   */
029  static ProfileLocation createAt(String location) {
030    return XServiceProvider.profileLocationFactory().createAt(location);
031  }
032
033  /**
034   * Obtain the description returning true if this is the initial call.
035   */
036  boolean obtain();
037
038  /**
039   * Return a short version of the location description.
040   */
041  String location();
042
043  /**
044   * Return the short label.
045   */
046  String label();
047
048  /**
049   * Return the full location.
050   */
051  String fullLocation();
052
053  /**
054   * Add execution time.
055   */
056  void add(long executionTime);
057
058  /**
059   * Return true if this request should be traced.
060   */
061  boolean trace();
062
063  /**
064   * Set the number of times to trace the transactions for this profile location.
065   */
066  void setTraceCount(int traceCount);
067}