msg/async/ProtocolV2: cast usec to double when converting from nsec

to be consistent with the same logic in V1, and more importantly, it is
more correct.

the change was suggested by Ilya Dryomov <idryomov@redhat.com>.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
Kefu Chai 2021-10-07 06:38:13 +08:00
parent b2e806eedb
commit 8af0d76ca3

View File

@ -1437,7 +1437,7 @@ CtPtr ProtocolV2::handle_message() {
message->get_type() == CEPH_MSG_OSD_OPREPLY) {
utime_t ltt_processed_stamp = ceph_clock_now();
double usecs_elapsed =
(ltt_processed_stamp.to_nsec() - recv_stamp.to_nsec()) / 1000;
((double)(ltt_processed_stamp.to_nsec() - recv_stamp.to_nsec())) / 1000;
ostringstream buf;
if (message->get_type() == CEPH_MSG_OSD_OP)
OID_ELAPSED_WITH_MSG(message, usecs_elapsed, "TIME_TO_DECODE_OSD_OP",