temant/timer

There is no license information available for the latest version (v1.0.0) of this package.

v1.0.0 2025-03-10 12:41 UTC

This package is auto-updated.

Last update: 2025-04-10 13:04:52 UTC


README

Overview

The Timer library provides a simple and efficient way to measure the execution time of a block of code in various time units. It supports measuring execution time in seconds, milliseconds, or microseconds.

Features

  • Measure execution time using a closure or callable function.
  • Supports different time units: seconds, milliseconds, microseconds.
  • Lightweight and easy to use.

Installation

composer require temant/timer

Usage

use Temant\Timer\Timer;
use Temant\Timer\TimeUnitEnum;

$executionTime = Timer::measure(function () {
    sleep(1); // Simulating a delay
}, TimeUnitEnum::MILLISECONDS);

echo "Execution time in milliseconds: $executionTime";

License

This project is licensed under the MIT License. See the LICENSE file for details.