Browse Source

DUMP FORMAT CHANGE: Include last successful poll time in dnsseed.dump

pull/1/head
Luke Dashjr 12 years ago
parent
commit
9856ac750e
  1. 2
      db.h
  2. 6
      main.cpp

2
db.h

@ -52,6 +52,7 @@ public:
int blocks; int blocks;
double uptime[5]; double uptime[5];
std::string clientSubVersion; std::string clientSubVersion;
int64_t lastSuccess;
}; };
@ -87,6 +88,7 @@ public:
ret.uptime[2] = stat1D.reliability; ret.uptime[2] = stat1D.reliability;
ret.uptime[3] = stat1W.reliability; ret.uptime[3] = stat1W.reliability;
ret.uptime[4] = stat1M.reliability; ret.uptime[4] = stat1M.reliability;
ret.lastSuccess = ourLastSuccess;
return ret; return ret;
} }

6
main.cpp

@ -1,5 +1,7 @@
#include <algorithm> #include <algorithm>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
@ -281,11 +283,11 @@ extern "C" void* ThreadDumper(void*) {
rename("dnsseed.dat.new", "dnsseed.dat"); rename("dnsseed.dat.new", "dnsseed.dat");
} }
FILE *d = fopen("dnsseed.dump", "w"); FILE *d = fopen("dnsseed.dump", "w");
fprintf(d, "# address \t%%(2h)\t%%(8h)\t%%(1d)\t%%(7d)\t%%(30d)\tblocks\tversion\n"); fprintf(d, "# address \tlastSuccess\t%%(2h)\t%%(8h)\t%%(1d)\t%%(7d)\t%%(30d)\tblocks\tversion\n");
double stat[5]={0,0,0,0,0}; double stat[5]={0,0,0,0,0};
for (vector<CAddrReport>::const_iterator it = v.begin(); it < v.end(); it++) { for (vector<CAddrReport>::const_iterator it = v.begin(); it < v.end(); it++) {
CAddrReport rep = *it; CAddrReport rep = *it;
fprintf(d, "%s\t%.2f%%\t%.2f%%\t%.2f%%\t%.2f%%\t%.2f%%\t%i\t%i \"%s\"\n", rep.ip.ToString().c_str(), 100.0*rep.uptime[0], 100.0*rep.uptime[1], 100.0*rep.uptime[2], 100.0*rep.uptime[3], 100.0*rep.uptime[4], rep.blocks, rep.clientVersion, rep.clientSubVersion.c_str()); fprintf(d, "%s\t%"PRId64"\t%.2f%%\t%.2f%%\t%.2f%%\t%.2f%%\t%.2f%%\t%i\t%i \"%s\"\n", rep.ip.ToString().c_str(), rep.lastSuccess, 100.0*rep.uptime[0], 100.0*rep.uptime[1], 100.0*rep.uptime[2], 100.0*rep.uptime[3], 100.0*rep.uptime[4], rep.blocks, rep.clientVersion, rep.clientSubVersion.c_str());
stat[0] += rep.uptime[0]; stat[0] += rep.uptime[0];
stat[1] += rep.uptime[1]; stat[1] += rep.uptime[1];
stat[2] += rep.uptime[2]; stat[2] += rep.uptime[2];

Loading…
Cancel
Save