Program Running Time

Discussion in 'C++' started by cplusplusquestion@gmail.com, Jan 15, 2008.

  1. Guest

    # time ./a.out test.data

    the output:

    real 0m49.172s
    user 0m5.638s
    sys 0m4.850s

    Why real time and user time have big difference? I've tried to change
    a code: for example disable print() function, the real time and user
    time closer. How to improve the real time in a program?
    , Jan 15, 2008
    #1
    1. Advertising

  2. Jerry Coffin Guest

    In article <f7db0716-0e06-4caa-95fc-284130408b44
    @l32g2000hse.googlegroups.com>, says...
    > # time ./a.out test.data
    >
    > the output:
    >
    > real 0m49.172s
    > user 0m5.638s
    > sys 0m4.850s
    >
    > Why real time and user time have big difference? I've tried to change
    > a code: for example disable print() function, the real time and user
    > time closer. How to improve the real time in a program?


    This basically means your program is I/O bound. Without knowing more
    about how that's occurring it's impossible to suggest improvements.
    Sometimes, it's just the nature of that particular program (e.g. cat
    will almost always be heavily I/O bound).

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
    Jerry Coffin, Jan 15, 2008
    #2
    1. Advertising

  3. Guest

    On Jan 14, 6:18 pm, wrote:
    > # time ./a.out test.data
    >
    > the output:
    >
    > real 0m49.172s
    > user 0m5.638s
    > sys 0m4.850s
    >
    > Why real time and user time have big difference? I've tried to change
    > a code: for example disable print() function, the real time and user
    > time closer. How to improve the real time in a program?


    http://www.google.com/search?hl=en&q=how to optimize c++ code&btnG=Google Search

    The first result would probably be a good place to start.

    I wouldn't do anything without a profiler though.
    , Jan 15, 2008
    #3
  4. Guest

    On Jan 15, 1:44 pm, wrote:
    > On Jan 14, 6:18 pm, wrote:
    >
    > > # time ./a.out test.data

    >
    > > the output:

    >
    > > real 0m49.172s
    > > user 0m5.638s
    > > sys 0m4.850s

    >
    > > Why real time and user time have big difference? I've tried to change
    > > a code: for example disable print() function, the real time and user
    > > time closer. How to improve the real time in a program?

    >
    > http://www.google.com/search?hl=en&q=how to optimize c++ code&btn...
    >
    > The first result would probably be a good place to start.
    >
    > I wouldn't do anything without a profiler though.


    Thanks. It's really helpful.
    , Jan 15, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. flamesrock
    Replies:
    8
    Views:
    449
    Hendrik van Rooyen
    Nov 24, 2006
  2. Replies:
    1
    Views:
    468
    Walter Roberson
    Aug 12, 2005
  3. Lorenzo Bettini
    Replies:
    3
    Views:
    617
    Lorenzo Bettini
    Sep 24, 2005
  4. Alexander Mahone

    Running a program (gperf) inside another C program

    Alexander Mahone, May 26, 2008, in forum: C Programming
    Replies:
    4
    Views:
    404
    Flash Gordon
    May 26, 2008
  5. Shadow123
    Replies:
    1
    Views:
    400
    Shadow123
    Jul 9, 2008
Loading...

Share This Page