I don't quite understand what you're trying to do here.  Is the goal to
make a process consume more processor?  If you run a process at a higher
priority, it isn't guaranteed to take more cpu time.  For example, a
heavily i/o bound process could just be woken up a bit faster after
blocking, but still consume the same processor time.

As far as calculating cpu usage of a process, this stackoverflow
question<http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux>
answers
it better than I could.

Might be able to give a better answer if you explained a bit more about
your use case.

~Alex


On Wed, Jun 27, 2012 at 1:32 AM, Kanishka Ariyapala
<[email protected]>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 <[email protected]> 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: [email protected]
>> website: http://groups.google.com/group/android-kernel
>
>
>  --
> unsubscribe: [email protected]
> website: http://groups.google.com/group/android-kernel
>

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel

Reply via email to