Skip to content

InitPHP/PerformanceMeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PerformanceMeter

A helpful library that allows you to measure and compare the runtime of the code you write with PHP.

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Installation

composer require initphp/performance-meter

This is a library consisting of a single file and a single class. You can choose to manually include the src/PerformanceMeter.php file in the project. However, I recommend Composer to manage patches and updates more easily.

Usage

require_once "../vendor/autoload.php";

use InitPHP\PerformanceMeter\PerformanceMeter;

PerformanceMeter::setPointer('main');
for($i = 0; $i <= 1000; $i++){
    usleep(10);
}
PerformanceMeter::setPointer('mainEnd');

echo PerformanceMeter::elapsedTime('main', 'mainEnd', 3) . ' seconds passed ';
echo PerformanceMeter::memoryUsage('main', 'mainend', 2) . ' memory used.';
// Output : "15.204 seconds passed 0.77KB memory used."

Credits

License

Copyright © 2022 MIT License

About

A helpful library that allows you to measure and compare the runtime of the code you write with PHP.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages