1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check proxy reply time

Discussion in 'PHP & Perl' started by kylemaes, Aug 3, 2012.

  1. kylemaes

    kylemaes Newbie

    Joined:
    Jul 30, 2012
    Messages:
    7
    Likes Received:
    0
    Hi BHW! I was wondering if it was possible to check proxys reply time from google? I have nothing nor can I find anything. I know all the functions that connect to websites through proxys and such and I am using them as I type this. But none of the functions return the time it took to execute the function or what not... Any ideas? Thanks.
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,155
  3. kylemaes

    kylemaes Newbie

    Joined:
    Jul 30, 2012
    Messages:
    7
    Likes Received:
    0
    Yes, I've seen that. I was wondering how big is the instruction execution time I want a pretty precise measurement. Is this +-10 output?
     
  4. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    If you take the time to read the link he posted, you'd see its down to microseconds. So yes, it is accurate within 10 seconds.
     
    • Thanks Thanks x 1
  5. kylemaes

    kylemaes Newbie

    Joined:
    Jul 30, 2012
    Messages:
    7
    Likes Received:
    0
    That is not what I meant,

    I meant that it has a +-10ms, but I am wondering because the execution time to find the time and to start contacting the proxy server and such will probably take more than 10 ms...
     
  6. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    1000 microseconds = 1 millisecond

    The timer can be started anytime and can be used anywhere. You can time the entire script, individual functions, class response etc.
    Code:
    <?php
    foreach ($proxies as $proxy) {
        $start = microtime(true);
        /* Code to connect and valdiate.  Whatever you want to time */
        $end = microtime(true);
        $total_time = $end - $start;
    }
    ?>
    
     
  7. kylemaes

    kylemaes Newbie

    Joined:
    Jul 30, 2012
    Messages:
    7
    Likes Received:
    0
    I'm sorry. I think we are having a communication problem :(

    I know exactly how the microtime works and such.
    But im wondering the time to transfer the variable returned to another variable would come up into the timer because I have to take the data from the function after mutiple times.. It is ok I'll run some tests to get it accurate to the millisecond... Thankyou guys :D

    You might not do microcontrollers and hardware design. I do that kind of thing and am just learning this for my website. But I refer to instuructions of cycles constantly because when working with microcontrollers and serial/parrallel interfacing you have to get the most precise timing you can do reduce error and increase speed...
     
    Last edited: Aug 3, 2012
  8. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    Yeah, communication does seem to be a problem lol

    There can be some inherent delay when recording the values. So in my example, the execution time would be off due to the microtime start and stops along with their assigning values. Fixing or reducing the margin of error would likely need to be done as a PHP C Module where you have more flexibility and low level access. Anything that would try and fix it in PHP would probably be off due to the same memory time.

    and sorry about being kind of hostile earlier, people ask the same thing over and over and never read. Wasn't aware you needed precision to such a point, or that you already knew what microtime was.
     
    • Thanks Thanks x 1
    Last edited: Aug 3, 2012
  9. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,155
    You could also use XDebug as well and compare results. But as Zapdos said, since you want to measure ms and not microsec, I don't see the problem. The overhead of trivial variable manipulation should not affect your results in the ms range.
     
    • Thanks Thanks x 1
  10. kylemaes

    kylemaes Newbie

    Joined:
    Jul 30, 2012
    Messages:
    7
    Likes Received:
    0
    Thankyou guys for everything.

    Zapdos, I understand, it's ok :p