![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 11:22 PM |
| about child process | compbug | UNIX for Dummies Questions & Answers | 12 | 03-22-2006 07:55 PM |
| gdb to child process | shriashishpatil | UNIX for Advanced & Expert Users | 4 | 12-12-2005 07:57 AM |
| KDM child process | larryase | UNIX for Dummies Questions & Answers | 6 | 01-24-2005 05:41 PM |
| Child Process PID | skannan | High Level Programming | 2 | 06-10-2002 07:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Time taken by a child process?
Hi,
I have a program where I fork few child jobs and call execvp to run another jobs. I use wait to wait for any job to get complete. Requirement is I need to know the actual time taken by child job during execution. I thought of calculating the time just before forking and after wait, but this does not gives me the actual results. I get a difference of few milliseconds using my approach. |
|
||||
|
Code:
#include <sys/times.h>
clock_t times(struct tms *buffer);
Where struct tms is:
struct tms {
clock_t tms_utime; /* user time */
clock_t tms_stime; /* system time */"
clock_t tms_cutime; /* user time, children */
clock_t tms_cstime; /* system time, children */
};
|
|
||||
|
How could you say there is difference?
Hi...
First read time stamp just before spawning the child process. and read the time stamp in the child process(not in parent before wait or some other places), Calculate the difference(I hope you can do it simply)... One thing... How can you say... you are getting different results? (There will be difference between different runnings of the program. It is dependant on the current system image... like load on system, physical memory available on the system at that time, VM present at that time etc.) I hope you understood what is happening and what to do... ![]() Happy programming... Chandu. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|