time debug php

Solutions on MaxInterview for time debug php by the best coders in the world

showing results for - "time debug php"
Nele
09 Sep 2020
1// Script start
2$rustart = getrusage();
3
4// Code ...
5
6// Script end
7function rutime($ru, $rus, $index) {
8    return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))
9     -  ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000));
10}
11
12$ru = getrusage();
13echo "This process used " . rutime($ru, $rustart, "utime") .
14    " ms for its computations\n";
15echo "It spent " . rutime($ru, $rustart, "stime") .
16    " ms in system calls\n";
17