php-windows Digest 6 Mar 2006 10:35:55 -0000 Issue 2905

Topics (messages 26743 through 26744):

Re: Fsockopen with ssl takes 8.4 seconds to return on Windows
        26743 by: George Cherian
        26744 by: trystano.aol.com

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
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");
}

--- End Message ---
--- Begin Message ---
Thats useful.

Thanks for the nice function! :)

Tryst

-----Original Message-----
From: George Cherian <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [email protected] <[email protected]>
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



--- End Message ---

Reply via email to