Changeset d76a329 in mainline
- Timestamp:
- 2012-04-16T20:08:30Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b1213b0
- Parents:
- f76696f
- Location:
- uspace/app/top
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
rf76696f rd76a329 400 400 401 401 switch (field->type) { 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 402 case FIELD_EMPTY: 403 printf("%*s", width, ""); 404 break; 405 case FIELD_UINT: 406 printf("%*" PRIu64, width, field->uint); 407 break; 408 case FIELD_UINT_SUFFIX_BIN: { 409 uint64_t val = field->uint; 410 const char *suffix; 411 width -= 3; 412 bin_order_suffix(val, &val, &suffix, true); 413 printf("%*" PRIu64 "%s", width, val, suffix); 414 break; 415 } 416 case FIELD_UINT_SUFFIX_DEC: { 417 uint64_t val = field->uint; 418 char suffix; 419 width -= 1; 420 order_suffix(val, &val, &suffix); 421 printf("%*" PRIu64 "%c", width, val, suffix); 422 break; 423 } 424 case FIELD_PERCENT: 425 width -= 5; /* nnn.% */ 426 if (width > 2) { 427 printf("%*s", width - 2, ""); 428 width = 2; 429 } 430 print_percent(field->fixed, width); 431 break; 432 case FIELD_STRING: 433 printf("%-*.*s", width, width, field->string); 434 break; 435 435 } 436 436 -
uspace/app/top/top.c
rf76696f rd76a329 371 371 372 372 switch (fa->type) { 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 373 case FIELD_EMPTY: 374 return 0; 375 case FIELD_UINT_SUFFIX_BIN: /* fallthrough */ 376 case FIELD_UINT_SUFFIX_DEC: /* fallthrough */ 377 case FIELD_UINT: 378 if (fa->uint > fb->uint) 379 return 1 * sort_reverse; 380 if (fa->uint < fb->uint) 381 return -1 * sort_reverse; 382 return 0; 383 case FIELD_PERCENT: 384 if (fa->fixed.upper * fb->fixed.lower 385 > fb->fixed.upper * fa->fixed.lower) 386 return 1 * sort_reverse; 387 if (fa->fixed.upper * fb->fixed.lower 388 < fb->fixed.upper * fa->fixed.lower) 389 return -1 * sort_reverse; 390 return 0; 391 case FIELD_STRING: 392 return str_cmp(fa->string, fb->string) * sort_reverse; 393 393 } 394 394 … … 521 521 522 522 switch (op_mode) { 523 524 525 526 527 528 523 case OP_TASKS: 524 return fill_task_table(data); 525 case OP_IPC: 526 return fill_ipc_table(data); 527 case OP_EXCS: 528 return fill_exception_table(data); 529 529 } 530 530 return NULL; … … 627 627 628 628 switch (c) { 629 case -1: /* do nothing */ 629 case -1: /* do nothing */ 630 break; 631 case 't': 632 op_mode = OP_TASKS; 633 break; 634 case 'i': 635 op_mode = OP_IPC; 636 break; 637 case 'e': 638 op_mode = OP_EXCS; 639 break; 640 case 's': 641 screen_mode = SCREEN_SORT; 642 break; 643 case 'r': 644 sort_reverse = -sort_reverse; 645 break; 646 case 'h': 647 case '?': 648 screen_mode = SCREEN_HELP; 649 break; 650 case 'q': 651 goto out; 652 case 'a': 653 if (op_mode == OP_EXCS) { 654 excs_all = !excs_all; 655 if (excs_all) 656 show_warning("Showing all exceptions"); 657 else 658 show_warning("Showing only hot exceptions"); 630 659 break; 631 case 't': 632 op_mode = OP_TASKS; 633 break; 634 case 'i': 635 op_mode = OP_IPC; 636 break; 637 case 'e': 638 op_mode = OP_EXCS; 639 break; 640 case 's': 641 screen_mode = SCREEN_SORT; 642 break; 643 case 'r': 644 sort_reverse = -sort_reverse; 645 break; 646 case 'h': 647 case '?': 648 screen_mode = SCREEN_HELP; 649 break; 650 case 'q': 651 goto out; 652 case 'a': 653 if (op_mode == OP_EXCS) { 654 excs_all = !excs_all; 655 if (excs_all) 656 show_warning("Showing all exceptions"); 657 else 658 show_warning("Showing only hot exceptions"); 659 break; 660 } 661 /* fallthrough */ 662 default: 663 show_warning("Unknown command \"%c\", use \"h\" for help", c); 664 continue; /* don't redraw */ 660 } 661 /* fallthrough */ 662 default: 663 show_warning("Unknown command \"%c\", use \"h\" for help", c); 664 continue; /* don't redraw */ 665 665 } 666 666
Note:
See TracChangeset
for help on using the changeset viewer.