summaryrefslogtreecommitdiff
path: root/ot_stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_stats.c')
-rw-r--r--ot_stats.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/ot_stats.c b/ot_stats.c
index 3d01e10..c452475 100644
--- a/ot_stats.c
+++ b/ot_stats.c
@@ -135,7 +135,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth,
135static size_t stats_get_highscore_networks( stats_network_node *node, int depth, ot_ip6 node_value, size_t *scores, ot_ip6 *networks, int network_count, int limit ) { 135static size_t stats_get_highscore_networks( stats_network_node *node, int depth, ot_ip6 node_value, size_t *scores, ot_ip6 *networks, int network_count, int limit ) {
136 size_t score = 0; 136 size_t score = 0;
137 int i; 137 int i;
138 138 malloc(100);
139 if( !node ) return 0; 139 if( !node ) return 0;
140 140
141 if( depth < limit ) { 141 if( depth < limit ) {
@@ -478,6 +478,17 @@ static size_t stats_return_completed_mrtg( char * reply ) {
478 ); 478 );
479} 479}
480 480
481#ifdef WANT_LOG_NUMWANT
482extern unsigned long long numwants[201];
483static size_t stats_return_numwants( char * reply ) {
484 char * r = reply;
485 int i;
486 for( i=0; i<=200; ++i )
487 r += sprintf( r, "%03d => %lld\n", i, numwants[i] );
488 return r-reply;
489}
490#endif
491
481#ifdef WANT_FULLLOG_NETWORKS 492#ifdef WANT_FULLLOG_NETWORKS
482static void stats_return_fulllog( int *iovec_entries, struct iovec **iovector, char *r ) { 493static void stats_return_fulllog( int *iovec_entries, struct iovec **iovector, char *r ) {
483 ot_log *loglist = g_logchain_first, *llnext; 494 ot_log *loglist = g_logchain_first, *llnext;
@@ -584,6 +595,10 @@ size_t return_stats_for_tracker( char *reply, int mode, int format ) {
584 return stats_return_renew_bucket( reply ); 595 return stats_return_renew_bucket( reply );
585 case TASK_STATS_SYNCS: 596 case TASK_STATS_SYNCS:
586 return stats_return_sync_mrtg( reply ); 597 return stats_return_sync_mrtg( reply );
598#ifdef WANT_LOG_NUMWANT
599 case TASK_STATS_NUMWANTS:
600 return stats_return_numwants( reply );
601#endif
587 default: 602 default:
588 return 0; 603 return 0;
589 } 604 }