Changeset 9efff92 in mainline for kernel/generic/src/sysinfo/stats.c
- Timestamp:
- 2010-04-21T13:58:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a721f6a
- Parents:
- 369a5f8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/sysinfo/stats.c
r369a5f8 r9efff92 619 619 * 620 620 */ 621 static inline load_t load_calc(load_t load, load_t exp, size_t ready)621 static inline load_t load_calc(load_t load, load_t exp, atomic_count_t ready) 622 622 { 623 623 load *= exp; 624 load += ready* (LOAD_FIXED_1 - exp);624 load += (ready << LOAD_FIXED_SHIFT) * (LOAD_FIXED_1 - exp); 625 625 626 626 return (load >> LOAD_FIXED_SHIFT); 627 627 } 628 628 629 /** Count threads in ready queues630 *631 * Should be called with interrupts disabled.632 *633 */634 static inline size_t get_ready_count(void)635 {636 size_t i;637 size_t count = 0;638 639 for (i = 0; i < config.cpu_count; i++) {640 spinlock_lock(&cpus[i].lock);641 642 size_t j;643 for (j = 0; j < RQ_COUNT; j++) {644 spinlock_lock(&cpus[i].rq[j].lock);645 count += cpus[i].rq[j].n;646 spinlock_unlock(&cpus[i].rq[j].lock);647 }648 649 spinlock_unlock(&cpus[i].lock);650 }651 652 return count;653 }654 655 629 /** Load computation thread. 656 630 * … … 665 639 666 640 while (true) { 641 atomic_count_t ready = atomic_get(&nrdy); 642 667 643 /* Mutually exclude with get_stats_load() */ 668 644 ipl_t ipl = interrupts_disable(); 669 645 spinlock_lock(&load_lock); 670 671 size_t ready = get_ready_count() * LOAD_FIXED_1;672 646 673 647 unsigned int i;
Note:
See TracChangeset
for help on using the changeset viewer.