Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, I am working on an optimization algorithm for processing parallel jobs for a school project and am wondering if its possible to get the total time required by ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    4

    How to determine CPU time required by processes


    Hi All,
    I am working on an optimization algorithm for processing parallel jobs for a school project and am wondering if its possible to get the total time required by each process in the scheduling cycle so that I can adjust the time quantum (reduce interactive processes time quantum) to speedup the parallel processes.

    Thanks

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,695
    You can use the time command to start a process, which when the process finishes will output the amount of system, user, and elapsed time used by the process. Usually there is a built-in shell time command, but there is also an executable version with some more features, /usr/bin/time.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jan 2010
    Posts
    4
    The time command gives the time output after the process has executed, is there a way to get the amount of time the process needs to execute before the process is actually executed? Are processes aware of their time quantum needs? The algorithm needs to know the time requirements of the process so that it can optimize the scheduling based on this information. See my original post.

    Thanks

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,695
    Quote Originally Posted by colinragoo View Post
    The time command gives the time output after the process has executed, is there a way to get the amount of time the process needs to execute before the process is actually executed? Are processes aware of their time quantum needs? The algorithm needs to know the time requirements of the process so that it can optimize the scheduling based on this information. See my original post.

    Thanks
    The time command(s) won't analyze a program to determine how much time is required to run its various functions. After all, determining all the possible execution paths through a non-trivial program, especially a server-type program, may be an np-hard type of problem in that the number of possible execution paths can be indeterminate.

    That said, there are profiling tools available that can look at executing processes and help determine time requirements as the process runs. Some are open-source (the gnu profiler that comes with the gcc compiler suite, for example) and others are commercial (such as Quantify from IBM-Rational Software). When I need to do real performance analysis for complex system software, I prefer tools such as Quantify that utilize object-code insertion techniques to get absolute performance metrics for analysis, vs. compiled-in time-slice techniques used by most open-source tools and traditional profilers.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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