You are here

interface RuntimeMeasurementInterface in Purge 8.3

Describes a execution time measurer for invalidation processing.

Hierarchy

Expanded class hierarchy of RuntimeMeasurementInterface

All classes that implement RuntimeMeasurementInterface

File

src/Plugin/Purge/Purger/RuntimeMeasurementInterface.php, line 10

Namespace

Drupal\purge\Plugin\Purge\Purger
View source
interface RuntimeMeasurementInterface extends CounterInterface {

  /**
   * Return a value safe for time hints, between 0.1 and 10.00.
   *
   * @param float $value
   *   The measurement value.
   *
   * @see \Drupal\purge\Plugin\Purge\Purger\PurgerCapacityDataInterface::getTimeHint()
   *
   * @return float
   *   The same value or 0.1 or 10.0 when it exceeded either boundary.
   */
  public function getSafeTimeHintValue($value);

  /**
   * Start measuring execution time.
   *
   * @throws \LogicException
   *   Thrown when already started before without calling ::stop().
   */
  public function start();

  /**
   * Stop measuring execution time and store if necessary.
   *
   * To gather safe time hint measurements, the following rules apply:
   *
   *  - All invalidations MUST have ::SUCCEEDED, if any of them failed the
   *    measurement will not be saved as it is likely unrepresentative data.
   *
   *  - Measurements slower than previous records take priority. This means that
   *    a single slow (yet successful) performance will relentlessly adjust the
   *    measurement upwards, better safe...
   *
   *  - Every faster measurement than previously stored records leads to 10%
   *    reduction of the last recorded measurement. This means structural low
   *    performance will be rewarded by more capacity, but slow and carefully!
   *
   * @param \Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface[] $invalidations
   *   Non-associative array of processed invalidation objects.
   *
   * @throws \LogicException
   *   Thrown when the $invalidations parameter is empty.
   * @throws \LogicException
   *   Thrown when any invalidation isn't a InvalidationInterface instance.
   * @throws \LogicException
   *   Thrown when ::start() hasn't been called yet.
   */
  public function stop(array $invalidations);

}

Members

Namesort descending Modifiers Type Description Overrides
CounterInterface::decrement public function Decrease the counter. 1
CounterInterface::disableDecrement public function Disable the possibility to decrement the counter. 1
CounterInterface::disableIncrement public function Disable the possibility to increment the counter. 1
CounterInterface::disableSet public function Disable the possibility of setting counter. 1
CounterInterface::get public function Get the current value. 1
CounterInterface::getInteger public function Get the current value as integer. 1
CounterInterface::increment public function Increase the counter. 1
CounterInterface::set public function Overwrite the counter value. 1
CounterInterface::setWriteCallback public function Set the callback that gets called when writes occur. 1
CounterInterface::__construct public function Construct a counter object. 1
RuntimeMeasurementInterface::getSafeTimeHintValue public function Return a value safe for time hints, between 0.1 and 10.00. 1
RuntimeMeasurementInterface::start public function Start measuring execution time. 1
RuntimeMeasurementInterface::stop public function Stop measuring execution time and store if necessary. 1