aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-12-01 21:47:40 -0500
committerB. Watson <urchlay@slackware.uk>2025-12-01 21:47:40 -0500
commit7d86cc5d2e0a188438626c9fcbb400850f848ba6 (patch)
treef3be59f4930eca2752989724150292d96d0f6017 /src
parent8f24787dda80d39733aba0950b2894986e574bfd (diff)
downloadalftools-7d86cc5d2e0a188438626c9fcbb400850f848ba6.tar.gz
alf: Fix elapsed time calculation (derp).
Diffstat (limited to 'src')
-rw-r--r--src/alf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/alf.c b/src/alf.c
index dcf9e4e..82c9432 100644
--- a/src/alf.c
+++ b/src/alf.c
@@ -254,15 +254,19 @@ float tv_to_float(struct timeval *tv) {
void print_elapsed_time(void) {
struct timeval end_time;
- float s, e;
+ float s, e, l, mbs;
gettimeofday(&end_time, 0);
end_time.tv_sec -= start_time.tv_sec;
start_time.tv_sec = 0;
+
s = tv_to_float(&start_time);
e = tv_to_float(&end_time);
+ l = e - s;
+
+ mbs = ((float)total_in) / (1048576.0) / l;
- printf("Elapsed time: %.3fs\n", e - s);
+ printf("Elapsed time: %.3fs (%.2fMB/s).\n", l, mbs);
}
int main(int argc, char **argv) {