PEAR gets the program runtime

xiaoxiao2021-03-06  34

Require_once ("Benchmark / Timer.php");

$ String = "";

$ TIMER = New Benchmark_timer ();

$ TIMER-> Start ();

For ($ I = 1; $ i <= 10000; $ i )

{

$ String. = $ I;

}

$ TIMER-> SetMarker ('Mark1');

$ String = "";

For ($ I = 1; $ i <= 1000; $ i )

{

$ String. = $ I;

}

$ TIMER-> Stop ();

$ TIMER-> Display ();

?>

This way you can clearly see the time running each block, then find the problem. Not only that, the other two classes in Benchmark can be clearly known and the number of times of the CALL of the function or the class is running. as follows:

Code

Run (10, 'myobj-> foo', 'test'); $ results = $ benchmark-> get (); print_r ($ results);?>>>

转载请注明原文地址:https://www.9cbs.com/read-63778.html

New Post(0)