Changeset 6a585dd in mainline
- Timestamp:
- 2012-12-05T17:53:57Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 207e8880
- Parents:
- d22e567
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/rcubench/rcubench.c
rd22e567 r6a585dd 59 59 size_t iters; 60 60 size_t nthreads; 61 size_t array_size;62 size_t *array;63 61 futex_t done_threads; 64 62 … … 72 70 { 73 71 const size_t iters = bench->iters; 72 int val = 0; 74 73 75 74 for (size_t i = 0; i < iters; ++i) { 76 int val = 0;77 75 __SYSCALL1(SYS_FUTEX_WAKEUP, (sysarg_t) &val); 78 76 __SYSCALL1(SYS_FUTEX_SLEEP, (sysarg_t) &val); … … 181 179 static void print_usage(void) 182 180 { 183 printf("rcubench [test-name] [k-iterations] [n-threads] {work-size}\n");181 printf("rcubench [test-name] [k-iterations] [n-threads]\n"); 184 182 printf("Available tests: \n"); 185 183 printf(" sys-futex.. threads make wakeup/sleepdown futex syscalls in a loop\n"); … … 188 186 printf(" sema .. threads down/up separate futexes.\n"); 189 187 printf("eg:\n"); 190 printf(" rcubench ke-futex 100000 3 4\n");188 printf(" rcubench sys-futex 100000 3\n"); 191 189 printf(" rcubench lock 100000 2 ..runs futex_lock/unlock in a loop\n"); 192 190 printf(" rcubench sema 100000 2 ..runs futex_down/up in a loop\n"); … … 239 237 } 240 238 241 /* Set work array size. */242 if (argc > 4) {243 uint32_t work_size = 0;244 ret = str_uint32_t(argv[4], NULL, 0, true, &work_size);245 246 if (ret == EOK && work_size <= 10000) {247 bench->array_size = work_size;248 } else {249 *err = "Err: Work size too large";250 return false;251 }252 } else {253 bench->array_size = 0;254 }255 256 /* Allocate work array. */257 if (0 < bench->array_size) {258 bench->array = malloc(bench->array_size * sizeof(size_t));259 if (!bench->array) {260 *err = "Err: Failed to allocate work array";261 return false;262 }263 } else {264 bench->array = NULL;265 }266 267 239 return true; 268 240 }
Note:
See TracChangeset
for help on using the changeset viewer.