summaryrefslogtreecommitdiff
path: root/src/mongo/executor/remote_command_response.cpp
diff options
context:
space:
mode:
authorLaMont Nelson <lamont.nelson@mongodb.com>2020-07-25 02:06:01 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-05 16:56:01 +0000
commitb2c1fa4f121fdb6cdffa924b802271d68c3367a3 (patch)
tree6310ec0c55f64cd1b9c340c92e863390d4ea87fc /src/mongo/executor/remote_command_response.cpp
parent14ef67e5d039a491ef897edd49bd7d075a18029c (diff)
downloadmongo-b2c1fa4f121fdb6cdffa924b802271d68c3367a3.tar.gz
SERVER-49694: fix latency measurement in RSM; change latency measurement for command responses to Microseconds
Diffstat (limited to 'src/mongo/executor/remote_command_response.cpp')
-rw-r--r--src/mongo/executor/remote_command_response.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/mongo/executor/remote_command_response.cpp b/src/mongo/executor/remote_command_response.cpp
index d069c0832dc..64e26295c87 100644
--- a/src/mongo/executor/remote_command_response.cpp
+++ b/src/mongo/executor/remote_command_response.cpp
@@ -35,6 +35,7 @@
#include "mongo/bson/simple_bsonobj_comparator.h"
#include "mongo/rpc/reply_interface.h"
+#include "mongo/util/duration.h"
#include "mongo/util/str.h"
namespace mongo {
@@ -45,22 +46,22 @@ RemoteCommandResponseBase::RemoteCommandResponseBase(ErrorCodes::Error code, std
RemoteCommandResponseBase::RemoteCommandResponseBase(ErrorCodes::Error code,
std::string reason,
- Milliseconds millis)
- : elapsedMillis(millis), status(code, reason) {}
+ Microseconds elapsed)
+ : elapsed(elapsed), status(code, reason) {}
RemoteCommandResponseBase::RemoteCommandResponseBase(Status s) : status(std::move(s)) {
invariant(!isOK());
};
-RemoteCommandResponseBase::RemoteCommandResponseBase(Status s, Milliseconds millis)
- : elapsedMillis(millis), status(std::move(s)) {
+RemoteCommandResponseBase::RemoteCommandResponseBase(Status s, Microseconds elapsed)
+ : elapsed(elapsed), status(std::move(s)) {
invariant(!isOK());
};
RemoteCommandResponseBase::RemoteCommandResponseBase(BSONObj dataObj,
- Milliseconds millis,
+ Microseconds elapsed,
bool moreToCome)
- : data(std::move(dataObj)), elapsedMillis(millis), moreToCome(moreToCome) {
+ : data(std::move(dataObj)), elapsed(elapsed), moreToCome(moreToCome) {
// The buffer backing the default empty BSONObj has static duration so it is effectively
// owned.
invariant(data.isOwned() || data.objdata() == BSONObj().objdata());
@@ -69,9 +70,9 @@ RemoteCommandResponseBase::RemoteCommandResponseBase(BSONObj dataObj,
// TODO(amidvidy): we currently discard output docs when we use this constructor. We should
// have RCR hold those too, but we need more machinery before that is possible.
RemoteCommandResponseBase::RemoteCommandResponseBase(const rpc::ReplyInterface& rpcReply,
- Milliseconds millis,
+ Microseconds elapsed,
bool moreToCome)
- : RemoteCommandResponseBase(rpcReply.getCommandReply(), std::move(millis), moreToCome) {}
+ : RemoteCommandResponseBase(rpcReply.getCommandReply(), std::move(elapsed), moreToCome) {}
bool RemoteCommandResponseBase::isOK() const {
return status.isOK();
@@ -81,11 +82,11 @@ std::string RemoteCommandResponse::toString() const {
return format(FMT_STRING("RemoteResponse --"
" cmd: {}"
" status: {}"
- " elapsedMillis: {}"
+ " elapsed: {}"
" moreToCome: {}"),
data.toString(),
status.toString(),
- elapsedMillis ? StringData(elapsedMillis->toString()) : "n/a"_sd,
+ elapsed ? StringData(elapsed->toString()) : "n/a"_sd,
moreToCome);
}
@@ -94,7 +95,7 @@ bool RemoteCommandResponse::operator==(const RemoteCommandResponse& rhs) const {
return true;
}
SimpleBSONObjComparator bsonComparator;
- return bsonComparator.evaluate(data == rhs.data) && elapsedMillis == rhs.elapsedMillis;
+ return bsonComparator.evaluate(data == rhs.data) && elapsed == rhs.elapsed;
}
bool RemoteCommandResponse::operator!=(const RemoteCommandResponse& rhs) const {
@@ -116,26 +117,26 @@ RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(boost::optional<HostAndPo
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(boost::optional<HostAndPort> hp,
ErrorCodes::Error code,
std::string reason,
- Milliseconds millis)
- : RemoteCommandResponseBase(code, std::move(reason), millis), target(std::move(hp)) {}
+ Microseconds elapsed)
+ : RemoteCommandResponseBase(code, std::move(reason), elapsed), target(std::move(hp)) {}
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(boost::optional<HostAndPort> hp, Status s)
: RemoteCommandResponseBase(std::move(s)), target(std::move(hp)) {}
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(boost::optional<HostAndPort> hp,
Status s,
- Milliseconds millis)
- : RemoteCommandResponseBase(std::move(s), millis), target(std::move(hp)) {}
+ Microseconds elapsed)
+ : RemoteCommandResponseBase(std::move(s), elapsed), target(std::move(hp)) {}
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(HostAndPort hp,
BSONObj dataObj,
- Milliseconds millis)
- : RemoteCommandResponseBase(std::move(dataObj), millis), target(std::move(hp)) {}
+ Microseconds elapsed)
+ : RemoteCommandResponseBase(std::move(dataObj), elapsed), target(std::move(hp)) {}
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(HostAndPort hp,
const rpc::ReplyInterface& rpcReply,
- Milliseconds millis)
- : RemoteCommandResponseBase(rpcReply, millis), target(std::move(hp)) {}
+ Microseconds elapsed)
+ : RemoteCommandResponseBase(rpcReply, elapsed), target(std::move(hp)) {}
RemoteCommandOnAnyResponse::RemoteCommandOnAnyResponse(boost::optional<HostAndPort> hp,
const RemoteCommandResponse& other)
@@ -146,7 +147,7 @@ bool RemoteCommandOnAnyResponse::operator==(const RemoteCommandOnAnyResponse& rh
return true;
}
SimpleBSONObjComparator bsonComparator;
- return bsonComparator.evaluate(data == rhs.data) && elapsedMillis == rhs.elapsedMillis &&
+ return bsonComparator.evaluate(data == rhs.data) && elapsed == rhs.elapsed &&
target == rhs.target;
}
@@ -159,12 +160,12 @@ std::string RemoteCommandOnAnyResponse::toString() const {
" cmd: {}"
" target: {}"
" status: {}"
- " elapsedMillis: {}"
+ " elapsedMicros: {}"
" moreToCome: {}"),
data.toString(),
target ? StringData(target->toString()) : "[none]"_sd,
status.toString(),
- elapsedMillis ? StringData(elapsedMillis.get().toString()) : "n/a"_sd,
+ elapsed ? StringData(elapsed.get().toString()) : "n/a"_sd,
moreToCome);
}