Restored "GET /1/summary" endpoint.

This commit is contained in:
XMRig 2019-07-19 02:24:37 +07:00
parent 691b2fabbf
commit d9164c0b7b
14 changed files with 199 additions and 108 deletions

View file

@ -29,9 +29,10 @@
#include <stdio.h>
#include "backend/common/Hashrate.h"
#include "base/tools/Chrono.h"
#include "base/tools/Handle.h"
#include "backend/common/Hashrate.h"
#include "rapidjson/document.h"
inline static const char *format(double h, char *buf, size_t size)
@ -162,3 +163,15 @@ const char *xmrig::Hashrate::format(double h, char *buf, size_t size)
{
return ::format(h, buf, size);
}
rapidjson::Value xmrig::Hashrate::normalize(double d)
{
using namespace rapidjson;
if (!std::isnormal(d)) {
return Value(kNullType);
}
return Value(floor(d * 100.0) / 100.0);
}

View file

@ -30,6 +30,9 @@
#include <stdint.h>
#include "rapidjson/fwd.h"
namespace xmrig {
@ -53,6 +56,7 @@ public:
inline size_t threads() const { return m_threads; }
static const char *format(double h, char *buf, size_t size);
static rapidjson::Value normalize(double d);
private:
constexpr static size_t kBucketSize = 2 << 11;