Finding out how long a programm takes time

Discussion in 'Mac Programming' started by Lumio, Sep 3, 2009.

  1. Lumio macrumors member

    Joined:
    May 20, 2008
    #1
    Hi,
    I'm programming a little tool for one of my clients with C++..

    ok, this question hasn't really to do with it, but anyway.
    Does anybody know, how I can test, how long it takes to proceed? All with Terminal :)
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    The 'time' command

    Result:
    >time ls
    Desktop ...
    real 0m0.008s
    user 0m0.001s
    sys 0m0.004s

    If you need input use < to direct a file prepared with the desired input to stdin to avoid human delay.

    -Lee
     
  3. Lumio thread starter macrumors member

    Joined:
    May 20, 2008
    #3
    hey thanks man :D

    //edit:
    Following result:
    Code:
    real	0m0.002s
    user	0m0.001s
    sys	0m0.002s
    does that mean: 0m0.005s?
     
  4. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    user is how much time is spent in your code (that is, running and not in the kernel on your program's behalf).
    sys is the time the kernel spend on your program's behalf.
    real is time on a wall clock spent. The others shouldn't really exceed this, but when you're dealing with thousandths of a second there might be some wiggle room.

    -Lee
     

Share This Page