1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

integrating the existing state of TON Storage / TON Payments / CPS Fift development branches

This commit is contained in:
ton 2020-05-27 22:10:46 +04:00
parent 040df63c98
commit 4e2624459b
153 changed files with 10760 additions and 1695 deletions

25
storage/LoadSpeed.h Normal file
View file

@ -0,0 +1,25 @@
#pragma once
#include "td/utils/StringBuilder.h"
#include "td/utils/Time.h"
#include "td/utils/VectorQueue.h"
namespace ton {
class LoadSpeed {
public:
void add(td::size_t size, td::Timestamp now);
double speed(td::Timestamp now = td::Timestamp::now()) const;
friend td::StringBuilder &operator<<(td::StringBuilder &sb, const LoadSpeed &speed);
private:
struct Event {
td::size_t size;
td::Timestamp at;
};
mutable td::VectorQueue<Event> events_;
mutable td::size_t total_size_{0};
double duration() const;
void update(td::Timestamp now) const;
};
} // namespace ton