| start() | เริ่มจับเวลาประมวลผล และเริ่มนับจำนวนทรัพยากรที่ใช้ |
|---|---|
| stop() | หยุดจับเวลาการประมวลผล และหยุดนับจำนวนทรัพยากรที่ใช้ |
| get() | ใช้คืนค่าเวลาที่จับได้ และจำนวนทรัพยากรที่ใช้ โดยจะคืนค่ามาให้แบบ array จะมี 2 key คือ time และ memory |
method:start ( name );
return type:void
special:static
content:เริ่มจับเวลาประมวลผล และเริ่มนับจำนวนทรัพยากรที่ใช้
example:Benchmark::start ( "load_resource" );
method:stop ( name );
return type:void
special:static
content:หยุดจับเวลาการประมวลผล และหยุดนับจำนวนทรัพยากรที่ใช้
example:Benchmark::start ( "load_resource" ); for ( $i=0; $i<100; $i++ ) { $i += $i; } Benchmark::stop ( "load_resource" );
method:get ( name, decimal );
return type:array
special:static
content:ใช้คืนค่าเวลาที่จับได้ และจำนวนทรัพยากรที่ใช้ โดยจะคืนค่ามาให้แบบ array จะมี 2 key คือ time และ memory
example:Benchmark::start ( "load_resource" ); for ( $i=0; $i<100; $i++ ) { $i += $i; } Benchmark::stop ( "load_resource" ); print_r ( Benchmark::get( "load_resource" ) );
comment:ตัวแปร decimal คือกำหนดจำนวนจุดทศนิยม ( ถ้าไม่กำหนดคือจะเป็น 4 หลักโดยอัตโนมัติ ) ตัวแปร name ถ้ากำหนด true จะคืนค่าทุกอย่างของ Benchmark