Utilities: Use elapsed_milliseconds() instead of elapsed()

No behavior change.
This commit is contained in:
Nico Weber 2023-05-24 08:33:12 -04:00 committed by Andreas Kling
parent 197c5729d1
commit 6f2e62ba2a
Notes: sideshowbarker 2024-07-17 03:10:07 +09:00
3 changed files with 8 additions and 8 deletions

View file

@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
if (remaining_samples > 0) {
sample_timer = sample_timer.start_new();
auto samples = loader->get_more_samples(min(MAX_CHUNK_SIZE, remaining_samples));
total_loader_time += sample_timer.elapsed();
total_loader_time += sample_timer.elapsed_milliseconds();
if (!samples.is_error()) {
remaining_samples -= samples.value().size();
total_loaded_samples += samples.value().size();

View file

@ -64,7 +64,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
outln("failed.");
return 1;
}
outln("done in {}ms", timer.elapsed());
outln("done in {}ms", timer.elapsed_milliseconds());
auto pages = count / PAGE_SIZE;
auto step = pages / 10;
@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
ptr[i * PAGE_SIZE] = 1;
if (i != 0 && (i % step) == 0) {
auto ms = timer2.elapsed();
auto ms = timer2.elapsed_milliseconds();
if (ms == 0)
ms = 1;
@ -87,7 +87,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
timer2.start();
}
}
outln("done in {}ms", timer.elapsed());
outln("done in {}ms", timer.elapsed_milliseconds());
outln("sleeping for ten seconds...");
for (int i = 0; i < 10; i++) {
@ -99,7 +99,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
outln("freeing memory...");
timer.start();
free(ptr);
outln("done in {}ms", timer.elapsed());
outln("done in {}ms", timer.elapsed_milliseconds());
return 0;
}

View file

@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
usleep(100);
}
auto average = average_result(results);
outln("Finished: runs={} time={}ms write_bps={} read_bps={}", results.size(), timer.elapsed(), average.write_bps, average.read_bps);
outln("Finished: runs={} time={}ms write_bps={} read_bps={}", results.size(), timer.elapsed_milliseconds(), average.write_bps, average.read_bps);
sleep(1);
}
@ -129,7 +129,7 @@ ErrorOr<Result> benchmark(DeprecatedString const& filename, int file_size, ByteB
total_written += nwritten;
}
result.write_bps = (u64)(timer.elapsed() ? (file_size / timer.elapsed()) : file_size) * 1000;
result.write_bps = (u64)(timer.elapsed_milliseconds() ? (file_size / timer.elapsed_milliseconds()) : file_size) * 1000;
TRY(Core::System::lseek(fd, 0, SEEK_SET));
@ -140,6 +140,6 @@ ErrorOr<Result> benchmark(DeprecatedString const& filename, int file_size, ByteB
total_read += nread;
}
result.read_bps = (u64)(timer.elapsed() ? (file_size / timer.elapsed()) : file_size) * 1000;
result.read_bps = (u64)(timer.elapsed_milliseconds() ? (file_size / timer.elapsed_milliseconds()) : file_size) * 1000;
return result;
}