diff options
author | erdgeist <> | 2009-08-30 17:57:54 +0000 |
---|---|---|
committer | erdgeist <> | 2009-08-30 17:57:54 +0000 |
commit | 4c4303a15614404535d3be065d213ac8a992b530 (patch) | |
tree | e660f718a3176af0e97c42db6339bbb3b6527aba /ot_stats.c | |
parent | 517adde681d6aec49f359c4e7925641b1c86a075 (diff) |
Temporary feature: log amount of numwants. See if we can save traffic if we reduce max numwant to something less than 200
Diffstat (limited to 'ot_stats.c')
-rw-r--r-- | ot_stats.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -135,7 +135,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth, | |||
135 | static 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 ) { | 135 | static 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 | ||
482 | extern unsigned long long numwants[201]; | ||
483 | static 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 |
482 | static void stats_return_fulllog( int *iovec_entries, struct iovec **iovector, char *r ) { | 493 | static 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 | } |