Changeset bd41ac52 in mainline for uspace/app/bnchmark/bnchmark.c
- Timestamp:
- 2018-08-25T22:21:25Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cca80a2
- Parents:
- e2625b1a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bnchmark/bnchmark.c
re2625b1a rbd41ac52 56 56 57 57 typedef errno_t (*measure_func_t)(void *); 58 typedef unsigned long umseconds_t; /* milliseconds */59 58 60 59 static void syntax_print(void); 61 60 62 static errno_t measure(measure_func_t fn, void *data, umseconds_t *result)63 { 64 struct time valstart_time;65 get timeofday(&start_time, NULL);61 static errno_t measure(measure_func_t fn, void *data, msec_t *result) 62 { 63 struct timespec start_time; 64 getuptime(&start_time); 66 65 67 66 errno_t rc = fn(data); … … 71 70 } 72 71 73 struct time valfinal_time;74 get timeofday(&final_time, NULL);72 struct timespec final_time; 73 getuptime(&final_time); 75 74 76 75 /* Calculate time difference in milliseconds */ 77 *result = ((final_time.tv_usec - start_time.tv_usec) / 1000) + 78 ((final_time.tv_sec - start_time.tv_sec) * 1000); 76 *result = NSEC2USEC(ts_sub_diff(&final_time, &start_time)); 79 77 return EOK; 80 78 } … … 133 131 { 134 132 errno_t rc; 135 umseconds_t milliseconds_taken = 0;133 msec_t milliseconds_taken = 0; 136 134 char *path = NULL; 137 135 measure_func_t fn = NULL; … … 194 192 } 195 193 196 printf("%s;%s;%s;%l u;ms\n", test_type, path, log_str, milliseconds_taken);194 printf("%s;%s;%s;%lld;ms\n", test_type, path, log_str, milliseconds_taken); 197 195 } 198 196
Note:
See TracChangeset
for help on using the changeset viewer.