Welcome Guest, Not a member yet? Register   Sign In
Benchmark library and microtime() usage
#1

[eluser]Unknown[/eluser]
Hello,

In the benchmark library the mark function uses microtime() to get the current time. But this only returns the actual time elapsed. If your server is running multiple tasks when you run your script you will get varying results.

You can address this by replacing the old Benchmark::mark method with the following code that uses getrusage() instead.
Code:
function mark($name)
{
    $data = getrusage();
    $this->marker[$name] = sprintf("%d.#d", $data['ru_utime.tv_sec'], $data['ru_utime.tv_usec']);
}
#2

[eluser]Unknown[/eluser]
Ok, the system is overriding my text

the pattern is

% d . % 0 6 d

without spaces




Theme © iAndrew 2016 - Forum software by © MyBB