LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2007, 09:04 AM   #1
chrislam
LQ Newbie
 
Registered: Sep 2007
Posts: 5

Rep: Reputation: 0
how to get the accumulate cpu time of a process


as my assignment is to make some special control to specific 2 process
but it need the accumulate cpu time of the processes
how to get it?
i know it is store at the struct time of the task_struct
but there are 4 variables which one is the right one?
and i have tried to print them all
cstime, cutime is 0
and stime,utime is >0
and what actual type of clock_t is?
 
Old 10-14-2007, 04:02 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
stime is system time
utime is user time

You can get the number of seconds by dividing a variable of type clock_t by CLOCKS_PER_SEC.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kacpid eating cpu 99% cpu time! tjclancy Linux - Software 13 09-19-2011 03:08 PM
diff. between elapsed time and cpu time madhugp Linux - General 1 01-15-2007 07:57 AM
How to get %CPU usage of a process romydmisc Linux - Newbie 2 05-24-2006 01:02 PM
share cpu time and reduce process load sailu_mvn Linux - Software 3 03-09-2006 06:20 PM
kjournald process consumed all CPU time tttx Linux - General 1 05-11-2005 03:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration