Changeset 0313ff0 in mainline for kernel/generic/src/console/cmd.c
- Timestamp:
- 2006-12-14T12:35:57Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- def5207
- Parents:
- cd896e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
rcd896e2 r0313ff0 57 57 #include <mm/tlb.h> 58 58 #include <arch/mm/tlb.h> 59 #include <mm/as.h> 59 60 #include <mm/frame.h> 60 61 #include <main/version.h> … … 859 860 } 860 861 861 static bool run_test(const test_t * test)862 { 863 printf("%s\t\t%s\n", test->name, test->desc);862 static void test_wrapper(void *arg) 863 { 864 test_t *test = (test_t *) arg; 864 865 865 866 /* Update and read thread accounting 866 867 for benchmarking */ 867 868 ipl_t ipl = interrupts_disable(); 868 spinlock_lock(&THREAD->lock); 869 thread_update_accounting(); 870 uint64_t t0 = THREAD->cycles; 871 spinlock_unlock(&THREAD->lock); 869 spinlock_lock(&TASK->lock); 870 uint64_t t0 = task_get_accounting(TASK); 871 spinlock_unlock(&TASK->lock); 872 872 interrupts_restore(ipl); 873 873 … … 877 877 /* Update and read thread accounting */ 878 878 ipl = interrupts_disable(); 879 spinlock_lock(&THREAD->lock); 880 thread_update_accounting(); 881 uint64_t dt = THREAD->cycles - t0; 882 spinlock_unlock(&THREAD->lock); 879 spinlock_lock(&TASK->lock); 880 uint64_t dt = task_get_accounting(TASK) - t0; 881 spinlock_unlock(&TASK->lock); 883 882 interrupts_restore(ipl); 884 883 … … 887 886 if (ret == NULL) { 888 887 printf("Test passed\n"); 889 return true; 888 // return true; 889 return; 890 890 } 891 891 892 892 printf("%s\n", ret); 893 return false; 893 // return false; 894 } 895 896 static bool run_test(const test_t *test) 897 { 898 printf("%s\t\t%s\n", test->name, test->desc); 899 900 /* Create separate task and thread 901 for the test */ 902 task_t *ta = task_create(AS_KERNEL, "test"); 903 if (ta == NULL) { 904 printf("Unable to create test task\n"); 905 return false; 906 } 907 908 thread_t *t = thread_create(test_wrapper, (void *) test, ta, 0, "test_main"); 909 if (t == NULL) { 910 printf("Unable to create test main thread\n"); 911 task_destroy(ta); 912 return false; 913 } 914 915 /* Run the test */ 916 thread_ready(t); 917 thread_join(t); 918 thread_detach(t); 919 920 return true; 894 921 } 895 922
Note:
See TracChangeset
for help on using the changeset viewer.