mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-03-03 21:20:27 +00:00
Stats, tweak P2P success rate stat.
This commit is contained in:
parent
1f9456a462
commit
5e8d49de0f
@ -1165,7 +1165,10 @@ int main(int argc,char **argv)
|
|||||||
}
|
}
|
||||||
std::sort(sp.begin(),sp.end(),[](const SharedPtr<RootPeer> &a,const SharedPtr<RootPeer> &b) { return (a->id < b->id); });
|
std::sort(sp.begin(),sp.end(),[](const SharedPtr<RootPeer> &a,const SharedPtr<RootPeer> &b) { return (a->id < b->id); });
|
||||||
|
|
||||||
char ip4[128],ip6[128];
|
fprintf(pf,"Address %21s %45s %10s %6s %10s" ZT_EOL_S,"IPv6","IPv4","Age(sec)","Vers","Fwd(KiB/s)");
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lf_l(s_lastForwardedTo_l);
|
||||||
|
char ip4[128],ip6[128],ver[128];
|
||||||
for(auto p=sp.begin();p!=sp.end();++p) {
|
for(auto p=sp.begin();p!=sp.end();++p) {
|
||||||
if ((*p)->ip4) {
|
if ((*p)->ip4) {
|
||||||
(*p)->ip4.toString(ip4);
|
(*p)->ip4.toString(ip4);
|
||||||
@ -1179,7 +1182,19 @@ int main(int argc,char **argv)
|
|||||||
ip6[0] = '-';
|
ip6[0] = '-';
|
||||||
ip6[1] = 0;
|
ip6[1] = 0;
|
||||||
}
|
}
|
||||||
fprintf(pf,"%.10llx %21s %45s %5.4f %d.%d.%d" ZT_EOL_S,(unsigned long long)(*p)->id.address().toInt(),ip4,ip6,fabs((double)(now - (*p)->lastReceive) / 1000.0),(*p)->vMajor,(*p)->vMinor,(*p)->vRev);
|
OSUtils::ztsnprintf(ver,sizeof(ver),"%d.%d.%d",(*p)->vMajor,(*p)->vMinor,(*p)->vRev);
|
||||||
|
double forwardingSpeed = 0.0;
|
||||||
|
auto lft = s_lastForwardedTo.find((*p)->id.address());
|
||||||
|
if (lft != s_lastForwardedTo.end())
|
||||||
|
forwardingSpeed = lft->second.bps.perSecond(now) / 1024.0;
|
||||||
|
fprintf(pf,"%.10llx %21s %45s %5.4f %6s %5.4f" ZT_EOL_S,
|
||||||
|
(unsigned long long)(*p)->id.address().toInt(),
|
||||||
|
ip4,
|
||||||
|
ip6,
|
||||||
|
fabs((double)(now - (*p)->lastReceive) / 1000.0),
|
||||||
|
ver,
|
||||||
|
forwardingSpeed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(pf);
|
fclose(pf);
|
||||||
@ -1206,7 +1221,7 @@ int main(int argc,char **argv)
|
|||||||
s_lastSentRendezvous_l.lock();
|
s_lastSentRendezvous_l.lock();
|
||||||
uint64_t unsuccessfulp2p = 0;
|
uint64_t unsuccessfulp2p = 0;
|
||||||
for(auto lr=s_lastSentRendezvous.begin();lr!=s_lastSentRendezvous.end();++lr) {
|
for(auto lr=s_lastSentRendezvous.begin();lr!=s_lastSentRendezvous.end();++lr) {
|
||||||
if (lr->second.count > 3)
|
if (lr->second.count > 6) // 6 == two attempts per edge, one for each direction
|
||||||
++unsuccessfulp2p;
|
++unsuccessfulp2p;
|
||||||
}
|
}
|
||||||
fprintf(sf,"Recent P2P Graph Edges : %llu" ZT_EOL_S,(unsigned long long)s_lastSentRendezvous.size());
|
fprintf(sf,"Recent P2P Graph Edges : %llu" ZT_EOL_S,(unsigned long long)s_lastSentRendezvous.size());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user