Hi Radu!
On Fri, 07 Dec 2001, Radu Filip wrote:
>
>
> Salut!
>
> Imi puteti explica va rog si mie ce inseamna de faot numere de la load
> averages? Manualul nu spune nimic si pe web am gait tot manualul.
>
> Credeam ca inseamna % din icarcarea mashinii, dar ar fi absurd sa am
> incarcare de 300% petru 3.00. As dori va rog o explicatie cat mai
> detaliata tehnic ca sa inteleg exact cum sa interpretez valorilea alea.
>
> Multumesc,
> Radu
Cel mai bine ne uitam in sursele de kernel ...
[root@toko kernel-2.4.14]# pwd
/usr/src/kernel-2.4.14
[root@toko kernel-2.4.14]# vim fs/proc/proc_misc.c
/loadavg
[..]
static int loadavg_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int a, b, c;
int len;
a = avenrun[0] + (FIXED_1/200);
b = avenrun[1] + (FIXED_1/200);
c = avenrun[2] + (FIXED_1/200);
len = sprintf(page,"%d.%02d %d.%02d %d.%02d %d/%d %d\n",
LOAD_INT(a), LOAD_FRAC(a),
LOAD_INT(b), LOAD_FRAC(b),
LOAD_INT(c), LOAD_FRAC(c),
nr_running, nr_threads, last_pid);
return proc_calc_metrics(page, start, off, count, eof, len);
}
[...]
(ok, sa vedem ce`i cu ``avenrun'' asta ...)
[root@toko kernel-2.4.14]# vim kernel/timer.c
unsigned long avenrun[3];
[...]
static inline void calc_load(unsigned long ticks)
{
unsigned long active_tasks; /* fixed-point */
static int count = LOAD_FREQ;
count -= ticks;
if (count < 0) {
count += LOAD_FREQ;
active_tasks = count_active_tasks();
CALC_LOAD(avenrun[0], EXP_1, active_tasks);
CALC_LOAD(avenrun[1], EXP_5, active_tasks);
CALC_LOAD(avenrun[2], EXP_15, active_tasks);
}
}
(ok, sa ne uitam acuma dupa ``active_tasks'')
(in acelasi fisier)
/*
* Nr of active tasks - counted in fixed-point numbers
*/
static unsigned long count_active_tasks(void)
{
struct task_struct *p;
unsigned long nr = 0;
read_lock(&tasklist_lock);
for_each_task(p) {
if ((p->state == TASK_RUNNING ||
(p->state & TASK_UNINTERRUPTIBLE)))
nr += FIXED_1;
}
read_unlock(&tasklist_lock);
return nr;
}
iar in ``include/linux/sched.h'' gasim
[...]
#define CALC_LOAD(load,exp,n) \
load *= exp; \
load += n*(FIXED_1-exp); \
load >>= FSHIFT;
[...]
eh, acuma e mai clar? :)
---
Send e-mail to '[EMAIL PROTECTED]' with 'unsubscribe rlug' to
unsubscribe from this list.