Re: Fsockopen with ssl takes 8.4 seconds to return on Windows
| From: | George Cherian | Date: | Sun, 05 Mar 2006 14:28:32 +0000 |
| Subject: | Re: Fsockopen with ssl takes 8.4 seconds to return on Windows | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26743@lists.php.net to get a copy of this message | ||
On Sun, Mar 05, 2006 at 06:45:12AM -0500, trystano@aol.com wrote:
> Hi George, thanks for informing us of this info.
>
> Can I ask how managed to get these times of executing the fsockopen functions?
>
> Tryst
Do you mean how I managed to profile my code? Or how I actually ran it? For profiling I have a
simple function called as print_time dispersed throughout my code. You can just say
--------------------
print_time("fsockopen");
fsockopen("...");
print_time("fsockopen", "Fsockopen Took: ");
--------------------
print_time('db_read');
sql_query('');
print_time('db_read', "Db read took');
This way you can simply find the time for any two points of the script. I don't know how much
overhead the print_time causes, but I don't think that's the issue, since on linux it
works fine.
Thanks.
George
function print_time($var, $mess = null, $dbg = 2)
{
static $last;
$now = microtime(true);
if (!isset($last[$var])) {
$last[$var] = $now;
return;
}
$diff = round($now - $last[$var], 7);
$now = round($now, 7);
$last[$var] = $now;
if (!$mess) {
return;
}
print("$mess: $diff <br> \n");
}