forked from vitalif/vitastor
Measure OP_STAB in both ways
parent
2575431176
commit
2a5ca4ff6f
2
osd.cpp
2
osd.cpp
|
@ -50,7 +50,7 @@ osd_t::osd_t(blockstore_config_t & config, blockstore_t *bs, ring_loop_t *ringlo
|
|||
}
|
||||
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_sum = 0;
|
||||
}
|
||||
|
|
32
osd_send.cpp
32
osd_send.cpp
|
@ -34,15 +34,11 @@ bool osd_t::try_send(osd_client_t & cl)
|
|||
cl.write_op = cl.outbox.front();
|
||||
cl.outbox.pop_front();
|
||||
cl.write_state = CL_WRITE_REPLY;
|
||||
if (cl.write_op->op_type == OSD_OP_OUT)
|
||||
{
|
||||
clock_gettime(CLOCK_REALTIME, &cl.write_op->tv_send);
|
||||
}
|
||||
else
|
||||
clock_gettime(CLOCK_REALTIME, &cl.write_op->tv_send);
|
||||
if (cl.write_op->op_type == OSD_OP_IN)
|
||||
{
|
||||
// Measure execution latency
|
||||
timespec tv_end;
|
||||
clock_gettime(CLOCK_REALTIME, &tv_end);
|
||||
timespec tv_end = cl.write_op->tv_send;
|
||||
op_stat_count[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 +
|
||||
|
@ -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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
delete cur_op;
|
||||
}
|
||||
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.write_op = NULL;
|
||||
|
|
Loading…
Reference in New Issue