Changeset 8eec3c8 in mainline for kernel/generic/src/interrupt/interrupt.c
- Timestamp:
- 2010-06-10T14:24:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c0f13d2
- Parents:
- 1113c9e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/interrupt/interrupt.c
r1113c9e r8eec3c8 53 53 #include <symtab.h> 54 54 #include <proc/thread.h> 55 56 static struct { 57 const char *name; 58 iroutine f; 59 } exc_table[IVT_ITEMS]; 60 61 SPINLOCK_INITIALIZE(exctbl_lock); 55 #include <arch/cycle.h> 56 #include <str.h> 57 58 exc_table_t exc_table[IVT_ITEMS]; 59 IRQ_SPINLOCK_INITIALIZE(exctbl_lock); 62 60 63 61 /** Register exception handler … … 72 70 ASSERT(n < IVT_ITEMS); 73 71 74 spinlock_lock(&exctbl_lock);72 irq_spinlock_lock(&exctbl_lock, true); 75 73 76 74 iroutine old = exc_table[n].f; 77 75 exc_table[n].f = handler; 78 76 exc_table[n].name = name; 79 80 spinlock_unlock(&exctbl_lock); 77 exc_table[n].cycles = 0; 78 exc_table[n].count = 0; 79 80 irq_spinlock_unlock(&exctbl_lock, true); 81 81 82 82 return old; … … 92 92 { 93 93 ASSERT(n < IVT_ITEMS); 94 95 uint64_t begin_cycle = get_cycle(); 94 96 95 97 /* Account user cycles */ 96 98 if (THREAD) { 97 99 irq_spinlock_lock(&THREAD->lock, false); 98 thread_update_accounting(true);100 THREAD->ucycles += begin_cycle - THREAD->last_cycle; 99 101 irq_spinlock_unlock(&THREAD->lock, false); 100 102 } … … 116 118 thread_exit(); 117 119 120 /* Account exception handling */ 121 uint64_t end_cycle = get_cycle(); 122 exc_table[n].cycles += end_cycle - begin_cycle; 123 exc_table[n].count++; 124 125 /* Do not charge THREAD for exception cycles */ 118 126 if (THREAD) { 119 127 irq_spinlock_lock(&THREAD->lock, false); 120 thread_update_accounting(false);128 THREAD->last_cycle = end_cycle; 121 129 irq_spinlock_unlock(&THREAD->lock, false); 122 130 } … … 185 193 unsigned int i; 186 194 187 spinlock_lock(&exctbl_lock);195 irq_spinlock_lock(&exctbl_lock, true); 188 196 189 197 #ifdef __32_BITS__ 190 printf("Exc Description Handler Symbol\n");191 printf("--- -------------------- ---------- -------- \n");198 printf("Exc Description Count Cycles Handler Symbol\n"); 199 printf("--- -------------------- ---------- ---------- ---------- --------\n"); 192 200 #endif 193 201 194 202 #ifdef __64_BITS__ 195 printf("Exc Description Handler Symbol\n");196 printf("--- -------------------- ---------- -------- --------\n");203 printf("Exc Description Count Cycles Handler Symbol\n"); 204 printf("--- -------------------- ---------- ---------- ------------------ --------\n"); 197 205 #endif 198 206 199 207 for (i = 0; i < IVT_ITEMS; i++) { 200 const char *symbol = symtab_fmt_name_lookup((unative_t) exc_table[i].f); 208 uint64_t count; 209 char count_suffix; 210 211 order_suffix(exc_table[i].count, &count, &count_suffix); 212 213 uint64_t cycles; 214 char cycles_suffix; 215 216 order_suffix(exc_table[i].cycles, &cycles, &cycles_suffix); 217 218 const char *symbol = 219 symtab_fmt_name_lookup((unative_t) exc_table[i].f); 201 220 202 221 #ifdef __32_BITS__ 203 printf("%-3u %-20s %10p %s\n", i + IVT_FIRST, exc_table[i].name, 204 exc_table[i].f, symbol); 222 printf("%-3u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %10p %s\n", 223 i + IVT_FIRST, exc_table[i].name, count, count_suffix, 224 cycles, cycles_suffix, exc_table[i].f, symbol); 205 225 #endif 206 226 207 227 #ifdef __64_BITS__ 208 printf("%-3u %-20s %18p %s\n", i + IVT_FIRST, exc_table[i].name, 209 exc_table[i].f, symbol); 228 printf("%-3u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %18p %s\n", 229 i + IVT_FIRST, exc_table[i].name, count, count_suffix, 230 cycles, cycles_suffix, exc_table[i].f, symbol); 210 231 #endif 211 232 212 233 if (((i + 1) % 20) == 0) { 213 234 printf(" -- Press any key to continue -- "); 214 spinlock_unlock(&exctbl_lock);235 irq_spinlock_unlock(&exctbl_lock, true); 215 236 indev_pop_character(stdin); 216 spinlock_lock(&exctbl_lock);237 irq_spinlock_lock(&exctbl_lock, true); 217 238 printf("\n"); 218 239 } 219 240 } 220 241 221 spinlock_unlock(&exctbl_lock);242 irq_spinlock_unlock(&exctbl_lock, true); 222 243 #endif 223 244
Note:
See TracChangeset
for help on using the changeset viewer.