Learn how to a build a cloud-first strategyRegister Now


running time of the php script extracted in linux  and window batch script

Posted on 2014-08-28
Medium Priority
Last Modified: 2014-08-30
Dear Experts,

I have one php script which is running some simple testing code, and run it
as linux shell such as follows.

$ php mytesting.php

I know the code execution time is around 10 milli-second or 0.01 second , I know  I can add php function like microtime() function to get the code running time before and after.
But I just want to know how do  it in Linux script and window batch script with php mytesting.php command included ?

Please advise

Question by:rwniceing
  • 2
  • 2
LVL 38

Accepted Solution

Gerwin Jansen, EE MVE earned 2000 total points
ID: 40291340
Is it that you want to know how long the command runs under Linux? You can 'time' any command in Linux like this:

time <command>

so in your case:

time php mytesting.php

Author Comment

ID: 40291895
Yes, it work on linux  output is

real  0m1.006s
user 0m0.575s
sys   0m0.016s

What is real, user,sys stand for. user is stand for the time running  php mytesting.php
sys is stand for running time command  itself ?

What is similar command for window 7 or batch script to extract the total execution time of "php mytesting.php" ?

Please advise
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 2000 total points
ID: 40292928
You should be able to do that using powershell:

Measure-Command {php mytesting.php}

Author Closing Comment

ID: 40295113
Thanks for your reply

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question