Handle integer overflow of the op_stat_count
parent
2c3e84cc41
commit
19f25c7cd5
|
@ -155,7 +155,6 @@ json11::Json osd_t::get_statistics()
|
|||
st["free"] = bs->get_free_block_count() * bs->get_block_size();
|
||||
}
|
||||
st["host"] = self_state["host"];
|
||||
// FIXME: handle integer overflow
|
||||
json11::Json::object op_stats, subop_stats;
|
||||
for (int i = 0; i <= OSD_OP_MAX; i++)
|
||||
{
|
||||
|
|
|
@ -247,6 +247,11 @@ resume_5:
|
|||
{
|
||||
int recovery_type = op_data->object_state->state & (OBJ_DEGRADED|OBJ_INCOMPLETE) ? 0 : 1;
|
||||
recovery_stat_count[0][recovery_type]++;
|
||||
if (recovery_stat_count[0][recovery_type])
|
||||
{
|
||||
recovery_stat_count[0][recovery_type]++;
|
||||
recovery_stat_bytes[0][recovery_type] = 0;
|
||||
}
|
||||
for (int role = 0; role < pg.pg_size; role++)
|
||||
{
|
||||
recovery_stat_bytes[0][recovery_type] += op_data->stripes[role].write_end - op_data->stripes[role].write_start;
|
||||
|
|
|
@ -212,6 +212,12 @@ void osd_t::add_bs_subop_stats(osd_op_t *subop)
|
|||
timespec tv_end;
|
||||
clock_gettime(CLOCK_REALTIME, &tv_end);
|
||||
op_stat_count[0][opcode]++;
|
||||
if (!op_stat_count[0][opcode])
|
||||
{
|
||||
op_stat_count[0][opcode] = 1;
|
||||
op_stat_sum[0][opcode] = 0;
|
||||
op_stat_bytes[0][opcode] = 0;
|
||||
}
|
||||
op_stat_sum[0][opcode] += (
|
||||
(tv_end.tv_sec - subop->tv_begin.tv_sec)*1000000 +
|
||||
(tv_end.tv_nsec - subop->tv_begin.tv_nsec)/1000
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -40,6 +40,12 @@ bool osd_t::try_send(osd_client_t & cl)
|
|||
// Measure execution latency
|
||||
timespec tv_end = cl.write_op->tv_send;
|
||||
op_stat_count[0][cl.write_op->req.hdr.opcode]++;
|
||||
if (!op_stat_count[0][cl.write_op->req.hdr.opcode])
|
||||
{
|
||||
op_stat_count[0][cl.write_op->req.hdr.opcode]++;
|
||||
op_stat_sum[0][cl.write_op->req.hdr.opcode] = 0;
|
||||
op_stat_bytes[0][cl.write_op->req.hdr.opcode] = 0;
|
||||
}
|
||||
op_stat_sum[0][cl.write_op->req.hdr.opcode] += (
|
||||
(tv_end.tv_sec - cl.write_op->tv_begin.tv_sec)*1000000 +
|
||||
(tv_end.tv_nsec - cl.write_op->tv_begin.tv_nsec)/1000
|
||||
|
|
Loading…
Reference in New Issue