Make requestTime private

This commit is contained in:
Andrew Noyes 2019-07-31 16:22:12 -07:00
parent dabe516320
commit 1bad0fd44e
3 changed files with 18 additions and 8 deletions

View File

@ -1002,7 +1002,7 @@ ACTOR Future<Void> commitBatch(
// TODO: filter if pipelined with large commit
if(self->latencyBandConfig.present()) {
bool filter = maxTransactionBytes > self->latencyBandConfig.get().commitConfig.maxCommitBytes.orDefault(std::numeric_limits<int>::max());
self->stats.commitLatencyBands.addMeasurement(endTime - trs[t].requestTime, filter);
self->stats.commitLatencyBands.addMeasurement(endTime - trs[t].requestTime(), filter);
}
}
@ -1124,7 +1124,7 @@ ACTOR Future<Void> sendGrvReplies(Future<GetReadVersionReply> replyFuture, std::
GetReadVersionReply reply = wait(replyFuture);
double end = timer();
for(GetReadVersionRequest const& request : requests) {
stats->grvLatencyBands.addMeasurement(end - request.requestTime);
stats->grvLatencyBands.addMeasurement(end - request.requestTime());
request.reply.send(reply);
}

View File

@ -898,7 +898,7 @@ ACTOR Future<Void> getValueQ( StorageServer* data, GetValueRequest req ) {
--data->readQueueSizeMetric;
if(data->latencyBandConfig.present()) {
int maxReadBytes = data->latencyBandConfig.get().readConfig.maxReadBytes.orDefault(std::numeric_limits<int>::max());
data->counters.readLatencyBands.addMeasurement(timer()-req.requestTime, resultSize > maxReadBytes);
data->counters.readLatencyBands.addMeasurement(timer() - req.requestTime(), resultSize > maxReadBytes);
}
return Void();
@ -1452,7 +1452,9 @@ ACTOR Future<Void> getKeyValues( StorageServer* data, GetKeyValuesRequest req )
if(data->latencyBandConfig.present()) {
int maxReadBytes = data->latencyBandConfig.get().readConfig.maxReadBytes.orDefault(std::numeric_limits<int>::max());
int maxSelectorOffset = data->latencyBandConfig.get().readConfig.maxKeySelectorOffset.orDefault(std::numeric_limits<int>::max());
data->counters.readLatencyBands.addMeasurement(timer()-req.requestTime, resultSize > maxReadBytes || abs(req.begin.offset) > maxSelectorOffset || abs(req.end.offset) > maxSelectorOffset);
data->counters.readLatencyBands.addMeasurement(
timer() - req.requestTime(), resultSize > maxReadBytes || abs(req.begin.offset) > maxSelectorOffset ||
abs(req.end.offset) > maxSelectorOffset);
}
return Void();
@ -1508,7 +1510,8 @@ ACTOR Future<Void> getKey( StorageServer* data, GetKeyRequest req ) {
if(data->latencyBandConfig.present()) {
int maxReadBytes = data->latencyBandConfig.get().readConfig.maxReadBytes.orDefault(std::numeric_limits<int>::max());
int maxSelectorOffset = data->latencyBandConfig.get().readConfig.maxKeySelectorOffset.orDefault(std::numeric_limits<int>::max());
data->counters.readLatencyBands.addMeasurement(timer()-req.requestTime, resultSize > maxReadBytes || abs(req.sel.offset) > maxSelectorOffset);
data->counters.readLatencyBands.addMeasurement(
timer() - req.requestTime(), resultSize > maxReadBytes || abs(req.sel.offset) > maxSelectorOffset);
}
return Void();

View File

@ -39,7 +39,14 @@ MyCounters() : foo("foo", cc), bar("bar", cc), baz("baz", cc) {}
#include "flow/TDMetric.actor.h"
struct TimedRequest {
double requestTime = 0.0;
void setRequestTime(double requestTime_) { this->requestTime_ = requestTime_; }
double requestTime() const {
ASSERT(requestTime_ > 0);
return requestTime_;
}
private:
double requestTime_ = 0.0;
};
template <>
@ -53,13 +60,13 @@ struct scalar_traits<TimedRequest> : std::true_type {
// load call tree.
template <class Context>
static void load(const uint8_t*, TimedRequest& value, Context&) {
value.requestTime = timer();
value.setRequestTime(timer());
}
};
template <class Archive>
inline void load(Archive& ar, TimedRequest& value) {
value.requestTime = timer();
value.setRequestTime(timer());
}
template <class Archive>