Changeset 79edc36 in mainline for kernel/generic/src/ps/load.c


Ignore:
Timestamp:
2010-04-01T15:21:03Z (15 years ago)
Author:
Stanislav Kozina <stanislav.kozina@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
62550dce
Parents:
83a957a
Message:

System load echo fix, now it looks realistic
top echoes first values (uptime)
Several ps and uptime fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ps/load.c

    r83a957a r79edc36  
    4747static size_t get_running_count(void);
    4848
    49 size_t avenrun[3];
     49unsigned long avenrun[3];
    5050
    5151#define FSHIFT   11             /* nr of bits of precision */
     
    5656#define EXP_15 2037             /* 1/exp(5sec/15min) */
    5757
    58 #define CALC_LOAD(load,exp,n) \
    59         load *= exp; \
    60         load += n*(FIXED_1-exp); \
    61         load >>= FSHIFT;
     58void get_avenrun(unsigned long *loads, int shift)
     59{
     60        loads[0] = avenrun[0] << shift;
     61        loads[1] = avenrun[1] << shift;
     62        loads[2] = avenrun[2] << shift;
     63}
    6264
    63 static inline unsigned long calc_load(size_t load, size_t exp, size_t active)
     65static inline unsigned long calc_load(unsigned long load, size_t exp, size_t active)
    6466{
    6567        load *= exp;
     
    120122}
    121123
    122 int sys_ps_get_load(size_t *user_load)
     124int sys_ps_get_load(unsigned long *user_load)
    123125{
    124         copy_to_uspace(user_load, avenrun, sizeof(avenrun));
     126        unsigned long loads[3];
     127        get_avenrun(loads, 5);
     128        copy_to_uspace(user_load, loads, sizeof(loads));
    125129        return 0;
    126130}
Note: See TracChangeset for help on using the changeset viewer.