summaryrefslogtreecommitdiff
path: root/src/rps/test_rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-04-04 08:04:40 +0200
committerJulius Bünger <buenger@mytum.de>2018-04-04 08:46:59 +0200
commit0d0a91e78153b98f6f7df13731d90e2ee52d22ad (patch)
tree8df7605a069e3b3b5dd31655384333490363838d /src/rps/test_rps.c
parente331d5f6dfb406f9c56d4b3cb69b671b317d6992 (diff)
downloadgnunet-0d0a91e78153b98f6f7df13731d90e2ee52d22ad.tar.gz
gnunet-0d0a91e78153b98f6f7df13731d90e2ee52d22ad.zip
rps profiler: fix logging of statistic values
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r--src/rps/test_rps.c84
1 files changed, 52 insertions, 32 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 93a406aaf..22f428e2e 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1968,11 +1968,14 @@ void write_final_stats (void){
1968 for (i = 0; i < num_peers; i++) 1968 for (i = 0; i < num_peers; i++)
1969 { 1969 {
1970 to_file ("/tmp/rps/final_stats.dat", 1970 to_file ("/tmp/rps/final_stats.dat",
1971 "%s %" PRIu64 1971 "%" PRIu32 " " /* index */
1972 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 /* blocking */ 1972 "%s %" /* id */
1973 " %" PRIu64 " %" PRIu64 " %" PRIu64 /* issued */ 1973 PRIu64 " %" /* rounds */
1974 " %" PRIu64 " %" PRIu64 " %" PRIu64 /* sent */ 1974 PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" /* blocking */
1975 " %" PRIu64 " %" PRIu64 " %" PRIu64 /* recv */, 1975 PRIu64 " %" PRIu64 " %" PRIu64 " %" /* issued */
1976 PRIu64 " %" PRIu64 " %" PRIu64 " %" /* sent */
1977 PRIu64 " %" PRIu64 " %" PRIu64 /* recv */,
1978 i,
1976 GNUNET_i2s (rps_peers[i].peer_id), 1979 GNUNET_i2s (rps_peers[i].peer_id),
1977 rps_peers[i].num_rounds, 1980 rps_peers[i].num_rounds,
1978 rps_peers[i].num_blocks, 1981 rps_peers[i].num_blocks,
@@ -2049,67 +2052,67 @@ post_test_shutdown_ready_cb (void *cls,
2049 */ 2052 */
2050enum STAT_TYPE stat_str_2_type (const char *stat_str) 2053enum STAT_TYPE stat_str_2_type (const char *stat_str)
2051{ 2054{
2052 if (GNUNET_YES == strncmp ("# rounds", stat_str, strlen ("# rounds"))) 2055 if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# rounds blocked - no pull replies")))
2053 { 2056 {
2054 return STAT_TYPE_ROUNDS; 2057 return STAT_TYPE_BLOCKS_NO_PULL;
2055 } 2058 }
2056 if (GNUNET_YES == strncmp ("# rounds blocked", stat_str, strlen ("# rounds blocked"))) 2059 else if (0 == strncmp ("# rounds blocked - too many pushes, no pull replies", stat_str, strlen ("# rounds blocked - too many pushes, no pull replies")))
2057 { 2060 {
2058 return STAT_TYPE_BLOCKS; 2061 return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL;
2059 } 2062 }
2060 if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, strlen ("# rounds blocked - too many pushes"))) 2063 else if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, strlen ("# rounds blocked - too many pushes")))
2061 { 2064 {
2062 return STAT_TYPE_BLOCKS_MANY_PUSH; 2065 return STAT_TYPE_BLOCKS_MANY_PUSH;
2063 } 2066 }
2064 if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# rounds blocked - no pushes"))) 2067 else if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", stat_str, strlen ("# rounds blocked - no pushes, no pull replies")))
2065 { 2068 {
2066 return STAT_TYPE_BLOCKS_NO_PUSH; 2069 return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL;
2067 } 2070 }
2068 if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# rounds blocked - no pull replies"))) 2071 else if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# rounds blocked - no pushes")))
2069 { 2072 {
2070 return STAT_TYPE_BLOCKS_NO_PULL; 2073 return STAT_TYPE_BLOCKS_NO_PUSH;
2071 } 2074 }
2072 if (0 == strncmp ("# rounds blocked - too many pushes, no pull replies", stat_str, strlen ("# rounds blocked - too many pushes, no pull replies"))) 2075 else if (0 == strncmp ("# rounds blocked", stat_str, strlen ("# rounds blocked")))
2073 { 2076 {
2074 return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL; 2077 return STAT_TYPE_BLOCKS;
2075 } 2078 }
2076 if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", stat_str, strlen ("# rounds blocked - no pushes, no pull replies"))) 2079 else if (0 == strncmp ("# rounds", stat_str, strlen ("# rounds")))
2077 { 2080 {
2078 return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL; 2081 return STAT_TYPE_ROUNDS;
2079 } 2082 }
2080 if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send issued"))) 2083 else if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send issued")))
2081 { 2084 {
2082 return STAT_TYPE_ISSUED_PUSH_SEND; 2085 return STAT_TYPE_ISSUED_PUSH_SEND;
2083 } 2086 }
2084 if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# pull request send issued"))) 2087 else if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# pull request send issued")))
2085 { 2088 {
2086 return STAT_TYPE_ISSUED_PULL_REQ; 2089 return STAT_TYPE_ISSUED_PULL_REQ;
2087 } 2090 }
2088 if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull reply send issued"))) 2091 else if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull reply send issued")))
2089 { 2092 {
2090 return STAT_TYPE_ISSUED_PULL_REP; 2093 return STAT_TYPE_ISSUED_PULL_REP;
2091 } 2094 }
2092 if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent"))) 2095 else if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent")))
2093 { 2096 {
2094 return STAT_TYPE_SENT_PUSH_SEND; 2097 return STAT_TYPE_SENT_PUSH_SEND;
2095 } 2098 }
2096 if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull requests sent"))) 2099 else if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull requests sent")))
2097 { 2100 {
2098 return STAT_TYPE_SENT_PULL_REQ; 2101 return STAT_TYPE_SENT_PULL_REQ;
2099 } 2102 }
2100 if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull replys sent"))) 2103 else if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull replys sent")))
2101 { 2104 {
2102 return STAT_TYPE_SENT_PULL_REP; 2105 return STAT_TYPE_SENT_PULL_REP;
2103 } 2106 }
2104 if (0 == strncmp ("# push message received", stat_str, strlen ("# push message received"))) 2107 else if (0 == strncmp ("# push message received", stat_str, strlen ("# push message received")))
2105 { 2108 {
2106 return STAT_TYPE_RECV_PUSH_SEND; 2109 return STAT_TYPE_RECV_PUSH_SEND;
2107 } 2110 }
2108 if (0 == strncmp ("# pull request message received", stat_str, strlen ("# pull request message received"))) 2111 else if (0 == strncmp ("# pull request message received", stat_str, strlen ("# pull request message received")))
2109 { 2112 {
2110 return STAT_TYPE_RECV_PULL_REQ; 2113 return STAT_TYPE_RECV_PULL_REQ;
2111 } 2114 }
2112 if (0 == strncmp ("# pull reply messages received", stat_str, strlen ("# pull reply messages received"))) 2115 else if (0 == strncmp ("# pull reply messages received", stat_str, strlen ("# pull reply messages received")))
2113 { 2116 {
2114 return STAT_TYPE_RECV_PULL_REP; 2117 return STAT_TYPE_RECV_PULL_REP;
2115 } 2118 }
@@ -2191,49 +2194,66 @@ stat_iterator (void *cls,
2191 //stat_type_2_str (stat_cls->stat_type), 2194 //stat_type_2_str (stat_cls->stat_type),
2192 name, 2195 name,
2193 value); 2196 value);
2194 //to_file (rps_peer->file_name_stats, 2197 to_file (rps_peer->file_name_stats,
2195 // "%s: %" PRIu64 "\n", 2198 "%s: %" PRIu64 "\n",
2196 // name, 2199 name,
2197 // value); 2200 value);
2198 switch (stat_str_2_type (name)) 2201 switch (stat_str_2_type (name))
2199 { 2202 {
2200 case STAT_TYPE_ROUNDS: 2203 case STAT_TYPE_ROUNDS:
2201 rps_peer->num_blocks = value; 2204 rps_peer->num_rounds = value;
2205 break;
2202 case STAT_TYPE_BLOCKS: 2206 case STAT_TYPE_BLOCKS:
2203 rps_peer->num_blocks = value; 2207 rps_peer->num_blocks = value;
2208 break;
2204 case STAT_TYPE_BLOCKS_MANY_PUSH: 2209 case STAT_TYPE_BLOCKS_MANY_PUSH:
2205 rps_peer->num_blocks_many_push = value; 2210 rps_peer->num_blocks_many_push = value;
2211 break;
2206 case STAT_TYPE_BLOCKS_NO_PUSH: 2212 case STAT_TYPE_BLOCKS_NO_PUSH:
2207 rps_peer->num_blocks_no_push = value; 2213 rps_peer->num_blocks_no_push = value;
2214 break;
2208 case STAT_TYPE_BLOCKS_NO_PULL: 2215 case STAT_TYPE_BLOCKS_NO_PULL:
2209 rps_peer->num_blocks_no_pull = value; 2216 rps_peer->num_blocks_no_pull = value;
2217 break;
2210 case STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL: 2218 case STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL:
2211 rps_peer->num_blocks_many_push_no_pull = value; 2219 rps_peer->num_blocks_many_push_no_pull = value;
2220 break;
2212 case STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL: 2221 case STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL:
2213 rps_peer->num_blocks_no_push_no_pull = value; 2222 rps_peer->num_blocks_no_push_no_pull = value;
2223 break;
2214 case STAT_TYPE_ISSUED_PUSH_SEND: 2224 case STAT_TYPE_ISSUED_PUSH_SEND:
2215 rps_peer->num_issued_push = value; 2225 rps_peer->num_issued_push = value;
2226 break;
2216 case STAT_TYPE_ISSUED_PULL_REQ: 2227 case STAT_TYPE_ISSUED_PULL_REQ:
2217 rps_peer->num_issued_pull_req = value; 2228 rps_peer->num_issued_pull_req = value;
2229 break;
2218 case STAT_TYPE_ISSUED_PULL_REP: 2230 case STAT_TYPE_ISSUED_PULL_REP:
2219 rps_peer->num_issued_pull_rep = value; 2231 rps_peer->num_issued_pull_rep = value;
2232 break;
2220 case STAT_TYPE_SENT_PUSH_SEND: 2233 case STAT_TYPE_SENT_PUSH_SEND:
2221 rps_peer->num_sent_push = value; 2234 rps_peer->num_sent_push = value;
2235 break;
2222 case STAT_TYPE_SENT_PULL_REQ: 2236 case STAT_TYPE_SENT_PULL_REQ:
2223 rps_peer->num_sent_pull_req = value; 2237 rps_peer->num_sent_pull_req = value;
2238 break;
2224 case STAT_TYPE_SENT_PULL_REP: 2239 case STAT_TYPE_SENT_PULL_REP:
2225 rps_peer->num_sent_pull_rep = value; 2240 rps_peer->num_sent_pull_rep = value;
2241 break;
2226 case STAT_TYPE_RECV_PUSH_SEND: 2242 case STAT_TYPE_RECV_PUSH_SEND:
2227 rps_peer->num_recv_push = value; 2243 rps_peer->num_recv_push = value;
2244 break;
2228 case STAT_TYPE_RECV_PULL_REQ: 2245 case STAT_TYPE_RECV_PULL_REQ:
2229 rps_peer->num_recv_pull_req = value; 2246 rps_peer->num_recv_pull_req = value;
2247 break;
2230 case STAT_TYPE_RECV_PULL_REP: 2248 case STAT_TYPE_RECV_PULL_REP:
2231 rps_peer->num_recv_pull_rep = value; 2249 rps_peer->num_recv_pull_rep = value;
2250 break;
2232 case STAT_TYPE_MAX: 2251 case STAT_TYPE_MAX:
2233 default: 2252 default:
2234 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2253 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2235 "Unknown statistics string: %s\n", 2254 "Unknown statistics string: %s\n",
2236 name); 2255 name);
2256 break;
2237 } 2257 }
2238 return GNUNET_OK; 2258 return GNUNET_OK;
2239} 2259}