Changes in uspace/app/top/screen.c [80badbe:172aad6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r80badbe r172aad6 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 … … 206 222 for (i = 0; i < data->cpus_count; i++) { 207 223 if (data->cpus[i].active) { 208 printf("cpu%u (%4" PRIu16 " MHz): busy ticks: " 209 "%" PRIu64 ", idle ticks: %" PRIu64, 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", 210 234 data->cpus[i].id, data->cpus[i].frequency_mhz, 211 data->cpus[i].busy_ticks, data->cpus[i].idle_ticks);235 busy, busy_suffix, idle, idle_suffix); 212 236 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("%"); 237 print_percent(data->cpus_perc[i].idle, 2); 238 puts(", busy: "); 239 print_percent(data->cpus_perc[i].busy, 2); 217 240 } else 218 241 printf("cpu%u inactive", data->cpus[i].id); … … 244 267 } 245 268 246 static inline void print_task _head(void)269 static inline void print_tasks_head(void) 247 270 { 248 271 screen_style_inverted(); 249 printf(" ID Threads Mem %%Mem %%uCycles %%kCycles Name"); 272 printf("[taskid] [threads] [virtual] [%%virt] [%%user]" 273 " [%%kernel] [name"); 250 274 screen_newline(); 251 275 screen_style_normal(); … … 264 288 size_t i; 265 289 for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) { 290 stats_task_t *task = data->tasks + data->tasks_map[i]; 291 perc_task_t *perc = data->tasks_perc + data->tasks_map[i]; 292 266 293 uint64_t virtmem; 267 294 char virtmem_suffix; 268 order_suffix(data->tasks[i].virtmem, &virtmem, &virtmem_suffix); 269 270 printf("%8" PRIu64 " %8u %8" PRIu64 "%c ", data->tasks[i].task_id, 271 data->tasks[i].threads, virtmem, virtmem_suffix); 295 order_suffix(task->virtmem, &virtmem, &virtmem_suffix); 296 297 printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", task->task_id, 298 task->threads, virtmem, virtmem_suffix); 299 print_percent(perc->virtmem, 2); 300 puts(" "); 301 print_percent(perc->ucycles, 2); 272 302 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); 303 print_percent(perc->kcycles, 2); 304 puts(" "); 305 print_string(task->name); 279 306 280 307 screen_newline(); … … 290 317 { 291 318 screen_style_inverted(); 292 printf(" ID Calls sent Calls recv Answs sent Answs recv IRQn recv Forw Name"); 319 printf("[taskid] [cls snt] [cls rcv] [ans snt]" 320 " [ans rcv] [irq rcv] [forward] [name"); 293 321 screen_newline(); 294 322 screen_style_normal(); … … 307 335 size_t i; 308 336 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); 317 318 screen_newline(); 319 } 337 uint64_t call_sent; 338 uint64_t call_received; 339 uint64_t answer_sent; 340 uint64_t answer_received; 341 uint64_t irq_notif_received; 342 uint64_t forwarded; 343 344 char call_sent_suffix; 345 char call_received_suffix; 346 char answer_sent_suffix; 347 char answer_received_suffix; 348 char irq_notif_received_suffix; 349 char forwarded_suffix; 350 351 order_suffix(data->tasks[i].ipc_info.call_sent, &call_sent, 352 &call_sent_suffix); 353 order_suffix(data->tasks[i].ipc_info.call_received, 354 &call_received, &call_received_suffix); 355 order_suffix(data->tasks[i].ipc_info.answer_sent, 356 &answer_sent, &answer_sent_suffix); 357 order_suffix(data->tasks[i].ipc_info.answer_received, 358 &answer_received, &answer_received_suffix); 359 order_suffix(data->tasks[i].ipc_info.irq_notif_received, 360 &irq_notif_received, &irq_notif_received_suffix); 361 order_suffix(data->tasks[i].ipc_info.forwarded, &forwarded, 362 &forwarded_suffix); 363 364 printf("%-8" PRIu64 " %8" PRIu64 "%c %8" PRIu64 "%c" 365 " %8" PRIu64 "%c %8" PRIu64 "%c %8" PRIu64 "%c" 366 " %8" PRIu64 "%c ", data->tasks[i].task_id, 367 call_sent, call_sent_suffix, 368 call_received, call_received_suffix, 369 answer_sent, answer_sent_suffix, 370 answer_received, answer_received_suffix, 371 irq_notif_received, irq_notif_received_suffix, 372 forwarded, forwarded_suffix); 373 print_string(data->tasks[i].name); 374 375 screen_newline(); 376 } 377 378 while (row < rows) { 379 screen_newline(); 380 row++; 381 } 382 } 383 384 static inline void print_excs_head(void) 385 { 386 screen_style_inverted(); 387 printf("[exc ] [count ] [%%count] [cycles ] [%%cycles] [description"); 388 screen_newline(); 389 screen_style_normal(); 390 } 391 392 static inline void print_excs(data_t *data) 393 { 394 ipcarg_t cols; 395 ipcarg_t rows; 396 screen_get_size(&cols, &rows); 397 398 ipcarg_t col; 399 ipcarg_t row; 400 screen_get_pos(&col, &row); 401 402 size_t i; 403 for (i = 0; (i < data->exceptions_count) && (row < rows); i++) { 404 /* Filter-out cold exceptions if not instructed otherwise */ 405 if ((!excs_all) && (!data->exceptions[i].hot)) 406 continue; 407 408 uint64_t count; 409 uint64_t cycles; 410 411 char count_suffix; 412 char cycles_suffix; 413 414 order_suffix(data->exceptions[i].count, &count, &count_suffix); 415 order_suffix(data->exceptions[i].cycles, &cycles, &cycles_suffix); 416 417 printf("%-8u %9" PRIu64 "%c ", 418 data->exceptions[i].id, count, count_suffix); 419 print_percent(data->exceptions_perc[i].count, 2); 420 printf(" %9" PRIu64 "%c ", cycles, cycles_suffix); 421 print_percent(data->exceptions_perc[i].cycles, 2); 422 puts(" "); 423 print_string(data->exceptions[i].desc); 424 425 screen_newline(); 426 row++; 427 } 428 429 while (row < rows) { 430 screen_newline(); 431 row++; 432 } 433 } 434 435 static void print_help(void) 436 { 437 ipcarg_t cols; 438 ipcarg_t rows; 439 screen_get_size(&cols, &rows); 440 441 ipcarg_t col; 442 ipcarg_t row; 443 screen_get_pos(&col, &row); 444 445 screen_newline(); 446 447 printf("Operation modes:"); 448 screen_newline(); 449 450 printf(" t .. tasks statistics"); 451 screen_newline(); 452 453 printf(" i .. IPC statistics"); 454 screen_newline(); 455 456 printf(" e .. exceptions statistics"); 457 screen_newline(); 458 459 printf(" a .. toggle display of all/hot exceptions"); 460 screen_newline(); 461 462 row += 6; 320 463 321 464 while (row < rows) { … … 338 481 screen_newline(); 339 482 340 if (operation_type == OP_IPC) { 483 switch (op_mode) { 484 case OP_TASKS: 485 print_tasks_head(); 486 print_tasks(data); 487 break; 488 case OP_IPC: 341 489 print_ipc_head(); 342 490 print_ipc(data); 343 } else { 344 print_task_head(); 345 print_tasks(data); 491 break; 492 case OP_EXCS: 493 print_excs_head(); 494 print_excs(data); 495 break; 496 case OP_HELP: 497 print_tasks_head(); 498 print_help(); 346 499 } 347 500
Note:
See TracChangeset
for help on using the changeset viewer.