See also "man clock_gettime" for CLOCK_PROCESS_CPUTIME_ID or CLOCK_THREAD_CPUTIME_ID, which would need to be called by the process or thread itself.
On Wednesday, June 27, 2012 1:32:16 AM UTC-7, kanishka wrote: > > I looked in to the /proc/<pid>/stat and it gives some use full information > about the process. There are many time variables and what should I use to > calculate the CPU time? > > Also is there a way to measure if the CPU time slice has increased or the > frequency of getting the CPU has in creased after a renice? > > here is an output of /proc/<pid>/stat, > > # ./procstat 1142 > pid: 1142 > tcomm: (com.test.noise3) > state: S > ppid: 37 > pgid: 37 > sid: 0 > tty_nr: 0 > tty_pgrp: -1 > flags: 4194624 > min_flt: 6040 > cmin_flt: 0 > maj_flt: 0 > cmaj_flt: 0 > utime: 11.590000 > stime: 7.790000 > cutime: 0.000000 > cstime: 0.000000 > priority: 20 > nice: 0 > num_threads: 8 > it_real_value: 0.000000 > start_time: 06.25 15:24 (2698.61s) > vsize: 137080832 > rss: 5090 > rsslim: 4294967295 > start_code: 32768 > end_code: 36524 > start_stack: 3199794400 > esp: 3199793352 > eip: 2949704456 > pending: 0000000000000000 > blocked: 0000000000001204 > sigign: 0000000000000000 > sigcatch: 00000000000094e8 > wchan: 4294967295 > zero1: 0 > zero2: 0 > exit_signal: 0000000000000011 > cpu: 0 > rt_priority: 0 > policy: 0 > # > > can any body give some ideas? > > On Tue, Jun 26, 2012 at 8:20 AM, kanishka <kanishka...@gmail.com> wrote: > >> Hi all, >> >> I want to measure if there is any increase in CPU usage by a process >> after issuing the renice command. top gives CPU usage as a percentage, is >> there a way to measure the time a process spent on the CPU in mili/nano >> seconds? >> >> What are the other possible ways of achieving this? >> >> Kanishka >> >> -- >> unsubscribe: android-kernel+unsubscr...@googlegroups.com >> website: http://groups.google.com/group/android-kernel > > > -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel