Changes in uspace/app/top/screen.c [172aad6:80badbe] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r172aad6 r80badbe 126 126 } 127 127 128 static void print_ percent(fixed_float ffloat, unsigned int precision)129 { 130 printf("% 3" PRIu64 ".", ffloat.upper / ffloat.lower);128 static void print_float(fixed_float ffloat, unsigned int precision) 129 { 130 printf("%2" 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);154 138 } 155 139 … … 222 206 for (i = 0; i < data->cpus_count; i++) { 223 207 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", 208 printf("cpu%u (%4" PRIu16 " MHz): busy ticks: " 209 "%" PRIu64 ", idle ticks: %" PRIu64, 234 210 data->cpus[i].id, data->cpus[i].frequency_mhz, 235 busy, busy_suffix, idle, idle_suffix);211 data->cpus[i].busy_ticks, data->cpus[i].idle_ticks); 236 212 puts(", idle: "); 237 print_percent(data->cpus_perc[i].idle, 2); 238 puts(", busy: "); 239 print_percent(data->cpus_perc[i].busy, 2); 213 print_float(data->cpus_perc[i].idle, 2); 214 puts("%, busy: "); 215 print_float(data->cpus_perc[i].busy, 2); 216 puts("%"); 240 217 } else 241 218 printf("cpu%u inactive", data->cpus[i].id); … … 267 244 } 268 245 269 static inline void print_task s_head(void)246 static inline void print_task_head(void) 270 247 { 271 248 screen_style_inverted(); 272 printf("[taskid] [threads] [virtual] [%%virt] [%%user]" 273 " [%%kernel] [name"); 249 printf(" ID Threads Mem %%Mem %%uCycles %%kCycles Name"); 274 250 screen_newline(); 275 251 screen_style_normal(); … … 288 264 size_t i; 289 265 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 293 266 uint64_t virtmem; 294 267 char 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); 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); 302 272 puts(" "); 303 print_percent(perc->kcycles, 2); 304 puts(" "); 305 print_string(task->name); 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); 306 279 307 280 screen_newline(); … … 317 290 { 318 291 screen_style_inverted(); 319 printf("[taskid] [cls snt] [cls rcv] [ans snt]" 320 " [ans rcv] [irq rcv] [forward] [name"); 292 printf(" ID Calls sent Calls recv Answs sent Answs recv IRQn recv Forw Name"); 321 293 screen_newline(); 322 294 screen_style_normal(); … … 335 307 size_t i; 336 308 for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) { 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; 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 } 463 320 464 321 while (row < rows) { … … 481 338 screen_newline(); 482 339 483 switch (op_mode) { 484 case OP_TASKS: 485 print_tasks_head(); 486 print_tasks(data); 487 break; 488 case OP_IPC: 340 if (operation_type == OP_IPC) { 489 341 print_ipc_head(); 490 342 print_ipc(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(); 343 } else { 344 print_task_head(); 345 print_tasks(data); 499 346 } 500 347
Note:
See TracChangeset
for help on using the changeset viewer.