The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




Thread: C:system call
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-22-2009
Dedalus Dedalus is offline
Registered User
  
 

Join Date: May 2009
Location: Italy/France
Posts: 60
C:system call

Hi

I'm studing the system call. I've written a small program that return the time spent in doing some operations. Now I'd like to write one that return the time spent in user mode of a process.
I'm reading that i should use the tms struct:


Code:
clock_t times(struct tms *buf);

 struct tms {
               clock_t tms_utime;  /* user time */
               clock_t tms_stime;  /* system time */
               clock_t tms_cutime; /* user time of children */
               clock_t tms_cstime; /* system time of children */
           };

But It's not very clear pratically. Surfing on the net I've found just hard examples.

Can anyone help with a small example that show how can i use the times function?


Thanks in advance


D.