Handle integer overflow of the op_stat_count

This commit is contained in:
Vitaliy Filippov
2020-05-15 01:37:17 +03:00
parent 2c3e84cc41
commit 19f25c7cd5
5 changed files with 27 additions and 1 deletions
+10
View File
@@ -140,6 +140,11 @@ void osd_t::handle_finished_read(osd_client_t & cl)
timespec tv_end;
clock_gettime(CLOCK_REALTIME, &tv_end);
subop_stat_count[0][request->req.hdr.opcode]++;
if (!subop_stat_count[0][request->req.hdr.opcode])
{
subop_stat_count[0][request->req.hdr.opcode]++;
subop_stat_sum[0][request->req.hdr.opcode] = 0;
}
subop_stat_sum[0][request->req.hdr.opcode] += (
(tv_end.tv_sec - request->tv_begin.tv_sec)*1000000 +
(tv_end.tv_nsec - request->tv_begin.tv_nsec)/1000
@@ -252,6 +257,11 @@ void osd_t::handle_reply_hdr(osd_client_t *cl)
timespec tv_end;
clock_gettime(CLOCK_REALTIME, &tv_end);
subop_stat_count[0][op->req.hdr.opcode]++;
if (!subop_stat_count[0][op->req.hdr.opcode])
{
subop_stat_count[0][op->req.hdr.opcode]++;
subop_stat_sum[0][op->req.hdr.opcode] = 0;
}
subop_stat_sum[0][op->req.hdr.opcode] += (
(tv_end.tv_sec - op->tv_begin.tv_sec)*1000000 +
(tv_end.tv_nsec - op->tv_begin.tv_nsec)/1000