Thats useful.

Thanks for the nice function! :)

Tryst

-----Original Message-----
From: George Cherian <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: php-windows@lists.php.net <php-windows@lists.php.net>
Sent: Sun, 5 Mar 2006 19:58:32 +0530
Subject: [PHP-WIN] Re: Fsockopen with ssl takes 8.4 seconds to return on Windows

 On Sun, Mar 05, 2006 at 06:45:12AM -0500, [EMAIL PROTECTED] 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");
}

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to