Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bnchmark/bnchmark.c

    r205f1add r1433ecda  
    5656
    5757typedef errno_t (*measure_func_t)(void *);
     58typedef unsigned long umseconds_t; /* milliseconds */
    5859
    5960static void syntax_print(void);
    6061
    61 static errno_t measure(measure_func_t fn, void *data, msec_t *result)
    62 {
    63         struct timespec start_time;
    64         getuptime(&start_time);
     62static errno_t measure(measure_func_t fn, void *data, umseconds_t *result)
     63{
     64        struct timeval start_time;
     65        gettimeofday(&start_time, NULL);
    6566
    6667        errno_t rc = fn(data);
     
    7071        }
    7172
    72         struct timespec final_time;
    73         getuptime(&final_time);
     73        struct timeval final_time;
     74        gettimeofday(&final_time, NULL);
    7475
    7576        /* Calculate time difference in milliseconds */
    76         *result = NSEC2USEC(ts_sub_diff(&final_time, &start_time));
     77        *result = ((final_time.tv_usec - start_time.tv_usec) / 1000) +
     78            ((final_time.tv_sec - start_time.tv_sec) * 1000);
    7779        return EOK;
    7880}
     
    131133{
    132134        errno_t rc;
    133         msec_t milliseconds_taken = 0;
     135        umseconds_t milliseconds_taken = 0;
    134136        char *path = NULL;
    135137        measure_func_t fn = NULL;
     
    192194                }
    193195
    194                 printf("%s;%s;%s;%lld;ms\n", test_type, path, log_str, milliseconds_taken);
     196                printf("%s;%s;%s;%lu;ms\n", test_type, path, log_str, milliseconds_taken);
    195197        }
    196198
Note: See TracChangeset for help on using the changeset viewer.