Changeset bfe4a88b in mainline


Ignore:
Timestamp:
2025-05-10T14:07:54Z (4 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
287b2ea
Parents:
7e68d61
Message:

bdwrite: measure and print elapsed time

File:
1 edited

Legend:

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

    r7e68d61 rbfe4a88b  
    11/*
    2  * Copyright (c) 2024 Miroslav Cimerman
     2 * Copyright (c) 2025 Miroslav Cimerman
    33 * All rights reserved.
    44 *
     
    4141#include <stdio.h>
    4242#include <abi/ipc/ipc.h>
     43#include <perf.h>
    4344
    4445static void usage(void);
     
    113114                goto end;
    114115        }
     116
     117        stopwatch_t stopwatch;
     118        stopwatch_init(&stopwatch);
     119        stopwatch_start(&stopwatch);
     120
    115121        uint64_t left = blkcnt;
    116122        while (left != 0) {
     
    131137        }
    132138end:
     139        stopwatch_stop(&stopwatch);
     140        nsec_t t = stopwatch_get_nanos(&stopwatch);
     141        printf("Elapsed time:\n");
     142        printf("\t%llu ms\n", NSEC2MSEC(t));
     143        printf("\t%lf s\n", NSEC2SEC((double)t));
    133144        free(buf);
    134145        block_fini(dev);
Note: See TracChangeset for help on using the changeset viewer.