Changes in kernel/generic/src/console/cmd.c [cb3d641a:4ce914d4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
rcb3d641a r4ce914d4 46 46 #include <print.h> 47 47 #include <panic.h> 48 #include < arch/types.h>48 #include <typedefs.h> 49 49 #include <adt/list.h> 50 50 #include <arch.h> 51 51 #include <config.h> 52 52 #include <func.h> 53 #include <str ing.h>53 #include <str.h> 54 54 #include <macros.h> 55 55 #include <debug.h> … … 66 66 #include <ipc/irq.h> 67 67 #include <ipc/event.h> 68 #include <sysinfo/sysinfo.h> 68 69 #include <symtab.h> 69 70 #include <errno.h> … … 387 388 }; 388 389 390 static int cmd_sysinfo(cmd_arg_t *argv); 391 static cmd_info_t sysinfo_info = { 392 .name = "sysinfo", 393 .description = "Dump sysinfo.", 394 .func = cmd_sysinfo, 395 .argc = 0 396 }; 397 389 398 /* Data and methods for 'zones' command */ 390 399 static int cmd_zones(cmd_arg_t *argv); … … 475 484 &set4_info, 476 485 &slabs_info, 486 &sysinfo_info, 477 487 &symaddr_info, 478 488 &sched_info, … … 827 837 bool pointer = false; 828 838 int rc; 829 830 if (((char *) argv->buffer)[0] == '*') {839 840 if (((char *) argv->buffer)[0] == '*') { 831 841 rc = symtab_addr_lookup((char *) argv->buffer + 1, &addr); 832 842 pointer = true; 833 } else if (((char *) argv->buffer)[0] >= '0' && 834 ((char *)argv->buffer)[0] <= '9') { 835 rc = EOK; 836 addr = atoi((char *)argv->buffer); 837 } else { 843 } else if (((char *) argv->buffer)[0] >= '0' && 844 ((char *) argv->buffer)[0] <= '9') { 845 uint64_t value; 846 rc = str_uint64((char *) argv->buffer, NULL, 0, true, &value); 847 if (rc == EOK) 848 addr = (uintptr_t) value; 849 } else 838 850 rc = symtab_addr_lookup((char *) argv->buffer, &addr); 839 } 840 851 841 852 if (rc == ENOENT) 842 853 printf("Symbol %s not found.\n", argv->buffer); 854 else if (rc == EINVAL) 855 printf("Invalid address.\n"); 843 856 else if (rc == EOVERFLOW) { 844 857 symtab_print_search((char *) argv->buffer); 845 printf("Duplicate symbol , be more specific.\n");858 printf("Duplicate symbol (be more specific) or address overflow.\n"); 846 859 } else if (rc == EOK) { 847 860 if (pointer) … … 849 862 printf("Writing %#" PRIx64 " -> %p\n", arg1, addr); 850 863 *(uint32_t *) addr = arg1; 851 } else {864 } else 852 865 printf("No symbol information available.\n"); 853 }854 866 855 867 return 1; … … 868 880 } 869 881 882 /** Command for dumping sysinfo 883 * 884 * @param argv Ignores 885 * 886 * @return Always 1 887 */ 888 int cmd_sysinfo(cmd_arg_t * argv) 889 { 890 sysinfo_dump(NULL); 891 return 1; 892 } 893 870 894 871 895 /** Command for listings Thread information … … 913 937 int cmd_zones(cmd_arg_t * argv) 914 938 { 915 zone _print_list();939 zones_print_list(); 916 940 return 1; 917 941 } … … 1027 1051 ipl_t ipl = interrupts_disable(); 1028 1052 spinlock_lock(&TASK->lock); 1029 uint64_t t0 = task_get_accounting(TASK); 1053 uint64_t ucycles0, kcycles0; 1054 task_get_accounting(TASK, &ucycles0, &kcycles0); 1030 1055 spinlock_unlock(&TASK->lock); 1031 1056 interrupts_restore(ipl); … … 1033 1058 /* Execute the test */ 1034 1059 test_quiet = false; 1035 c har *ret = test->entry();1060 const char *ret = test->entry(); 1036 1061 1037 1062 /* Update and read thread accounting */ 1063 uint64_t ucycles1, kcycles1; 1038 1064 ipl = interrupts_disable(); 1039 1065 spinlock_lock(&TASK->lock); 1040 uint64_t dt = task_get_accounting(TASK) - t0;1066 task_get_accounting(TASK, &ucycles1, &kcycles1); 1041 1067 spinlock_unlock(&TASK->lock); 1042 1068 interrupts_restore(ipl); 1043 1069 1044 uint64_t cycles; 1045 char suffix; 1046 order(dt, &cycles, &suffix); 1047 1048 printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix); 1070 uint64_t ucycles, kcycles; 1071 char usuffix, ksuffix; 1072 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1073 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1074 1075 printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n", 1076 ucycles, usuffix, kcycles, ksuffix); 1049 1077 1050 1078 if (ret == NULL) { … … 1061 1089 uint32_t i; 1062 1090 bool ret = true; 1063 uint64_t cycles;1064 char suffix;1091 uint64_t ucycles, kcycles; 1092 char usuffix, ksuffix; 1065 1093 1066 1094 if (cnt < 1) … … 1080 1108 ipl_t ipl = interrupts_disable(); 1081 1109 spinlock_lock(&TASK->lock); 1082 uint64_t t0 = task_get_accounting(TASK); 1110 uint64_t ucycles0, kcycles0; 1111 task_get_accounting(TASK, &ucycles0, &kcycles0); 1083 1112 spinlock_unlock(&TASK->lock); 1084 1113 interrupts_restore(ipl); … … 1086 1115 /* Execute the test */ 1087 1116 test_quiet = true; 1088 c har *ret = test->entry();1117 const char *ret = test->entry(); 1089 1118 1090 1119 /* Update and read thread accounting */ 1091 1120 ipl = interrupts_disable(); 1092 1121 spinlock_lock(&TASK->lock); 1093 uint64_t dt = task_get_accounting(TASK) - t0; 1122 uint64_t ucycles1, kcycles1; 1123 task_get_accounting(TASK, &ucycles1, &kcycles1); 1094 1124 spinlock_unlock(&TASK->lock); 1095 1125 interrupts_restore(ipl); 1096 1126 1097 1127 if (ret != NULL) { 1098 1128 printf("%s\n", ret); … … 1101 1131 } 1102 1132 1103 data[i] = dt; 1104 order(dt, &cycles, &suffix); 1105 printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix); 1133 data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0; 1134 order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix); 1135 order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix); 1136 printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n", 1137 ucycles, usuffix, kcycles, ksuffix); 1106 1138 } 1107 1139 … … 1115 1147 } 1116 1148 1117 order (sum / (uint64_t) cnt, &cycles, &suffix);1118 printf("Average\t\t%" PRIu64 "%c\n", cycles,suffix);1149 order_suffix(sum / (uint64_t) cnt, &ucycles, &usuffix); 1150 printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix); 1119 1151 } 1120 1152
Note:
See TracChangeset
for help on using the changeset viewer.