Two minor bug fixes from recent optimizations

This commit is contained in:
mpilman 2019-07-31 19:14:11 -07:00
parent f33969c9d4
commit 7d247af500
7 changed files with 56 additions and 40 deletions

View File

@ -186,6 +186,7 @@ else()
endif()
# Check whether we can use dtrace probes
include(CheckSymbolExists)
check_symbol_exists(DTRACE_PROBE sys/sdt.h SUPPORT_DTRACE)
if(SUPPORT_DTRACE)
add_compile_definitions(DTRACE_PROBES)

View File

@ -31,6 +31,7 @@
#include "fdbclient/CommitTransaction.h"
#include "flow/Stats.h"
#include "fdbrpc/Stats.h"
struct MasterProxyInterface {
constexpr static FileIdentifier file_identifier = 8954922;
@ -132,7 +133,7 @@ struct CommitTransactionRequest : TimedRequest {
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, transaction, reply, arena, flags, debugID, static_cast<TimedRequest&>(*this));
serializer(ar, transaction, reply, arena, flags, debugID);
}
};
@ -189,7 +190,7 @@ struct GetReadVersionRequest : TimedRequest {
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, transactionCount, flags, debugID, reply, static_cast<TimedRequest&>(*this));
serializer(ar, transactionCount, flags, debugID, reply);
}
};

View File

@ -28,6 +28,7 @@
#include "fdbrpc/fdbrpc.h"
#include "fdbrpc/LoadBalance.actor.h"
#include "flow/Stats.h"
#include "fdbrpc/Stats.h"
struct StorageServerInterface {
constexpr static FileIdentifier file_identifier = 15302073;
@ -135,7 +136,7 @@ struct GetValueRequest : TimedRequest {
template <class Ar>
void serialize( Ar& ar ) {
serializer(ar, key, version, debugID, reply, static_cast<TimedRequest&>(*this));
serializer(ar, key, version, debugID, reply);
}
};
@ -185,7 +186,7 @@ struct GetKeyValuesRequest : TimedRequest {
// GetKeyValuesRequest(const KeySelectorRef& begin, const KeySelectorRef& end, Version version, int limit, int limitBytes, Optional<UID> debugID) : begin(begin), end(end), version(version), limit(limit), limitBytes(limitBytes) {}
template <class Ar>
void serialize( Ar& ar ) {
serializer(ar, begin, end, version, limit, limitBytes, isFetchKeys, debugID, reply, arena, static_cast<TimedRequest&>(*this));
serializer(ar, begin, end, version, limit, limitBytes, isFetchKeys, debugID, reply, arena);
}
};
@ -214,7 +215,7 @@ struct GetKeyRequest : TimedRequest {
template <class Ar>
void serialize( Ar& ar ) {
serializer(ar, sel, version, reply, arena, static_cast<TimedRequest&>(*this));
serializer(ar, sel, version, reply, arena);
}
};

View File

@ -26,6 +26,7 @@ set(FDBRPC_SRCS
ReplicationUtils.cpp
sim2.actor.cpp
sim_validation.cpp
Stats.h
TLSConnection.actor.cpp
TraceFileIO.cpp)

46
fdbrpc/Stats.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Stats.h
*
* This source file is part of the FoundationDB open source project
*
* Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FDBRPC_STATS_H
#define FDBRPC_STATS_H
#pragma once
#include <fdbrpc/fdbrpc.h>
class TimedRequest {
double _requestTime;
public:
double requestTime() const {
ASSERT(_requestTime > 0.0);
return _requestTime;
}
TimedRequest() {
if (FlowTransport::isClient()) {
_requestTime = timer();
} else {
_requestTime = 0.0;
}
}
};
#endif

View File

@ -86,6 +86,7 @@
<ActorCompiler Include="networksender.actor.h">
<EnableCompile>false</EnableCompile>
</ActorCompiler>
<ClInclude Include="Stats.h" />
<ClInclude Include="IAsyncFile.h" />
<ClInclude Include="IRateControl.h" />
<ClInclude Include="Platform.h" />

View File

@ -38,41 +38,6 @@ MyCounters() : foo("foo", cc), bar("bar", cc), baz("baz", cc) {}
#include "flow/flow.h"
#include "flow/TDMetric.actor.h"
struct TimedRequest {
void setRequestTime(double requestTime_) { this->requestTime_ = requestTime_; }
double requestTime() const {
ASSERT(requestTime_ > 0);
return requestTime_;
}
private:
double requestTime_ = 0.0;
};
template <>
struct scalar_traits<TimedRequest> : std::true_type {
constexpr static size_t size = 0;
template <class Context>
static void save(uint8_t*, const TimedRequest&, Context&) {
}
// Context is an arbitrary type that is plumbed by reference throughout the
// load call tree.
template <class Context>
static void load(const uint8_t*, TimedRequest& value, Context&) {
value.setRequestTime(timer());
}
};
template <class Archive>
inline void load(Archive& ar, TimedRequest& value) {
value.setRequestTime(timer());
}
template <class Archive>
inline void save( Archive& ar, const TimedRequest& value ) {
}
struct ICounter {
// All counters have a name and value
virtual std::string const& getName() const = 0;