Measure OP_STAB in both ways

test-sq-poll
Vitaliy Filippov 2020-03-03 02:18:59 +03:00
parent 2575431176
commit 2a5ca4ff6f
2 changed files with 14 additions and 20 deletions

View File

@ -50,7 +50,7 @@ osd_t::osd_t(blockstore_config_t & config, blockstore_t *bs, ring_loop_t *ringlo
} }
if (send_stat_count != 0) if (send_stat_count != 0)
{ {
printf("avg latency to send subops with data: %ld us\n", send_stat_sum/send_stat_count); printf("avg latency to send stabilize subop: %ld us\n", send_stat_sum/send_stat_count);
send_stat_count = 0; send_stat_count = 0;
send_stat_sum = 0; send_stat_sum = 0;
} }

View File

@ -34,15 +34,11 @@ bool osd_t::try_send(osd_client_t & cl)
cl.write_op = cl.outbox.front(); cl.write_op = cl.outbox.front();
cl.outbox.pop_front(); cl.outbox.pop_front();
cl.write_state = CL_WRITE_REPLY; cl.write_state = CL_WRITE_REPLY;
if (cl.write_op->op_type == OSD_OP_OUT) clock_gettime(CLOCK_REALTIME, &cl.write_op->tv_send);
{ if (cl.write_op->op_type == OSD_OP_IN)
clock_gettime(CLOCK_REALTIME, &cl.write_op->tv_send);
}
else
{ {
// Measure execution latency // Measure execution latency
timespec tv_end; timespec tv_end = cl.write_op->tv_send;
clock_gettime(CLOCK_REALTIME, &tv_end);
op_stat_count[cl.write_op->req.hdr.opcode]++; op_stat_count[cl.write_op->req.hdr.opcode]++;
op_stat_sum[cl.write_op->req.hdr.opcode] += ( op_stat_sum[cl.write_op->req.hdr.opcode] += (
(tv_end.tv_sec - cl.write_op->tv_begin.tv_sec)*1000000 + (tv_end.tv_sec - cl.write_op->tv_begin.tv_sec)*1000000 +
@ -105,24 +101,22 @@ void osd_t::handle_send(ring_data_t *data, int peer_fd)
if (cur_op->send_list.sent >= cur_op->send_list.count) if (cur_op->send_list.sent >= cur_op->send_list.count)
{ {
// Done // Done
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE)
{
timespec tv_end;
clock_gettime(CLOCK_REALTIME, &tv_end);
send_stat_count++;
send_stat_sum += (
(tv_end.tv_sec - cl.write_op->tv_send.tv_sec)*1000000 +
(tv_end.tv_nsec - cl.write_op->tv_send.tv_nsec)/1000
);
}
if (cur_op->op_type == OSD_OP_IN) if (cur_op->op_type == OSD_OP_IN)
{ {
delete cur_op; delete cur_op;
} }
else else
{ {
// Measure subops with data
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
{
timespec tv_end;
clock_gettime(CLOCK_REALTIME, &tv_end);
send_stat_count++;
send_stat_sum += (
(tv_end.tv_sec - cl.write_op->tv_send.tv_sec)*1000000 +
(tv_end.tv_nsec - cl.write_op->tv_send.tv_nsec)/1000
);
}
cl.sent_ops[cl.write_op->req.hdr.id] = cl.write_op; cl.sent_ops[cl.write_op->req.hdr.id] = cl.write_op;
} }
cl.write_op = NULL; cl.write_op = NULL;