diff options
author | Christian Grothoff <christian@grothoff.org> | 2005-07-09 00:00:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2005-07-09 00:00:14 +0000 |
commit | 066ce74af38bc19a5270052b93e313f4dcf31e00 (patch) | |
tree | c4e07de5c5fe60c0ceae83d9b95253c6c63ee762 | |
parent | d3a1f2ed5070ae5a1d279a4c948d5bc0a6cf7705 (diff) | |
download | gnunet-gtk-066ce74af38bc19a5270052b93e313f4dcf31e00.tar.gz gnunet-gtk-066ce74af38bc19a5270052b93e313f4dcf31e00.zip |
up
-rw-r--r-- | src/plugins/stats/functions.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c index ed21dcd3..d4695ddd 100644 --- a/src/plugins/stats/functions.c +++ b/src/plugins/stats/functions.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <GNUnet/gnunet_protocols.h> | 26 | #include <GNUnet/gnunet_protocols.h> |
27 | #include "functions.h" | 27 | #include "functions.h" |
28 | 28 | ||
29 | #define FUNCTIONS_DEBUG NO | ||
30 | |||
29 | static StatPair * lastStatValues; | 31 | static StatPair * lastStatValues; |
30 | 32 | ||
31 | static unsigned int lsv_size; | 33 | static unsigned int lsv_size; |
@@ -52,6 +54,11 @@ static int getStatValue(long long * value, | |||
52 | return OK; | 54 | return OK; |
53 | } | 55 | } |
54 | } | 56 | } |
57 | #if FUNCTIONS_DEBUG | ||
58 | LOG(LOG_DEBUG, | ||
59 | "Statistic not found: '%s'\n", | ||
60 | optName); | ||
61 | #endif | ||
55 | return SYSERR; | 62 | return SYSERR; |
56 | } | 63 | } |
57 | 64 | ||
@@ -71,7 +78,8 @@ static int getConnectedNodesStat(const void * closure, | |||
71 | if (OK != getStatValue(&val, | 78 | if (OK != getStatValue(&val, |
72 | NULL, | 79 | NULL, |
73 | NULL, | 80 | NULL, |
74 | _("# currently connected nodes"))) | 81 | dgettext("GNUnet", |
82 | "# of connected peers"))) | ||
75 | return SYSERR; | 83 | return SYSERR; |
76 | data[0][0] = 0.8 * val / cval; | 84 | data[0][0] = 0.8 * val / cval; |
77 | return OK; | 85 | return OK; |
@@ -84,7 +92,8 @@ static int getCPULoadStat(const void * closure, | |||
84 | if (OK != getStatValue(&val, | 92 | if (OK != getStatValue(&val, |
85 | NULL, | 93 | NULL, |
86 | NULL, | 94 | NULL, |
87 | _("% of allowed cpu load"))) | 95 | dgettext("GNUnet", |
96 | "% of allowed cpu load"))) | ||
88 | return SYSERR; | 97 | return SYSERR; |
89 | data[0][0] = val / 125.0; | 98 | data[0][0] = val / 125.0; |
90 | return OK; | 99 | return OK; |
@@ -101,8 +110,6 @@ static int getTrafficRecvStats(const void * closure, | |||
101 | long long lcontent; | 110 | long long lcontent; |
102 | long long lqueries; | 111 | long long lqueries; |
103 | long long band; | 112 | long long band; |
104 | long long tmp; | ||
105 | long long ltmp; | ||
106 | cron_t dtime; | 113 | cron_t dtime; |
107 | char * available; | 114 | char * available; |
108 | char * buffer; | 115 | char * buffer; |
@@ -111,38 +118,41 @@ static int getTrafficRecvStats(const void * closure, | |||
111 | if (OK != getStatValue(&total, | 118 | if (OK != getStatValue(&total, |
112 | <otal, | 119 | <otal, |
113 | &dtime, | 120 | &dtime, |
114 | _("# bytes decrypted"))) | 121 | dgettext("GNUnet", |
122 | "# bytes decrypted"))) | ||
115 | return SYSERR; | 123 | return SYSERR; |
116 | if (OK != getStatValue(&noise, | 124 | if (OK != getStatValue(&noise, |
117 | &lnoise, | 125 | &lnoise, |
118 | NULL, | 126 | NULL, |
119 | _("# bytes of noise received"))) | 127 | dgettext("GNUnet", |
128 | "# bytes of noise received"))) | ||
120 | return SYSERR; | 129 | return SYSERR; |
121 | i = 0; | 130 | i = 0; |
122 | content = lcontent = 0; | ||
123 | buffer = MALLOC(512); | 131 | buffer = MALLOC(512); |
124 | SNPRINTF(buffer, | 132 | SNPRINTF(buffer, |
125 | 512, | 133 | 512, |
126 | _("# bytes received of type %d"), | 134 | dgettext("GNUnet", |
135 | "# bytes received of type %d"), | ||
127 | GAP_p2p_PROTO_RESULT); | 136 | GAP_p2p_PROTO_RESULT); |
128 | if (OK == getStatValue(&tmp, | 137 | if (OK != getStatValue(&content, |
129 | <mp, | 138 | &lcontent, |
130 | NULL, | 139 | NULL, |
131 | buffer)) { | 140 | buffer)) { |
132 | content += tmp; | 141 | content += 0; |
133 | lcontent += ltmp; | 142 | lcontent += 0; |
134 | } | 143 | } |
135 | i = 0; | 144 | i = 0; |
136 | SNPRINTF(buffer, | 145 | SNPRINTF(buffer, |
137 | 512, | 146 | 512, |
138 | _("# bytes received of type %d"), | 147 | dgettext("GNUnet", |
148 | "# bytes received of type %d"), | ||
139 | GAP_p2p_PROTO_QUERY); | 149 | GAP_p2p_PROTO_QUERY); |
140 | if (OK == getStatValue(&tmp, | 150 | if (OK != getStatValue(&queries, |
141 | <mp, | 151 | &lqueries, |
142 | NULL, | 152 | NULL, |
143 | buffer)) { | 153 | buffer)) { |
144 | queries += tmp; | 154 | queries = 0; |
145 | lqueries += ltmp; | 155 | lqueries = 0; |
146 | } | 156 | } |
147 | FREE(buffer); | 157 | FREE(buffer); |
148 | available = getConfigurationOptionValue(sock, | 158 | available = getConfigurationOptionValue(sock, |
@@ -186,8 +196,6 @@ static int getTrafficSendStats(const void * closure, | |||
186 | long long lcontent; | 196 | long long lcontent; |
187 | long long lqueries; | 197 | long long lqueries; |
188 | long long band; | 198 | long long band; |
189 | long long tmp; | ||
190 | long long ltmp; | ||
191 | cron_t dtime; | 199 | cron_t dtime; |
192 | char * available; | 200 | char * available; |
193 | char * buffer; | 201 | char * buffer; |
@@ -196,38 +204,41 @@ static int getTrafficSendStats(const void * closure, | |||
196 | if (OK != getStatValue(&total, | 204 | if (OK != getStatValue(&total, |
197 | <otal, | 205 | <otal, |
198 | &dtime, | 206 | &dtime, |
199 | _("# encrypted bytes sent"))) | 207 | dgettext("GNUnet", |
208 | "# bytes encrypted"))) | ||
200 | return SYSERR; | 209 | return SYSERR; |
201 | if (OK != getStatValue(&noise, | 210 | if (OK != getStatValue(&noise, |
202 | &lnoise, | 211 | &lnoise, |
203 | NULL, | 212 | NULL, |
204 | _("# bytes noise sent"))) | 213 | dgettext("GNUnet", |
214 | "# bytes noise sent"))) | ||
205 | return SYSERR; | 215 | return SYSERR; |
206 | i = 0; | 216 | i = 0; |
207 | content = lcontent = 0; | ||
208 | buffer = MALLOC(512); | 217 | buffer = MALLOC(512); |
209 | SNPRINTF(buffer, | 218 | SNPRINTF(buffer, |
210 | 512, | 219 | 512, |
211 | _("# bytes transmitted of type %d"), | 220 | dgettext("GNUnet", |
221 | "# bytes transmitted of type %d"), | ||
212 | GAP_p2p_PROTO_RESULT); | 222 | GAP_p2p_PROTO_RESULT); |
213 | if (OK == getStatValue(&tmp, | 223 | if (OK != getStatValue(&content, |
214 | <mp, | 224 | &lcontent, |
215 | NULL, | 225 | NULL, |
216 | buffer)) { | 226 | buffer)) { |
217 | content += tmp; | 227 | content = 0; |
218 | lcontent += ltmp; | 228 | lcontent = 0; |
219 | } | 229 | } |
220 | i = 0; | 230 | i = 0; |
221 | SNPRINTF(buffer, | 231 | SNPRINTF(buffer, |
222 | 512, | 232 | 512, |
223 | _("# bytes received of type %d"), | 233 | dgettext("GNUnet", |
234 | "# bytes received of type %d"), | ||
224 | GAP_p2p_PROTO_QUERY); | 235 | GAP_p2p_PROTO_QUERY); |
225 | if (OK == getStatValue(&tmp, | 236 | if (OK == getStatValue(&queries, |
226 | <mp, | 237 | &lqueries, |
227 | NULL, | 238 | NULL, |
228 | buffer)) { | 239 | buffer)) { |
229 | queries += tmp; | 240 | queries = 0; |
230 | lqueries += ltmp; | 241 | lqueries = 0; |
231 | } | 242 | } |
232 | FREE(buffer); | 243 | FREE(buffer); |
233 | available = getConfigurationOptionValue(sock, | 244 | available = getConfigurationOptionValue(sock, |