Changes in kernel/generic/src/console/cmd.c [4ce914d4:cb3d641a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r4ce914d4 rcb3d641a 46 46 #include <print.h> 47 47 #include <panic.h> 48 #include < typedefs.h>48 #include <arch/types.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 .h>53 #include <string.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>69 68 #include <symtab.h> 70 69 #include <errno.h> … … 388 387 }; 389 388 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 = 0396 };397 398 389 /* Data and methods for 'zones' command */ 399 390 static int cmd_zones(cmd_arg_t *argv); … … 484 475 &set4_info, 485 476 &slabs_info, 486 &sysinfo_info,487 477 &symaddr_info, 488 478 &sched_info, … … 837 827 bool pointer = false; 838 828 int rc; 839 840 if (((char *) 829 830 if (((char *)argv->buffer)[0] == '*') { 841 831 rc = symtab_addr_lookup((char *) argv->buffer + 1, &addr); 842 832 pointer = true; 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 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 { 850 838 rc = symtab_addr_lookup((char *) argv->buffer, &addr); 851 839 } 840 852 841 if (rc == ENOENT) 853 842 printf("Symbol %s not found.\n", argv->buffer); 854 else if (rc == EINVAL)855 printf("Invalid address.\n");856 843 else if (rc == EOVERFLOW) { 857 844 symtab_print_search((char *) argv->buffer); 858 printf("Duplicate symbol (be more specific) or address overflow.\n");845 printf("Duplicate symbol, be more specific.\n"); 859 846 } else if (rc == EOK) { 860 847 if (pointer) … … 862 849 printf("Writing %#" PRIx64 " -> %p\n", arg1, addr); 863 850 *(uint32_t *) addr = arg1; 864 } else 851 } else { 865 852 printf("No symbol information available.\n"); 853 } 866 854 867 855 return 1; … … 880 868 } 881 869 882 /** Command for dumping sysinfo 870 871 /** Command for listings Thread information 883 872 * 884 873 * @param argv Ignores … … 886 875 * @return Always 1 887 876 */ 888 int cmd_sysinfo(cmd_arg_t * argv) 889 { 890 sysinfo_dump(NULL); 891 return 1; 892 } 893 877 int cmd_threads(cmd_arg_t * argv) 878 { 879 thread_print_list(); 880 return 1; 881 } 882 883 /** Command for listings Task information 884 * 885 * @param argv Ignores 886 * 887 * @return Always 1 888 */ 889 int cmd_tasks(cmd_arg_t * argv) 890 { 891 task_print_list(); 892 return 1; 893 } 894 894 895 895 /** Command for listings Thread information … … 899 899 * @return Always 1 900 900 */ 901 int cmd_threads(cmd_arg_t * argv)902 {903 thread_print_list();904 return 1;905 }906 907 /** Command for listings Task information908 *909 * @param argv Ignores910 *911 * @return Always 1912 */913 int cmd_tasks(cmd_arg_t * argv)914 {915 task_print_list();916 return 1;917 }918 919 /** Command for listings Thread information920 *921 * @param argv Ignores922 *923 * @return Always 1924 */925 901 int cmd_sched(cmd_arg_t * argv) 926 902 { … … 937 913 int cmd_zones(cmd_arg_t * argv) 938 914 { 939 zone s_print_list();915 zone_print_list(); 940 916 return 1; 941 917 } … … 1051 1027 ipl_t ipl = interrupts_disable(); 1052 1028 spinlock_lock(&TASK->lock); 1053 uint64_t ucycles0, kcycles0; 1054 task_get_accounting(TASK, &ucycles0, &kcycles0); 1029 uint64_t t0 = task_get_accounting(TASK); 1055 1030 spinlock_unlock(&TASK->lock); 1056 1031 interrupts_restore(ipl); … … 1058 1033 /* Execute the test */ 1059 1034 test_quiet = false; 1060 c onst char *ret = test->entry();1035 char *ret = test->entry(); 1061 1036 1062 1037 /* Update and read thread accounting */ 1063 uint64_t ucycles1, kcycles1;1064 1038 ipl = interrupts_disable(); 1065 1039 spinlock_lock(&TASK->lock); 1066 task_get_accounting(TASK, &ucycles1, &kcycles1);1040 uint64_t dt = task_get_accounting(TASK) - t0; 1067 1041 spinlock_unlock(&TASK->lock); 1068 1042 interrupts_restore(ipl); 1069 1043 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); 1044 uint64_t cycles; 1045 char suffix; 1046 order(dt, &cycles, &suffix); 1047 1048 printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix); 1077 1049 1078 1050 if (ret == NULL) { … … 1089 1061 uint32_t i; 1090 1062 bool ret = true; 1091 uint64_t ucycles, kcycles;1092 char usuffix, ksuffix;1063 uint64_t cycles; 1064 char suffix; 1093 1065 1094 1066 if (cnt < 1) … … 1108 1080 ipl_t ipl = interrupts_disable(); 1109 1081 spinlock_lock(&TASK->lock); 1110 uint64_t ucycles0, kcycles0; 1111 task_get_accounting(TASK, &ucycles0, &kcycles0); 1082 uint64_t t0 = task_get_accounting(TASK); 1112 1083 spinlock_unlock(&TASK->lock); 1113 1084 interrupts_restore(ipl); … … 1115 1086 /* Execute the test */ 1116 1087 test_quiet = true; 1117 c onst char *ret = test->entry();1088 char * ret = test->entry(); 1118 1089 1119 1090 /* Update and read thread accounting */ 1120 1091 ipl = interrupts_disable(); 1121 1092 spinlock_lock(&TASK->lock); 1122 uint64_t ucycles1, kcycles1; 1123 task_get_accounting(TASK, &ucycles1, &kcycles1); 1093 uint64_t dt = task_get_accounting(TASK) - t0; 1124 1094 spinlock_unlock(&TASK->lock); 1125 1095 interrupts_restore(ipl); 1126 1096 1127 1097 if (ret != NULL) { 1128 1098 printf("%s\n", ret); … … 1131 1101 } 1132 1102 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); 1103 data[i] = dt; 1104 order(dt, &cycles, &suffix); 1105 printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix); 1138 1106 } 1139 1107 … … 1147 1115 } 1148 1116 1149 order _suffix(sum / (uint64_t) cnt, &ucycles, &usuffix);1150 printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix);1117 order(sum / (uint64_t) cnt, &cycles, &suffix); 1118 printf("Average\t\t%" PRIu64 "%c\n", cycles, suffix); 1151 1119 } 1152 1120
Note:
See TracChangeset
for help on using the changeset viewer.