mirror of
https://github.com/facebook/rocksdb.git
synced 2024-12-02 20:52:55 +00:00
80c663882a
Summary: First draft. Unit tests pass. Test Plan: unit tests attached Reviewers: heyongqiang Reviewed By: heyongqiang Differential Revision: https://reviews.facebook.net/D3969
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#ifndef THRIFT_SERVER_TNONBLOCKINGSERVEROBSERVER_H_
|
|
#define THRIFT_SERVER_TNONBLOCKINGSERVEROBSERVER_H_ 1
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace apache { namespace thrift { namespace server {
|
|
|
|
class TNonblockingServerObserver {
|
|
public:
|
|
|
|
virtual ~TNonblockingServerObserver() {}
|
|
|
|
TNonblockingServerObserver() : sampleRate_(0) {}
|
|
TNonblockingServerObserver(uint32_t sampleRate) : sampleRate_(sampleRate) {}
|
|
|
|
class CallTimestamps {
|
|
public:
|
|
uint64_t readBegin;
|
|
uint64_t readEnd;
|
|
uint64_t processBegin;
|
|
uint64_t processEnd;
|
|
uint64_t writeBegin;
|
|
uint64_t writeEnd;
|
|
|
|
CallTimestamps() {
|
|
init();
|
|
}
|
|
|
|
void init() {
|
|
readBegin = readEnd = 0;
|
|
processBegin = processEnd = 0;
|
|
writeBegin = writeEnd = 0;
|
|
}
|
|
|
|
};
|
|
|
|
// Notifications for various events on the TNonblockingServer
|
|
virtual void connDropped() = 0;
|
|
|
|
virtual void taskKilled() = 0;
|
|
|
|
virtual void callCompleted(const CallTimestamps& runtimes) = 0;
|
|
|
|
// The observer has to specify a sample rate for callCompleted notifications
|
|
inline uint32_t getSampleRate() const {
|
|
return sampleRate_;
|
|
}
|
|
|
|
protected:
|
|
uint32_t sampleRate_;
|
|
};
|
|
|
|
}}} // apache::thrift::server
|
|
#endif
|