change time interval for /proc/loadavg calculation

Hi friends, I need to find average load on my server. The problem would have been quite simple had I required the load averaged over 1 min,5 min or 15 min which I can easily find reading /proc/loadavg (the same as shown by 'uptime') but my requirement compels me to find load averaged over 10 sec or 20 sec.

I went through the linux source code (esp. linux/include/linux/sched.h, linux/fs/proc/proc_misc.c, linux/kernel/timer.c) these gave me an idea that may be changing EXP_1, EXP_5, EXP_15 might help my case but I want to be sure if I'm thinking is right also I want to be careful that I don't effect other things.
Thanks for any help.

Hi!

As I understand you works under Linux, am I right?
If so, as you can see EXP_1, for example, is 1/e(5/60)*FIXED_1, where 60 is a one munute and 5 AFAIK is a frequency of calculation.

So I think you need 1/e(5/20)*FIXED_1 for a load averaged over 20 seonds.

A rather simple calculation :slight_smile: that I too arrived at. But my problem was that whether it would otherthings (since this file is included in many files like timer.c I thought it might affect scheduling etc. and that might create problem).
But now I've tested it out everthing seems normal (doesn't make my system go awry).

Still thanks fro ur help