Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> ja mierzyc czas wykonanego skryptu?
b3
post
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.....
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Seth
post
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 (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

$timer->Stop();

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

Posty w temacie
- b3   ja mierzyc czas wykonanego skryptu?   10.12.2003, 21:58:38
- - Seth   Np. tak: class Timer { var $_startTimer = 0,...   10.12.2003, 23:03:57


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

 



RSS Aktualny czas: 26.12.2025 - 09:08