Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> ja mierzyc czas wykonanego skryptu?
b3
post 10.12.2003, 21:58:38
Post #1





Grupa: Zarejestrowani
Postów: 65
Pomógł: 2
Dołączył: 25.08.2003
Skąd: Lublin

Ostrzeżenie: (0%)
-----


no ja bym to tak rozwiazal

[php:1:309bbda4e9]<?php
function timer() {
$unix=date("U");
$micro=microtime();
return $unix+$micro;
}

// POCZATEK SKRYPTU
$start=timer();

// KONIEC SKRYPTU
$end=$timer();

// WYNIKI
print $end-$start;
?>[/php:1:309bbda4e9]

a jak wy to byscie rozwiazali.....


--------------------
textmate @mac

trance / buraki
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
Seth
post 10.12.2003, 23:03:57
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 335
Pomógł: 6
Dołączył: 7.03.2002

Ostrzeżenie: (0%)
-----


Np. tak:
[php:1:9d3ffffca4]class Timer
{
var
$_startTimer = 0,
$result = 0;

function _GetTimer()
{
list( $uSec, $sec ) = explode( ' ', microtime() );

return (float)$uSec + (float)$sec;
}

function Start()
{
ob_start();

$this->_startTimer = $this->_GetTimer();
}

function Stop()
{
$this->result = $this->_GetTimer() - $this->_startTimer;

ob_end_flush();
}
}

$timer = new Timer();

$timer->Start();

sleep(3); // przerwa na kawe winksmiley.jpg

$timer->Stop();

print $timer->result;[/php:1:9d3ffffca4]
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.06.2025 - 17:00