Re: Fsockopen with ssl takes 8.4 seconds to return on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 05, 2006 at 06:45:12AM -0500, trystano@xxxxxxx 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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux