return proc_calc_metrics(page, start, off, count, eof, len);
}
+static int loadavg_not_uninterruptible_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int a, b, c;
+ int len;
+
+ a = avenrun_not_uninterruptible[0] + (FIXED_1/200);
+ b = avenrun_not_uninterruptible[1] + (FIXED_1/200);
+ c = avenrun_not_uninterruptible[2] + (FIXED_1/200);
+ len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d (not uninterruptible)\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);
+}
+
static int uptime_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int (*read_proc)(char*,char**,off_t,int,int*,void*);
} *p, simple_ones[] = {
{"loadavg", loadavg_read_proc},
+ {"loadavg_not_uninterruptible", loadavg_not_uninterruptible_read_proc},
{"uptime", uptime_read_proc},
{"meminfo", meminfo_read_proc},
{"version", version_read_proc},
return nr_active() * FIXED_1;
}
+/*
+ * Nr of running (not uninterruptible) tasks - counted in fixed-point numbers
+ */
+static unsigned long count_running_tasks(void)
+{
+ return nr_running() * FIXED_1;
+}
+
/*
* Hmm.. Changed this, as the GNU make sources (load.c) seems to
* imply that avenrun[] is the standard name for this kind of thing.
EXPORT_SYMBOL(avenrun);
+unsigned long avenrun_not_uninterruptible[3];
+
+EXPORT_SYMBOL(avenrun_not_uninterruptible);
+
/*
* calc_load - given tick count, update the avenrun load estimates.
* This is called while holding a write_lock on xtime_lock.
static inline void calc_load(unsigned long ticks)
{
unsigned long active_tasks; /* fixed-point */
+ unsigned long running_tasks; /* fixed-point */
static int count = LOAD_FREQ;
count -= ticks;
CALC_LOAD(avenrun[0], EXP_1, active_tasks);
CALC_LOAD(avenrun[1], EXP_5, active_tasks);
CALC_LOAD(avenrun[2], EXP_15, active_tasks);
+ /* Normal loadavg minus uninterruptible */
+ running_tasks = count_running_tasks();
+ CALC_LOAD(avenrun_not_uninterruptible[0], EXP_1, running_tasks);
+ CALC_LOAD(avenrun_not_uninterruptible[1], EXP_5, running_tasks);
+ CALC_LOAD(avenrun_not_uninterruptible[2], EXP_15, running_tasks);
}
}