All Projects → jsanc623 → PHPBenchTime

jsanc623 / PHPBenchTime

Licence: other
A lightweight benchmark timer for PHP

Programming Languages

PHP
23972 projects - #3 most used programming language
hack
652 projects

Labels

Projects that are alternatives of or similar to PHPBenchTime

croner
Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.
Stars: ✭ 169 (+550%)
Mutual labels:  timer
wht
Working Hours Tracker for Sailfish OS
Stars: ✭ 20 (-23.08%)
Mutual labels:  timer
tiny-timer
🕑 Small countdown timer and stopwatch module.
Stars: ✭ 39 (+50%)
Mutual labels:  timer
SAMD TimerInterrupt
This library enables you to use Interrupt from Hardware Timers on an SAMD-based board. These SAMD Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's mandatory if you …
Stars: ✭ 28 (+7.69%)
Mutual labels:  timer
animedoro-timer
An Animedoro timer for all the weebs out there | productivity : 📈
Stars: ✭ 37 (+42.31%)
Mutual labels:  timer
ioBroker.smartcontrol
Control devices smarter: by grouping, including triggers like motion, opening window, etc. and set target devices accordingly
Stars: ✭ 20 (-23.08%)
Mutual labels:  timer
ES-Timer
A USB timer powered by Digispark ATtiny85 according to 🍅 pomodoro time management technique
Stars: ✭ 45 (+73.08%)
Mutual labels:  timer
Tiny-Timer
Simple timer desktop app using electron
Stars: ✭ 51 (+96.15%)
Mutual labels:  timer
flitter
A Livesplit-inspired speedrunning split timer for Linux/macOS terminal. Supports global hotkeys.
Stars: ✭ 112 (+330.77%)
Mutual labels:  timer
clappr-plugins
Main plugins for the Clappr project
Stars: ✭ 22 (-15.38%)
Mutual labels:  timer
Figma-Timer
No description or website provided.
Stars: ✭ 13 (-50%)
Mutual labels:  timer
asynctimerqueue
Asynchronous timer queue mechanism(C++11)
Stars: ✭ 21 (-19.23%)
Mutual labels:  timer
chronocube
[UNMANTAINED]. Simple app to time your Rubik's Cube solves
Stars: ✭ 62 (+138.46%)
Mutual labels:  timer
TimerInterrupt
This library enables you to use Interrupt from Hardware Timers on an Arduino, such as Nano, UNO, Mega, etc. It now supports 16 ISR-based timers, while consuming only 1 hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based timers. Therefore, their executions are not blocked by bad-behavin…
Stars: ✭ 76 (+192.31%)
Mutual labels:  timer
use-countdown-timer
React hook exposing a countdown timer with optional expiration reset callbacks
Stars: ✭ 31 (+19.23%)
Mutual labels:  timer
plf nanotimer
A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and as simple as possible to create the lowest amount of overhead.
Stars: ✭ 108 (+315.38%)
Mutual labels:  timer
cya
Easy to use snapshot and restore utility for any Linux (Unix) OS and filesystem powered by BASH
Stars: ✭ 73 (+180.77%)
Mutual labels:  timer
codeforces-timer
A Google Chrome extension which adds a timer to practice timed problem solving on codeforces
Stars: ✭ 20 (-23.08%)
Mutual labels:  timer
time-tracker-cli
Super tiny and ligthway time tracker for all cli lovers
Stars: ✭ 79 (+203.85%)
Mutual labels:  timer
circlebars
Add circular progress bars and countdown timers easily with circlebars Created by @itaditya. Demo at >
Stars: ✭ 38 (+46.15%)
Mutual labels:  timer

PHPBenchTime v2.1.0

Latest Stable Version Total Downloads Monthly Downloads License Build Status

A light benchmark timer class for PHP. PHPBenchTime is quite simple to use and is loaded with functionality - including detailed summary data, easily readable source, a robust lap system and pause/unpause functionality.

Also, please check out my Python version of this package: PyBenchTime Python Package

On Packagist

https://packagist.org/packages/jsanc623/phpbenchtime

Methods

public start()
public end()
public reset()
public lap()
public summary()
public pause()
public unPause()
private endLap()
private getCurrentTime()

Properties

private startTime
private endTime
private pauseTime
private laps
private lapCount

Usage

You should see the Usage.php file in source for the best how to documentation. However, here's an overview:

Load and initiate the PHPBenchTime Timer:

require('PHPBenchTime.php');
use PHPBenchTime\Timer;
$T = new Timer;

That was easy! Now lets start a new timer:

$T->start();

Then lets just sleep for 3 seconds:

sleep(3);

Now, lets end the timer, and put results in $time:

$time = $T->end();

When we end a timer, we receive an array back, containing the start time, end time and difference between start and end times:

Array (
    [running] => false
    [start] => 1406146951.9998
    [end] => 1406146952.0638
    [total] => 0.0019998550415039
    [paused] => 0
    [laps] => Array (
        [0] => Array (
            [name] => start
            [start] => 1406146951.9998
            [end] => 1406146952.0018
            [total] => 0.0019998550415039
        )
    )
)

Advanced Usage : Laps

PHPBenchTime also allows you to set laps between code execution, which allows you to determine what part of your code is causing a bottleneck.

Let's sleep for a couple of seconds between laps:

sleep(1);
$T->lap();
sleep(2);
$T->lap();

Now, let's end the timer:

$time = $T->end();

Let's see the results:

Array (
    [running] => false
    [start] => 1406146951.9998
    [end] => 1406146952.0638
    [total] => 0.063999891281128
    [paused] => 0.041000127792358
    [laps] => Array (
        [0] => Array (
            [name] => start
            [start] => 1406146951.9998
            [end] => 1406146952.0018
            [total] => 0.0019998550415039
        )
        [1] => Array (
            [name] => 1
            [start] => 1406146952.0018
            [end] => 1406146952.0028
            [total] => 0.0010001659393311
        )
        [2] => Array (
            [name] => 2
            [start] => 1406146952.0028
            [end] => 1406146952.0128
            [total] => 0.0099999904632568
        )
    )
)

Advanced Usage

PHPBenchTime allows you to do named laps, as well as to pause and unpause the timer (say you want to make a network call or a call out to the database, but don't want to include that time in your benchmark - pause and then unpause after you receive the network/database data).

HISTORY

  • v1.0.0: Static Birth!
  • v1.1.0: Static Namespaces!
  • v1.2.0: Non-Static Namespaces!
  • v1.3.0: Laps! Laps! Laps!
  • v2.0.0: Complete rewrite, adds pause, unpause, central lap system and more detailed summary
  • v2.1.0: Performance enhancements, unit tests, etc
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].