Changes in / [5387807:3193c05] in mainline


Ignore:
Files:
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/include/interrupt.h

    r5387807 r3193c05  
    4848extern void start_decrementer(void);
    4949extern void interrupt_init(void);
    50 extern void extint_handler(unsigned int, istate_t *);
     50extern void extint_handler(int, istate_t *);
    5151
    5252#endif
  • kernel/arch/ppc32/include/mm/tlb.h

    r5387807 r3193c05  
    7676
    7777extern void pht_init(void);
    78 extern void pht_refill(unsigned int, istate_t *);
     78extern void pht_refill(int, istate_t *);
    7979
    80 extern bool pht_refill_real(unsigned int, istate_t *)
     80extern bool pht_refill_real(int, istate_t *)
    8181    __attribute__ ((section("K_UNMAPPED_TEXT_START")));
    82 extern void tlb_refill_real(unsigned int, uint32_t, ptehi_t, ptelo_t,
    83     istate_t *) __attribute__ ((section("K_UNMAPPED_TEXT_START")));
     82extern void tlb_refill_real(int, uint32_t, ptehi_t, ptelo_t, istate_t *)
     83    __attribute__ ((section("K_UNMAPPED_TEXT_START")));
    8484
    8585#endif
  • kernel/arch/ppc32/src/interrupt.c

    r5387807 r3193c05  
    5555 *
    5656 */
    57 static void exception_external(unsigned int n, istate_t *istate)
     57static void exception_external(int n, istate_t *istate)
    5858{
    5959        uint8_t inum;
     
    9292}
    9393
    94 static void exception_decrementer(unsigned int n, istate_t *istate)
     94static void exception_decrementer(int n, istate_t *istate)
    9595{
    9696        start_decrementer();
  • kernel/arch/ppc32/src/mm/tlb.c

    r5387807 r3193c05  
    209209 *
    210210 */
    211 void pht_refill(unsigned int n, istate_t *istate)
     211void pht_refill(int n, istate_t *istate)
    212212{
    213213        as_t *as = (AS == NULL) ? AS_KERNEL : AS;
     
    260260 *
    261261 */
    262 bool pht_refill_real(unsigned int n, istate_t *istate)
     262bool pht_refill_real(int n, istate_t *istate)
    263263{
    264264        uintptr_t badvaddr;
     
    366366 *
    367367 */
    368 void tlb_refill_real(unsigned int n, uint32_t tlbmiss, ptehi_t ptehi,
    369     ptelo_t ptelo, istate_t *istate)
     368void tlb_refill_real(int n, uint32_t tlbmiss, ptehi_t ptehi, ptelo_t ptelo, istate_t *istate)
    370369{
    371370        uint32_t badvaddr = tlbmiss & 0xfffffffc;
  • kernel/arch/sparc64/include/drivers/tick.h

    r5387807 r3193c05  
    2727 */
    2828
    29 /** @addtogroup sparc64
     29/** @addtogroup sparc64 
    3030 * @{
    3131 */
     
    4040
    4141/* mask of the "counter" field of the Tick register */
    42 #define TICK_COUNTER_MASK  (~(1l << 63))
     42#define TICK_COUNTER_MASK       (~(1l << 63))
    4343
    4444extern void tick_init(void);
    45 extern void tick_interrupt(unsigned int, istate_t *);
     45extern void tick_interrupt(int n, istate_t *istate);
    4646
    4747/**
  • kernel/arch/sparc64/src/drivers/tick.c

    r5387807 r3193c05  
    2727 */
    2828
    29 /** @addtogroup sparc64
     29/** @addtogroup sparc64 
    3030 * @{
    3131 */
     
    7777/** Process tick interrupt.
    7878 *
    79  * @param n      Interrupt Level (14, can be ignored)
     79 * @param n Interrupt Level, 14,  (can be ignored)
    8080 * @param istate Interrupted state.
    81  *
    8281 */
    83 void tick_interrupt(unsigned int n, istate_t *istate)
     82void tick_interrupt(int n, istate_t *istate)
    8483{
    8584        softint_reg_t softint, clear;
  • kernel/generic/include/cpu.h

    r5387807 r3193c05  
    7272        size_t missed_clock_ticks;
    7373       
    74         /**
    75          * Processor cycle accounting.
    76          */
    7774        bool idle;
    78         uint64_t last_cycle;
    79         uint64_t idle_cycles;
    80         uint64_t busy_cycles;
     75        uint64_t idle_ticks;
     76        uint64_t busy_ticks;
    8177       
    8278        /**
  • kernel/generic/include/sysinfo/abi.h

    r5387807 r3193c05  
    6969        bool active;             /**< CPU is activate */
    7070        uint16_t frequency_mhz;  /**< Frequency in MHz */
    71         uint64_t idle_cycles;    /**< Number of idle cycles */
    72         uint64_t busy_cycles;    /**< Number of busy cycles */
     71        uint64_t idle_ticks;     /**< Number of idle kernel quanta */
     72        uint64_t busy_ticks;     /**< Number of busy kernel quanta */
    7373} stats_cpu_t;
    7474
  • kernel/generic/src/cpu/cpu.c

    r5387807 r3193c05  
    4949#include <print.h>
    5050#include <sysinfo/sysinfo.h>
    51 #include <arch/cycle.h>
    5251
    5352cpu_t *cpus;
     
    9594        CPU->tlb_active = true;
    9695       
    97         CPU->idle = false;
    98         CPU->last_cycle = get_cycle();
    99         CPU->idle_cycles = 0;
    100         CPU->busy_cycles = 0;
    101        
    10296        cpu_identify();
    10397        cpu_arch_init();
  • kernel/generic/src/interrupt/interrupt.c

    r5387807 r3193c05  
    9999void exc_dispatch(unsigned int n, istate_t *istate)
    100100{
    101         ASSERT(CPU);
    102        
    103101#if (IVT_ITEMS > 0)
    104102        ASSERT(n < IVT_ITEMS);
     
    111109                irq_spinlock_unlock(&THREAD->lock, false);
    112110        }
    113        
    114         /* Account CPU usage if it has waked up from sleep */
    115         irq_spinlock_lock(&CPU->lock, false);
    116         if (CPU->idle) {
    117                 uint64_t now = get_cycle();
    118                 CPU->idle_cycles += now - CPU->last_cycle;
    119                 CPU->last_cycle = now;
    120                 CPU->idle = false;
    121         }
    122         irq_spinlock_unlock(&CPU->lock, false);
    123111       
    124112        uint64_t begin_cycle = get_cycle();
  • kernel/generic/src/main/kinit.c

    r5387807 r3193c05  
    181181                if (init.tasks[i].addr % FRAME_SIZE) {
    182182                        printf("init[%" PRIs "].addr is not frame aligned\n", i);
    183                         programs[i].task = NULL;
    184183                        continue;
    185184                }
  • kernel/generic/src/proc/scheduler.c

    r5387807 r3193c05  
    193193                 * This improves energy saving and hyperthreading.
    194194                 */
     195               
     196                 /* Mark CPU as it was idle this clock tick */
    195197                irq_spinlock_lock(&CPU->lock, false);
    196198                CPU->idle = true;
    197199                irq_spinlock_unlock(&CPU->lock, false);
     200               
    198201                interrupts_enable();
    199                
    200202                /*
    201203                 * An interrupt might occur right now and wake up a thread.
     
    384386        as_t *old_as = AS;
    385387       
    386         ASSERT((!THREAD) || (irq_spinlock_locked(&THREAD->lock)));
     388        ASSERT(!THREAD || irq_spinlock_locked(&THREAD->lock));
    387389        ASSERT(CPU != NULL);
    388390       
  • kernel/generic/src/sysinfo/stats.c

    r5387807 r3193c05  
    124124                stats_cpus[i].active = cpus[i].active;
    125125                stats_cpus[i].frequency_mhz = cpus[i].frequency_mhz;
    126                 stats_cpus[i].busy_cycles = cpus[i].busy_cycles;
    127                 stats_cpus[i].idle_cycles = cpus[i].idle_cycles;
     126                stats_cpus[i].busy_ticks = cpus[i].busy_ticks;
     127                stats_cpus[i].idle_ticks = cpus[i].idle_ticks;
    128128               
    129129                irq_spinlock_unlock(&cpus[i].lock, true);
  • kernel/generic/src/time/clock.c

    r5387807 r3193c05  
    5757#include <mm/frame.h>
    5858#include <ddi/ddi.h>
    59 #include <arch/cycle.h>
    6059
    6160/* Pointer to variable with uptime */
     
    126125}
    127126
    128 static void cpu_update_accounting(void)
    129 {
    130         irq_spinlock_lock(&CPU->lock, false);
    131         uint64_t now = get_cycle();
    132         CPU->busy_cycles += now - CPU->last_cycle;
    133         CPU->last_cycle = now;
    134         irq_spinlock_unlock(&CPU->lock, false);
    135 }
    136 
    137127/** Clock routine
    138128 *
     
    146136        size_t missed_clock_ticks = CPU->missed_clock_ticks;
    147137       
    148         /* Account CPU usage */
    149         cpu_update_accounting();
     138        /* Account lost ticks to CPU usage */
     139        if (CPU->idle)
     140                CPU->idle_ticks += missed_clock_ticks + 1;
     141        else
     142                CPU->busy_ticks += missed_clock_ticks + 1;
     143       
     144        CPU->idle = false;
    150145       
    151146        /*
     
    156151        size_t i;
    157152        for (i = 0; i <= missed_clock_ticks; i++) {
    158                 /* Update counters and accounting */
    159153                clock_update_counters();
    160                 cpu_update_accounting();
    161                
    162154                irq_spinlock_lock(&CPU->timeoutlock, false);
    163155               
  • uspace/app/tasks/tasks.c

    r5387807 r3193c05  
    165165        for (i = 0; i < count; i++) {
    166166                if (cpus[i].active) {
    167                         printf("cpu%u: %" PRIu16 " MHz, busy cycles: "
    168                             "%" PRIu64 ", idle cycles: %" PRIu64 "\n",
    169                             cpus[i].id, cpus[i].frequency_mhz, cpus[i].busy_cycles,
    170                             cpus[i].idle_cycles);
     167                        printf("cpu%u: %" PRIu16 " MHz, busy ticks: "
     168                            "%" PRIu64 ", idle ticks: %" PRIu64 "\n",
     169                            cpus[i].id, cpus[i].frequency_mhz, cpus[i].busy_ticks,
     170                            cpus[i].idle_ticks);
    171171                } else {
    172172                        printf("cpu%u: inactive\n", cpus[i].id);
  • uspace/app/top/screen.c

    r5387807 r3193c05  
    222222        for (i = 0; i < data->cpus_count; i++) {
    223223                if (data->cpus[i].active) {
    224                         uint64_t busy;
    225                         uint64_t idle;
    226                         char busy_suffix;
    227                         char idle_suffix;
    228                        
    229                         order_suffix(data->cpus[i].busy_cycles, &busy, &busy_suffix);
    230                         order_suffix(data->cpus[i].idle_cycles, &idle, &idle_suffix);
    231                        
    232                         printf("cpu%u (%4" PRIu16 " MHz): busy cycles: "
    233                             "%" PRIu64 "%c, idle cycles: %" PRIu64 "%c",
     224                        printf("cpu%u (%4" PRIu16 " MHz): busy ticks: "
     225                            "%" PRIu64 ", idle ticks: %" PRIu64,
    234226                            data->cpus[i].id, data->cpus[i].frequency_mhz,
    235                             busy, busy_suffix, idle, idle_suffix);
     227                            data->cpus[i].busy_ticks, data->cpus[i].idle_ticks);
    236228                        puts(", idle: ");
    237229                        print_percent(data->cpus_perc[i].idle, 2);
  • uspace/app/top/top.c

    r5387807 r3193c05  
    175175        }
    176176       
    177         /* For each CPU: Compute total cycles and divide it between
     177        /* For each CPU: Compute total ticks and divide it between
    178178           user and kernel */
    179179       
     
    181181        for (i = 0; i < new_data->cpus_count; i++) {
    182182                uint64_t idle =
    183                     new_data->cpus[i].idle_cycles - old_data->cpus[i].idle_cycles;
     183                    new_data->cpus[i].idle_ticks - old_data->cpus[i].idle_ticks;
    184184                uint64_t busy =
    185                     new_data->cpus[i].busy_cycles - old_data->cpus[i].busy_cycles;
     185                    new_data->cpus[i].busy_ticks - old_data->cpus[i].busy_ticks;
    186186                uint64_t sum = idle + busy;
    187187               
Note: See TracChangeset for help on using the changeset viewer.