Added connection statistics to API.
This commit is contained in:
parent
8e08df2fd2
commit
7798f09dc7
4 changed files with 96 additions and 9 deletions
|
@ -25,8 +25,8 @@
|
|||
#define __NETWORKSTATE_H__
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class SubmitResult;
|
||||
|
@ -35,20 +35,27 @@ class SubmitResult;
|
|||
class NetworkState
|
||||
{
|
||||
public:
|
||||
inline NetworkState() :
|
||||
diff(0),
|
||||
accepted(0),
|
||||
rejected(0),
|
||||
total(0)
|
||||
{}
|
||||
NetworkState();
|
||||
|
||||
int connectionTime() const;
|
||||
uint32_t avgTime() const;
|
||||
uint32_t latency() const;
|
||||
void add(const SubmitResult &result, const char *error);
|
||||
void setPool(const char *host, int port, const char *ip);
|
||||
void stop();
|
||||
|
||||
char pool[256];
|
||||
std::array<uint64_t, 10> topDiff { { } };
|
||||
uint32_t diff;
|
||||
uint64_t accepted;
|
||||
uint64_t failures;
|
||||
uint64_t rejected;
|
||||
uint64_t total;
|
||||
|
||||
private:
|
||||
bool m_active;
|
||||
std::vector<uint16_t> m_latency;
|
||||
uint64_t m_connectionTime;
|
||||
};
|
||||
|
||||
#endif /* __NETWORKSTATE_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue