SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 37 of 37
  1. #26
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lemon Juice View Post
    I was asking because this problem seems to exist only on Windows systems, so if you are running linux then I suppose any php version will work well for microtime
    Ah, somehow missed that. I'll have a few tests shortly from a Windows 64 bit machine soon.
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  2. #27
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Windows 64 bit PHP 5.4.7 (I know, I'll upgrade it here shortly ), Apache 2.4.3
    Code:
    First Post Duration: 0.0030810832977295
    First Post Duration: 0.002979040145874
    First Post Duration: 0.0030350685119629
    First Post Duration: 0.0029799938201904
    First Post Duration: 0.0029809474945068
    First Post Duration: 0.0030879974365234
    First Post Duration: 0.0029699802398682
    First Post Duration: 0.0030460357666016
    First Post Duration: 0.0030150413513184
    First Post Duration: 0.0029900074005127
    Second Post Duration: 0.003035
    Second Post Duration: 0.002988
    Second Post Duration: 0.002987
    Second Post Duration: 0.003074
    Second Post Duration: 0.002072
    Second Post Duration: 0.001888
    Second Post Duration: 0.001881
    Second Post Duration: 0.001914
    Second Post Duration: 0.001915
    Second Post Duration: 0.001895
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #28
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Windows 5.4.22, 32 bit process (it seems), Apache 2.4.7

    Code:
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.002000093460083
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    Second Post Duration: 0.000000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.000000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  4. #29
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    PHP 5.4.22 directly on a 64 bit machine:
    Code:
    First Post Duration: 0
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0
    First Post Duration: 0
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010008811950684
    Second Post Duration: 0.001000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.000000
    Second Post Duration: 0.002000
    Second Post Duration: 0.001000
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  5. #30
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thanks. It seems the problem happens on all newer php versions on windows regardless of "bitness".

  6. #31
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lemon Juice View Post
    Thanks. It seems the problem happens on all newer php versions on windows regardless of "bitness".
    Yeah, I'm going to run it against 5.5 once I get that setup too (just so you can see those results too).
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  7. #32
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Windows (32 bit process through apache) PHP 5.5.6, Apache 2.4.7
    Code:
    First Post Duration: 0.0010001659393311
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.002000093460083
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0.00099992752075195
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.000000
    Second Post Duration: 0.002000
    Second Post Duration: 0.001000
    Second Post Duration: 0.000000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.000000
    PHP directly (should be a 64 bit process)
    Code:
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0
    First Post Duration: 0
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.0010001659393311
    First Post Duration: 0.00099992752075195
    First Post Duration: 0.00099992752075195
    First Post Duration: 0
    Second Post Duration: 0.000000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Second Post Duration: 0.001000
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  8. #33
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thanks, it's all clear now. I wonder if it's possible to grab the system time in windows directly through an exec() call. I've just read a few discussions about this and it turns out Windows natively supports 1/64s time resolution and the same problem exists in other languages. To be able to get a finer accuracy one needs to use an additional timer library. From what I understand PHP used to have code that emulated the more accurate timer on Windows but the problem was it sometimes got very inaccurate so they had to stop using it. It looks like there's little hope, then.

  9. #34
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lemon Juice View Post
    Thanks, it's all clear now. I wonder if it's possible to grab the system time in windows directly through an exec() call. I've just read a few discussions about this and it turns out Windows natively supports 1/64s time resolution and the same problem exists in other languages. To be able to get a finer accuracy one needs to use an additional timer library. From what I understand PHP used to have code that emulated the more accurate timer on Windows but the problem was it sometimes got very inaccurate so they had to stop using it. It looks like there's little hope, then.
    yikes! Guess that's another reason to run PHP on Linux j/k, don't want to start that flame war.

    What if you wrote a small .NET application to get the ticks? I know .NET handles the task fine, and you could probably make it a service that is callable from PHP. However, you'll have the communication to the application within your duration time (that is the downside).
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  10. #35
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    yikes! Guess that's another reason to run PHP on Linux j/k, don't want to start that flame war.
    Why a flame war? I think most people will agree that Linux is better for running PHP and the like . I just prefer Windows as my development OS and additionally I have the benefit that my code is tested on both platforms.

    Quote Originally Posted by cpradio View Post
    What if you wrote a small .NET application to get the ticks? I know .NET handles the task fine, and you could probably make it a service that is callable from PHP. However, you'll have the communication to the application within your duration time (that is the downside).
    Unfortunately, I don't know .NET. Anyway, this might be too much hassle - if I have the need I may simply upload the script to a linux server and test it there .

  11. #36
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    A desktop version of .NET would simply consist of the following:

    You'd have a UI field to input/select your PHP file you want executed and a label to write the milliseconds to. Then your code would be close to (I may have made a few typos since I'm at home right now)
    Code .NET:
    var phpFile = txtPHPFile.Text;
    var timer = new System.Diagnostics.StopWatch();
    var phpScriptProcess = new System.Diagnostics.Process();
    phpScriptProcess.StartInfo.FileName = "<path to php executable>"; 
    phpScriptProcess.StartInfo.Arguments = phpFile;
    phpScriptProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; // Set to Hidden or None if you don't care to see the output it produces
     
    // Start the Timer
    timer.Start();
     
    // Execute your PHP script
    phpScriptProcess.Start();
    phpScriptProcess.WaitForExit();// Waits here for the process to exit.
     
    // End the Timer
    timer.Stop();
     
    // Output the time in milliseconds
    lblTimeTaken.Text = timer.ElapsedMilliseconds;

    Very small, very easy Of course, that one executes it for you and requires you to manually key that data in. You can also make a service that accepts a PHP Script File Path, and returns the milliseconds taken (you just create a Web Service project instead of a Windows Form project -- same code applies; adjust how you read the php file and change the lblTimeTaken to a return statement).

    I know I've used this technique (not with PHP execution, but with other timing performances within .NET and their related processes) and it worked just fine for me.
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  12. #37
    SitePoint Guru bronze trophy
    Join Date
    Dec 2003
    Location
    Poland
    Posts
    930
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thanks, cpradio, I may try it once I have more spare time


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •