197Views4Replies

Author Options:

How could i measure the time in linux from when i start a process and the process ends in a program? Answered

I am running a program called povmosix which uses povray and i need to be able to measure the time as acurately as possible from when i start a process to when the process finishes. I Know how to use the time command in terminal but this doesn't use terminal because it is a program. any help would be appreciated.

Discussions

0
None
mh76dk

6 years ago

You can still use 'time', you just need to find out what the program is called (the executable that starts the program) there is no such thing as a program you cant start from the commandline (it may however die if it can not find a X display, but that is irrelevant here) so, read the properties of the menuitem you use to start the program, then open up a terminal in your window-environment of choice and run the command with 'time'

0
None
danielemurmh76dk

Answer 6 years ago

I can open it up in terminal but it records the time i have the window open, not the time it takes to run the process inside the program. the program remains open after the process finishes and so the timing isn't of how long the process took.

0
None
mh76dkdanielemur

Answer 6 years ago

Ah, I misunderstood you. I thought you meant it was a program in the menu, not a job run/handled within the program itself.

I am sorry to say I dont have any good ideas then.

0
None
kelseymh

6 years ago

Are you writing source code, or running from the command line?

If you're just launching the executable, then time is what you have available, unless you install a proper profiling utility (like valgrind).

If you are modifying the source code, then you could look at the clock system function (in <time.h>). Read the man page for more information.