According to this article http://kerneltrap.org/node/11773 it says ' each
level of nice adds or substracts 10% of CPU utilization, "*the '10% effect'
is relative and cumulative: from _any_ nice level, if you go up 1 level,
it's -10% CPU usage, if you go down 1 level it's +10% CPU usage.*" '

Is this applicable to Android kernel? since I haven't calculated the CPU
usage will it give a different result when changing the nice values?

can any body give some ideas??

On Wed, Jun 27, 2012 at 1:09 PM, Kanishka Ariyapala
<[email protected]>wrote:

> Looked in to the clock_gettime() it is not going to work as it has to be
> called inside the process, also it gives the total time taken for a
> function to complete. This will include the time other processes was using
> the CPU as well ryt?
>
> Yes my goal was to make a process consume more processor by lowering the
> nice value. Thank you for the link it explained it nicely. However I did a
> calculation using only utime(process time spent in user space) it didn't
> show any significant increase after lowering nice and worse when the
> application is in the background( by pressing the home button) utime
> difference is zero. Don't know if kernel space time is increased, but seems
> very unlikely.
>
> These are the results,
>    pid: 263
>               dutime: 8      7786       7778
>             priority: 10
>                 nice: -10
>
>                  pid: 263
>               dutime: 8      7794       7786
>             priority: 15
>                 nice: -5
>
>                  pid: 263
>               dutime: 7      7801       7794
>             priority: 15
>                 nice: -5
>
>                  pid: 263
>               dutime: 4      7805       7801
>             priority: 15
>                 nice: -5
>
>                  pid: 263
>               dutime: 9      7814       7805
>             priority: 15
>                 nice: -5
>
>                  pid: 263
>               dutime: 8      7822       7814
>             priority: 5
>                 nice: -15
>
> dutime is the difference of utimes in 5 second intervals.
>
> when it's pushed in to the background,
>
>                  pid: 263
>               dutime: 9      8264       8255
>             priority: 5
>                 nice: -15
>
>                  pid: 263
>               dutime: 0      8264       8264
>             priority: 5
>                 nice: -15
>
>                  pid: 263
>               dutime: 0      8264       8264
>             priority: 5
>                 nice: -15
>
> the difference in utime is zero..
>
> So this brings up a new question, How can I make a process consume MORE
> processor time?
>
> Any ideas?
>
>
> On Wed, Jun 27, 2012 at 2:34 AM, Alexander Ray <[email protected]> wrote:
>
>> 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
>>
>
>

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

Reply via email to