Changeset e535eeb in mainline
- Timestamp:
- 2010-04-18T12:28:19Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dec16a2
- Parents:
- e1b6742
- Files:
-
- 4 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/func.h
re1b6742 re535eeb 43 43 extern void halt(void) __attribute__((noreturn)); 44 44 extern unative_t atoi(const char *text); 45 extern void order(const uint64_t val, uint64_t *rv, char *suffix);46 45 47 46 #endif -
kernel/generic/include/str.h
re1b6742 re535eeb 99 99 extern int str_uint64(const char *, char **, unsigned int, bool, uint64_t *); 100 100 101 extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix); 102 101 103 #endif 102 104 -
kernel/generic/src/console/cmd.c
re1b6742 re535eeb 1068 1068 uint64_t ucycles, kcycles; 1069 1069 char usuffix, ksuffix; 1070 order (ucycles1 - ucycles0, &ucycles, &usuffix);1071 order (kcycles1 - kcycles0, &kcycles, &ksuffix);1070 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1071 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1072 1072 1073 1073 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", … … 1130 1130 1131 1131 data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0; 1132 order (ucycles1 - ucycles0, &ucycles, &usuffix);1133 order (kcycles1 - kcycles0, &kcycles, &ksuffix);1132 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1133 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1134 1134 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1135 1135 ucycles, usuffix, kcycles, ksuffix); … … 1145 1145 } 1146 1146 1147 order (sum / (uint64_t) cnt, &ucycles, &usuffix);1147 order_suffix(sum / (uint64_t) cnt, &ucycles, &usuffix); 1148 1148 printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix); 1149 1149 } -
kernel/generic/src/lib/func.c
re1b6742 re535eeb 123 123 } 124 124 125 126 void order(const uint64_t val, uint64_t *rv, char *suffix)127 {128 if (val > 10000000000000000000ULL) {129 *rv = val / 1000000000000000000ULL;130 *suffix = 'Z';131 } else if (val > 1000000000000000000ULL) {132 *rv = val / 1000000000000000ULL;133 *suffix = 'E';134 } else if (val > 1000000000000000ULL) {135 *rv = val / 1000000000000ULL;136 *suffix = 'T';137 } else if (val > 1000000000000ULL) {138 *rv = val / 1000000000ULL;139 *suffix = 'G';140 } else if (val > 1000000000ULL) {141 *rv = val / 1000000ULL;142 *suffix = 'M';143 } else if (val > 1000000ULL) {144 *rv = val / 1000ULL;145 *suffix = 'k';146 } else {147 *rv = val;148 *suffix = ' ';149 }150 }151 152 125 /** @} 153 126 */ -
kernel/generic/src/lib/str.c
re1b6742 re535eeb 918 918 } 919 919 920 void order_suffix(const uint64_t val, uint64_t *rv, char *suffix) 921 { 922 if (val > 10000000000000000000ULL) { 923 *rv = val / 1000000000000000000ULL; 924 *suffix = 'Z'; 925 } else if (val > 1000000000000000000ULL) { 926 *rv = val / 1000000000000000ULL; 927 *suffix = 'E'; 928 } else if (val > 1000000000000000ULL) { 929 *rv = val / 1000000000000ULL; 930 *suffix = 'T'; 931 } else if (val > 1000000000000ULL) { 932 *rv = val / 1000000000ULL; 933 *suffix = 'G'; 934 } else if (val > 1000000000ULL) { 935 *rv = val / 1000000ULL; 936 *suffix = 'M'; 937 } else if (val > 1000000ULL) { 938 *rv = val / 1000ULL; 939 *suffix = 'k'; 940 } else { 941 *rv = val; 942 *suffix = ' '; 943 } 944 } 945 920 946 /** @} 921 947 */ -
kernel/generic/src/proc/task.c
re1b6742 re535eeb 432 432 char usuffix, ksuffix; 433 433 task_get_accounting(t, &ucycles, &kcycles); 434 order (ucycles, &ucycles, &usuffix);435 order (kcycles, &kcycles, &ksuffix);434 order_suffix(ucycles, &ucycles, &usuffix); 435 order_suffix(kcycles, &kcycles, &ksuffix); 436 436 437 437 #ifdef __32_BITS__ -
kernel/generic/src/proc/thread.c
re1b6742 re535eeb 50 50 #include <synch/rwlock.h> 51 51 #include <cpu.h> 52 #include < func.h>52 #include <str.h> 53 53 #include <context.h> 54 54 #include <adt/avl.h> … … 626 626 uint64_t ucycles, kcycles; 627 627 char usuffix, ksuffix; 628 order (t->ucycles, &ucycles, &usuffix);629 order (t->kcycles, &kcycles, &ksuffix);628 order_suffix(t->ucycles, &ucycles, &usuffix); 629 order_suffix(t->kcycles, &kcycles, &ksuffix); 630 630 631 631 #ifdef __32_BITS__ -
uspace/app/tasks/Makefile
re1b6742 re535eeb 32 32 33 33 SOURCES = \ 34 tasks.c \ 35 func.c 34 tasks.c 36 35 37 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/tasks/tasks.c
re1b6742 re535eeb 45 45 #include <inttypes.h> 46 46 #include <bool.h> 47 #include <str.h> 47 48 #include <arg_parse.h> 48 #include "func.h"49 49 50 50 #define NAME "tasks" … … 76 76 char vmsuffix, usuffix, ksuffix; 77 77 78 order (stats_task->virtmem, &virtmem, &vmsuffix);79 order (stats_task->ucycles, &ucycles, &usuffix);80 order (stats_task->kcycles, &kcycles, &ksuffix);78 order_suffix(stats_task->virtmem, &virtmem, &vmsuffix); 79 order_suffix(stats_task->ucycles, &ucycles, &usuffix); 80 order_suffix(stats_task->kcycles, &kcycles, &ksuffix); 81 81 82 82 printf("%8" PRIu64 "%8u %8" PRIu64"%c %12" … … 113 113 char usuffix, ksuffix; 114 114 115 order (stats_thread->ucycles, &ucycles, &usuffix);116 order (stats_thread->kcycles, &kcycles, &ksuffix);115 order_suffix(stats_thread->ucycles, &ucycles, &usuffix); 116 order_suffix(stats_thread->kcycles, &kcycles, &ksuffix); 117 117 118 118 if (stats_thread->on_cpu) { -
uspace/app/top/Makefile
re1b6742 re535eeb 35 35 screen.c \ 36 36 input.c \ 37 func.c \38 37 ps.c 39 38 -
uspace/lib/c/generic/str.c
re1b6742 re535eeb 1007 1007 } 1008 1008 1009 void order_suffix(const uint64_t val, uint64_t *rv, char *suffix) 1010 { 1011 if (val > 10000000000000000000ULL) { 1012 *rv = val / 1000000000000000000ULL; 1013 *suffix = 'Z'; 1014 } else if (val > 1000000000000000000ULL) { 1015 *rv = val / 1000000000000000ULL; 1016 *suffix = 'E'; 1017 } else if (val > 1000000000000000ULL) { 1018 *rv = val / 1000000000000ULL; 1019 *suffix = 'T'; 1020 } else if (val > 1000000000000ULL) { 1021 *rv = val / 1000000000ULL; 1022 *suffix = 'G'; 1023 } else if (val > 1000000000ULL) { 1024 *rv = val / 1000000ULL; 1025 *suffix = 'M'; 1026 } else if (val > 1000000ULL) { 1027 *rv = val / 1000ULL; 1028 *suffix = 'k'; 1029 } else { 1030 *rv = val; 1031 *suffix = ' '; 1032 } 1033 } 1034 1009 1035 /** @} 1010 1036 */ -
uspace/lib/c/include/str.h
re1b6742 re535eeb 86 86 extern char *str_ndup(const char *, size_t max_size); 87 87 88 extern void order_suffix(const uint64_t val, uint64_t *rv, char *suffix); 89 88 90 /* 89 91 * TODO: Get rid of this.
Note:
See TracChangeset
for help on using the changeset viewer.