6 #ifndef swcdb_common_Stats_FlowRate_h
7 #define swcdb_common_Stats_FlowRate_h
11 namespace SWC {
namespace Common {
namespace Stats {
namespace FlowRate {
13 static const size_t KB = 1024;
14 static const size_t MB =
KB * 1024;
15 static const size_t GB =
MB * 1024;
16 static const size_t TB =
GB * 1024;
17 static const size_t PB =
TB * 1024;
25 Data(
size_t in_bytes,
size_t in_ns) {
31 }
else if(in_ns < 10000000) {
32 time = double(in_ns)/1000;
34 }
else if(in_ns <= 10000000000) {
35 time = (double(in_ns)/1000)/1000;
37 }
else if(in_ns <= 3600000000000) {
38 time = (double(in_ns)/1000000)/1000;
40 }
else if(in_ns <= 86400000000000) {
41 time = (double(in_ns)/60000000)/1000;
44 time = (double(in_ns)/3600000000)/1000;
51 }
else if(in_bytes <=
GB ) {
54 }
else if(in_bytes <=
TB) {
57 }
else if(in_bytes <=
PB) {
70 size_t resend_cells)
const {
71 out <<
"Statistics:\n"
73 <<
" Total Cells Count: " << cells_count <<
"\n"
77 out <<
" Resend Cells Count: " << resend_cells <<
"\n";
79 out <<
" Average Transfer Rate: " <<
bytes/
time <<
" "
81 <<
" Average Cells Rate: " << (cells_count ? cells_count/
time : 0)
91 #endif // swcdb_common_Stats_FlowRate_h