Changeset be06914 in mainline
- Timestamp:
- 2010-06-11T12:41:35Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b3b7e14a
- Parents:
- 48dcc69
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/include/drivers/pl050/pl050.h
r48dcc69 rbe06914 72 72 #define PL050_STAT_RXFULL (1 << 4) /* 1: register Full */ 73 73 #define PL050_STAT_RXBUSY (1 << 3) /* 1: Busy, recieving Data */ 74 #define PL050_STAT_RXPARITY (1 << 2) /* odd parity of the last bit rec ieved */74 #define PL050_STAT_RXPARITY (1 << 2) /* odd parity of the last bit received */ 75 75 #define PL050_STAT_KMIC (1 << 1) /* status of KMICLKIN */ 76 76 #define PL050_STAT_KMID 1 /* status of KMIDATAIN */ -
kernel/generic/include/sysinfo/abi.h
r48dcc69 rbe06914 90 90 typedef struct { 91 91 uint64_t call_sent; /**< IPC calls sent */ 92 uint64_t call_rec ieved; /**< IPC calls received */92 uint64_t call_received; /**< IPC calls received */ 93 93 uint64_t answer_sent; /**< IPC answers sent */ 94 uint64_t answer_rec ieved; /**< IPC answers received */95 uint64_t irq_notif_rec ieved; /**< IPC IRQ notifications */94 uint64_t answer_received; /**< IPC answers received */ 95 uint64_t irq_notif_received; /**< IPC IRQ notifications */ 96 96 uint64_t forwarded; /**< IPC messages forwarded */ 97 97 } stats_ipc_t; -
kernel/generic/src/ipc/ipc.c
r48dcc69 rbe06914 442 442 irq_spinlock_lock(&box->lock, true); 443 443 if (!list_empty(&box->irq_notifs)) { 444 /* Count rec ieved IRQ notification */444 /* Count received IRQ notification */ 445 445 irq_cnt++; 446 446 … … 452 452 irq_spinlock_unlock(&box->irq_lock, false); 453 453 } else if (!list_empty(&box->answers)) { 454 /* Count rec ieved answer */454 /* Count received answer */ 455 455 answer_cnt++; 456 456 … … 460 460 atomic_dec(&request->data.phone->active_calls); 461 461 } else if (!list_empty(&box->calls)) { 462 /* Count rec ieved call */462 /* Count received call */ 463 463 call_cnt++; 464 464 … … 477 477 irq_spinlock_pass(&box->lock, &TASK->lock); 478 478 479 TASK->ipc_info.irq_notif_rec ieved += irq_cnt;480 TASK->ipc_info.answer_rec ieved += answer_cnt;481 TASK->ipc_info.call_rec ieved += call_cnt;479 TASK->ipc_info.irq_notif_received += irq_cnt; 480 TASK->ipc_info.answer_received += answer_cnt; 481 TASK->ipc_info.call_received += call_cnt; 482 482 483 483 irq_spinlock_unlock(&TASK->lock, true); -
kernel/generic/src/proc/task.c
r48dcc69 rbe06914 197 197 198 198 task->ipc_info.call_sent = 0; 199 task->ipc_info.call_rec ieved = 0;199 task->ipc_info.call_received = 0; 200 200 task->ipc_info.answer_sent = 0; 201 task->ipc_info.answer_rec ieved = 0;202 task->ipc_info.irq_notif_rec ieved = 0;201 task->ipc_info.answer_received = 0; 202 task->ipc_info.irq_notif_received = 0; 203 203 task->ipc_info.forwarded = 0; 204 204 … … 478 478 #ifdef __32_BITS__ 479 479 if (*additional) 480 printf("%-8" PRIu64 " %9l d %7ld", task->taskid,480 printf("%-8" PRIu64 " %9lu %7lu", task->taskid, 481 481 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 482 482 else … … 489 489 #ifdef __64_BITS__ 490 490 if (*additional) 491 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9l d %7ld",491 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9lu %7lu", 492 492 task->taskid, ucycles, usuffix, kcycles, ksuffix, 493 493 atomic_get(&task->refcount), atomic_get(&task->active_calls)); … … 530 530 #ifdef __64_BITS__ 531 531 if (additional) 532 printf("[ taskid] [ucycles ] [kcycles ] [threads] [calls]"532 printf("[id ] [ucycles ] [kcycles ] [threads] [calls]" 533 533 " [callee\n"); 534 534 else 535 printf("[ taskid] [name ] [ctx] [address ]"535 printf("[id ] [name ] [ctx] [address ]" 536 536 " [as ]\n"); 537 537 #endif -
uspace/app/top/screen.c
r48dcc69 rbe06914 126 126 } 127 127 128 static void print_ float(fixed_float ffloat, unsigned int precision)129 { 130 printf("% 2" PRIu64 ".", ffloat.upper / ffloat.lower);128 static void print_percent(fixed_float ffloat, unsigned int precision) 129 { 130 printf("%3" PRIu64 ".", ffloat.upper / ffloat.lower); 131 131 132 132 unsigned int i; … … 136 136 rest = (rest % ffloat.lower) * 10; 137 137 } 138 139 printf("%%"); 140 } 141 142 static void print_string(const char *str) 143 { 144 ipcarg_t cols; 145 ipcarg_t rows; 146 screen_get_size(&cols, &rows); 147 148 ipcarg_t c; 149 ipcarg_t r; 150 screen_get_pos(&c, &r); 151 152 if (c < cols) 153 printf("%.*s", cols - c - 1, str); 138 154 } 139 155 … … 211 227 data->cpus[i].busy_ticks, data->cpus[i].idle_ticks); 212 228 puts(", idle: "); 213 print_float(data->cpus_perc[i].idle, 2); 214 puts("%, busy: "); 215 print_float(data->cpus_perc[i].busy, 2); 216 puts("%"); 229 print_percent(data->cpus_perc[i].idle, 2); 230 puts(", busy: "); 231 print_percent(data->cpus_perc[i].busy, 2); 217 232 } else 218 233 printf("cpu%u inactive", data->cpus[i].id); … … 247 262 { 248 263 screen_style_inverted(); 249 printf(" ID Threads Mem %%Mem %%uCycles %%kCycles Name"); 264 printf("[taskid] [threads] [virtual] [%%virt] [%%user]" 265 " [%%kernel] [name"); 250 266 screen_newline(); 251 267 screen_style_normal(); … … 268 284 order_suffix(data->tasks[i].virtmem, &virtmem, &virtmem_suffix); 269 285 270 printf("% 8" PRIu64 " %8u %8" PRIu64 "%c ", data->tasks[i].task_id,286 printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", data->tasks[i].task_id, 271 287 data->tasks[i].threads, virtmem, virtmem_suffix); 288 print_percent(data->tasks_perc[i].virtmem, 2); 289 puts(" "); 290 print_percent(data->tasks_perc[i].ucycles, 2); 272 291 puts(" "); 273 print_float(data->tasks_perc[i].virtmem, 2); 274 puts("% "); 275 print_float(data->tasks_perc[i].ucycles, 2); 276 puts("% "); 277 print_float(data->tasks_perc[i].kcycles, 2); 278 printf("%% %s", data->tasks[i].name); 292 print_percent(data->tasks_perc[i].kcycles, 2); 293 puts(" "); 294 print_string(data->tasks[i].name); 279 295 280 296 screen_newline(); … … 290 306 { 291 307 screen_style_inverted(); 292 printf(" ID Calls sent Calls recv Answs sent Answs recv IRQn recv Forw Name"); 308 printf("[taskid] [cls snt] [cls rcv] [ans snt]" 309 " [ans rcv] [irq rcv] [forward] [name"); 293 310 screen_newline(); 294 311 screen_style_normal(); … … 307 324 size_t i; 308 325 for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) { 309 printf("%8" PRIu64 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 310 " %10" PRIu64 " %10" PRIu64 " %10" PRIu64 " %s", 311 data->tasks[i].task_id, data->tasks[i].ipc_info.call_sent, 312 data->tasks[i].ipc_info.call_recieved, 313 data->tasks[i].ipc_info.answer_sent, 314 data->tasks[i].ipc_info.answer_recieved, 315 data->tasks[i].ipc_info.irq_notif_recieved, 316 data->tasks[i].ipc_info.forwarded, data->tasks[i].name); 326 uint64_t call_sent; 327 uint64_t call_received; 328 uint64_t answer_sent; 329 uint64_t answer_received; 330 uint64_t irq_notif_received; 331 uint64_t forwarded; 332 333 char call_sent_suffix; 334 char call_received_suffix; 335 char answer_sent_suffix; 336 char answer_received_suffix; 337 char irq_notif_received_suffix; 338 char forwarded_suffix; 339 340 order_suffix(data->tasks[i].ipc_info.call_sent, &call_sent, 341 &call_sent_suffix); 342 order_suffix(data->tasks[i].ipc_info.call_received, 343 &call_received, &call_received_suffix); 344 order_suffix(data->tasks[i].ipc_info.answer_sent, 345 &answer_sent, &answer_sent_suffix); 346 order_suffix(data->tasks[i].ipc_info.answer_received, 347 &answer_received, &answer_received_suffix); 348 order_suffix(data->tasks[i].ipc_info.irq_notif_received, 349 &irq_notif_received, &irq_notif_received_suffix); 350 order_suffix(data->tasks[i].ipc_info.forwarded, &forwarded, 351 &forwarded_suffix); 352 353 printf("%-8" PRIu64 " %8" PRIu64 "%c %8" PRIu64 "%c" 354 " %8" PRIu64 "%c %8" PRIu64 "%c %8" PRIu64 "%c" 355 " %8" PRIu64 "%c ", data->tasks[i].task_id, 356 call_sent, call_sent_suffix, 357 call_received, call_received_suffix, 358 answer_sent, answer_sent_suffix, 359 answer_received, answer_received_suffix, 360 irq_notif_received, irq_notif_received_suffix, 361 forwarded, forwarded_suffix); 362 print_string(data->tasks[i].name); 317 363 318 364 screen_newline(); … … 328 374 { 329 375 screen_style_inverted(); 330 printf(" ID Desc Count Cycles");376 printf("[exc ] [count ] [%%count] [cycles ] [%%cycles] [description"); 331 377 screen_newline(); 332 378 screen_style_normal(); … … 345 391 size_t i; 346 392 for (i = 0; (i < data->exceptions_count) && (row < rows); i++, row++) { 393 uint64_t count; 347 394 uint64_t cycles; 348 char suffix; 349 350 order_suffix(data->exceptions[i].cycles, &cycles, &suffix); 351 printf("%8u %20s %8" PRIu64 " %8" PRIu64 "%c", 352 data->exceptions[i].id, data->exceptions[i].desc, 353 data->exceptions[i].count, cycles, suffix); 395 396 char count_suffix; 397 char cycles_suffix; 398 399 order_suffix(data->exceptions[i].count, &count, &count_suffix); 400 order_suffix(data->exceptions[i].cycles, &cycles, &cycles_suffix); 401 402 printf("%-8u %9" PRIu64 "%c ", 403 data->exceptions[i].id, count, count_suffix); 404 print_percent(data->exceptions_perc[i].count, 2); 405 printf(" %9" PRIu64 "%c ", cycles, cycles_suffix); 406 print_percent(data->exceptions_perc[i].cycles, 2); 407 puts(" "); 408 print_string(data->exceptions[i].desc); 354 409 355 410 screen_newline(); -
uspace/app/top/top.c
r48dcc69 rbe06914 67 67 target->tasks_perc = NULL; 68 68 target->threads = NULL; 69 target->exceptions = NULL; 70 target->exceptions_perc = NULL; 69 71 target->physmem = NULL; 70 72 … … 115 117 return "Cannot get threads"; 116 118 119 /* Get Exceptions */ 117 120 target->exceptions = stats_get_exceptions(&(target->exceptions_count)); 118 121 if (target->exceptions == NULL) 119 122 return "Cannot get exceptions"; 123 124 target->exceptions_perc = 125 (perc_exc_t *) calloc(target->exceptions_count, sizeof(perc_exc_t)); 126 if (target->exceptions_perc == NULL) 127 return "Not enough memory for exception utilization"; 120 128 121 129 /* Get physical memory */ … … 137 145 /* Allocate memory */ 138 146 139 uint64_t *ucycles_diff = calloc(new_data->tasks_count, sizeof(uint64_t)); 147 uint64_t *ucycles_diff = calloc(new_data->tasks_count, 148 sizeof(uint64_t)); 140 149 if (ucycles_diff == NULL) 141 150 return "Not enough memory for user utilization"; 142 151 143 uint64_t *kcycles_diff = calloc(new_data->tasks_count, sizeof(uint64_t)); 152 uint64_t *kcycles_diff = calloc(new_data->tasks_count, 153 sizeof(uint64_t)); 144 154 if (kcycles_diff == NULL) { 145 155 free(ucycles_diff); 146 156 return "Not enough memory for kernel utilization"; 157 } 158 159 uint64_t *ecycles_diff = calloc(new_data->exceptions_count, 160 sizeof(uint64_t)); 161 if (ecycles_diff == NULL) { 162 free(ucycles_diff); 163 free(kcycles_diff); 164 return "Not enough memory for exception cycles utilization"; 165 } 166 167 uint64_t *ecount_diff = calloc(new_data->exceptions_count, 168 sizeof(uint64_t)); 169 if (ecount_diff == NULL) { 170 free(ucycles_diff); 171 free(kcycles_diff); 172 free(ecycles_diff); 173 return "Not enough memory for exception count utilization"; 147 174 } 148 175 … … 164 191 /* For all tasks compute sum and differencies of all cycles */ 165 192 166 uint64_t virtmem_total = 1; /* Must NOT be zero */167 uint64_t ucycles_total = 1; /* Must NOT be zero */168 uint64_t kcycles_total = 1; /* Must NOT be zero */193 uint64_t virtmem_total = 0; 194 uint64_t ucycles_total = 0; 195 uint64_t kcycles_total = 0; 169 196 170 197 for (i = 0; i < new_data->tasks_count; i++) { … … 197 224 } 198 225 199 /* For each task : Compute percential change */226 /* For each task compute percential change */ 200 227 201 228 for (i = 0; i < new_data->tasks_count; i++) { … … 208 235 } 209 236 237 /* For all exceptions compute sum and differencies of cycles */ 238 239 uint64_t ecycles_total = 0; 240 uint64_t ecount_total = 0; 241 242 for (i = 0; i < new_data->exceptions_count; i++) { 243 /* 244 * March exception with the previous instance. 245 * This is quite paranoid since exceptions do not 246 * usually disappear, but it does not hurt. 247 */ 248 249 bool found = false; 250 size_t j; 251 for (j = 0; j < old_data->exceptions_count; j++) { 252 if (new_data->exceptions[i].id == old_data->exceptions[j].id) { 253 found = true; 254 break; 255 } 256 } 257 258 if (!found) { 259 /* This is a new exception, ignore it */ 260 ecycles_diff[i] = 0; 261 ecount_diff[i] = 0; 262 continue; 263 } 264 265 ecycles_diff[i] = 266 new_data->exceptions[i].cycles - old_data->exceptions[j].cycles; 267 ecount_diff[i] = 268 new_data->exceptions[i].count - old_data->exceptions[i].count; 269 270 ecycles_total += ecycles_diff[i]; 271 ecount_total += ecount_diff[i]; 272 } 273 274 /* For each exception compute percential change */ 275 276 for (i = 0; i < new_data->exceptions_count; i++) { 277 FRACTION_TO_FLOAT(new_data->exceptions_perc[i].cycles, 278 ecycles_diff[i] * 100, ecycles_total); 279 FRACTION_TO_FLOAT(new_data->exceptions_perc[i].count, 280 ecount_diff[i] * 100, ecount_total); 281 } 282 210 283 /* Cleanup */ 211 284 212 285 free(ucycles_diff); 213 286 free(kcycles_diff); 287 free(ecycles_diff); 288 free(ecount_diff); 214 289 215 290 return NULL; … … 238 313 if (target->exceptions != NULL) 239 314 free(target->exceptions); 315 316 if (target->exceptions_perc != NULL) 317 free(target->exceptions_perc); 240 318 241 319 if (target->physmem != NULL) -
uspace/app/top/top.h
r48dcc69 rbe06914 39 39 #include <time.h> 40 40 41 #define FRACTION_TO_FLOAT(float, a, b) { \ 42 (float).upper = (a); \ 43 (float).lower = (b); \ 44 } 41 #define FRACTION_TO_FLOAT(float, a, b) \ 42 { \ 43 if ((b) != 0) { \ 44 (float).upper = (a); \ 45 (float).lower = (b); \ 46 } else { \ 47 (float).upper = 0; \ 48 (float).lower = 1; \ 49 } \ 50 } 45 51 46 52 #define OP_TASKS 1 … … 61 67 62 68 typedef struct { 69 fixed_float virtmem; 63 70 fixed_float ucycles; 64 71 fixed_float kcycles; 65 fixed_float virtmem;66 72 } perc_task_t; 73 74 typedef struct { 75 fixed_float cycles; 76 fixed_float count; 77 } perc_exc_t; 67 78 68 79 typedef struct { … … 92 103 size_t exceptions_count; 93 104 stats_exc_t *exceptions; 105 perc_exc_t *exceptions_perc; 94 106 95 107 stats_physmem_t *physmem;
Note:
See TracChangeset
for help on using the changeset viewer.