Re: division and cpu usage

2007-08-28 Thread Jan Engelhardt
On Aug 28 2007 12:41, Luka Napotnik wrote: > >How about this: >=== >old_stime = task->stime; >old_utime = task->utime >old_j = jiffies; > >set_current_state(TASK_INTERRUPTIBLE); >schedule_timeout(1 * HZ); > >new_stime = task->stime; >new_utime = task->utime; >new_j =

Re: division and cpu usage

2007-08-28 Thread Luka Napotnik
How about this: === old_stime = task->stime; old_utime = task->utime old_j = jiffies; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1 * HZ); new_stime = task->stime; new_utime = task->utime; new_j = jiffies; sum = ((new_stime - old_stime) + (new_utime -

Re: division and cpu usage

2007-08-28 Thread Jan Engelhardt
On Aug 28 2007 00:07, Luka Napotnik wrote: 2. I'm trying to get the percentage of CPU used for a certain task_struct and figured the following formula: (task->utime + task->stime) / jiffies > >This formula just doesn't work. I have a task with 99% CPU (top) but the >result of

Re: division and cpu usage

2007-08-28 Thread Jan Engelhardt
On Aug 28 2007 00:07, Luka Napotnik wrote: 2. I'm trying to get the percentage of CPU used for a certain task_struct and figured the following formula: (task-utime + task-stime) / jiffies This formula just doesn't work. I have a task with 99% CPU (top) but the result of that formula is

Re: division and cpu usage

2007-08-28 Thread Luka Napotnik
How about this: === old_stime = task-stime; old_utime = task-utime old_j = jiffies; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1 * HZ); new_stime = task-stime; new_utime = task-utime; new_j = jiffies; sum = ((new_stime - old_stime) + (new_utime -

Re: division and cpu usage

2007-08-28 Thread Jan Engelhardt
On Aug 28 2007 12:41, Luka Napotnik wrote: How about this: === old_stime = task-stime; old_utime = task-utime old_j = jiffies; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1 * HZ); new_stime = task-stime; new_utime = task-utime; new_j = jiffies; sum =

Re: division and cpu usage

2007-08-27 Thread Luka Napotnik
Jan Engelhardt pravi: > On Aug 24 2007 07:34, linux-os (Dick Johnson) wrote: >>> I'm new to kernel development and have some questions. >>> >>> 1. Why can't I divide with regular casting to double ((double)a / >>> (double)b)? It gives me strange errors when compiling: >>> >>> WARNING: "__divdf3"

Re: division and cpu usage

2007-08-27 Thread Luka Napotnik
Jan Engelhardt pravi: On Aug 24 2007 07:34, linux-os (Dick Johnson) wrote: I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: __divdf3 [/root] undefined!

Re: division and cpu usage

2007-08-25 Thread Luka Napotnik
Hello again. I have the following code: clock_t c_sum, j, p; cputime_t j_tmp; ... c_sum = cputime64_to_clock_t(task->utime) + cputime64_to_clock_t(task->stime); cur_j = jiffies; j_tmp = jiffies64_to_cputime64(cur_j); j = cputime64_to_clock_t(j_tmp); p =

Re: division and cpu usage

2007-08-25 Thread Luka Napotnik
Hello again. I have the following code: clock_t c_sum, j, p; cputime_t j_tmp; ... c_sum = cputime64_to_clock_t(task-utime) + cputime64_to_clock_t(task-stime); cur_j = jiffies; j_tmp = jiffies64_to_cputime64(cur_j); j = cputime64_to_clock_t(j_tmp); p =

Re: division and cpu usage

2007-08-24 Thread Jan Engelhardt
On Aug 24 2007 07:34, linux-os (Dick Johnson) wrote: >> I'm new to kernel development and have some questions. >> >> 1. Why can't I divide with regular casting to double ((double)a / >> (double)b)? It gives me strange errors when compiling: >> >> WARNING: "__divdf3" [/root] undefined! >>

Re: division and cpu usage

2007-08-24 Thread linux-os \(Dick Johnson\)
On Thu, 23 Aug 2007, Luka Napotnik wrote: > Hello. > > I'm new to kernel development and have some questions. > > 1. Why can't I divide with regular casting to double ((double)a / > (double)b)? It gives me strange errors when compiling: > > WARNING: "__divdf3" [/root] undefined! > WARNING:

Re: division and cpu usage

2007-08-24 Thread linux-os \(Dick Johnson\)
On Thu, 23 Aug 2007, Luka Napotnik wrote: Hello. I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: __divdf3 [/root] undefined! WARNING: __addf3

Re: division and cpu usage

2007-08-24 Thread Jan Engelhardt
On Aug 24 2007 07:34, linux-os (Dick Johnson) wrote: I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: __divdf3 [/root] undefined! WARNING: __addf3

RE: division and cpu usage

2007-08-23 Thread David Schwartz
> Hello. > > I'm new to kernel development and have some questions. > > 1. Why can't I divide with regular casting to double ((double)a / > (double)b)? It gives me strange errors when compiling: > > WARNING: "__divdf3" [/root] undefined! > WARNING: "__addf3" [/root/...] undefined! > WARNING:

division and cpu usage

2007-08-23 Thread Luka Napotnik
Hello. I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: "__divdf3" [/root] undefined! WARNING: "__addf3" [/root/...] undefined! WARNING: "__floatsidf"

division and cpu usage

2007-08-23 Thread Luka Napotnik
Hello. I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: __divdf3 [/root] undefined! WARNING: __addf3 [/root/...] undefined! WARNING: __floatsidf

RE: division and cpu usage

2007-08-23 Thread David Schwartz
Hello. I'm new to kernel development and have some questions. 1. Why can't I divide with regular casting to double ((double)a / (double)b)? It gives me strange errors when compiling: WARNING: __divdf3 [/root] undefined! WARNING: __addf3 [/root/...] undefined! WARNING: __floatsidf