storaged: Avoid divide-by-zero in performance measurement
The code previously assumed that write() took a non-zero number of clock ticks. This is mostly true, but can't be guaranteed. Add a check to avoid crashing if it's 0. Bug: 233008287 Test: Compile Change-Id: Idec0052f534dc4abb81a414ca76f6c11f4a4dded
This commit is contained in:
parent
3a728ac7c6
commit
5a02a9bab9
1 changed files with 1 additions and 1 deletions
|
|
@ -333,7 +333,7 @@ void storaged_t::flush_proto_data(userid_t user_id,
|
|||
first_write = false;
|
||||
}
|
||||
|
||||
if (benchmark_size) {
|
||||
if (benchmark_size && benchmark_time_ns) {
|
||||
int perf = benchmark_size * 1000000LLU / benchmark_time_ns;
|
||||
storage_info->update_perf_history(perf, system_clock::now());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue