diff options
Diffstat (limited to 'src/plugins/stats/functions.c')
-rw-r--r-- | src/plugins/stats/functions.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c index 71d46e08..d8a459aa 100644 --- a/src/plugins/stats/functions.c +++ b/src/plugins/stats/functions.c | |||
@@ -167,16 +167,21 @@ getQuotaStat (const void *closure, gfloat ** data) | |||
167 | unsigned long long allowed; | 167 | unsigned long long allowed; |
168 | unsigned long long have; | 168 | unsigned long long have; |
169 | 169 | ||
170 | if (GNUNET_OK != getStatValue (&allowed, | 170 | data[0][0] = 0; |
171 | NULL, NULL, "# bytes allowed in datastore", | 171 | data[0][1] = 0; |
172 | GNUNET_NO)) | 172 | if ( (GNUNET_OK == getStatValue (&allowed, |
173 | return GNUNET_SYSERR; | 173 | NULL, NULL, "# bytes allowed in datastore", |
174 | if (allowed == 0) | 174 | GNUNET_NO)) && |
175 | return GNUNET_SYSERR; | 175 | (allowed != 0) && |
176 | if (GNUNET_OK != | 176 | (GNUNET_OK == getStatValue (&have, NULL, NULL, "# bytes in datastore", GNUNET_NO)) ) |
177 | getStatValue (&have, NULL, NULL, "# bytes in datastore", GNUNET_NO)) | 177 | data[0][0] = ((gfloat) have) / allowed; |
178 | return GNUNET_SYSERR; | 178 | if ( (GNUNET_OK == getStatValue (&allowed, |
179 | data[0][0] = ((gfloat) have) / allowed; | 179 | NULL, NULL, "# max bytes allowed in dstore", |
180 | GNUNET_NO)) && | ||
181 | (allowed != 0) && | ||
182 | (GNUNET_OK == | ||
183 | getStatValue (&have, NULL, NULL, "# bytes in dstore", GNUNET_NO)) ) | ||
184 | data[0][1] = ((gfloat) have) / allowed; | ||
180 | return GNUNET_OK; | 185 | return GNUNET_OK; |
181 | } | 186 | } |
182 | 187 | ||
@@ -665,10 +670,10 @@ StatEntry stats[] = { | |||
665 | , | 670 | , |
666 | { | 671 | { |
667 | gettext_noop ("Datastore capacity"), | 672 | gettext_noop ("Datastore capacity"), |
668 | gettext_noop ("Data in datastore (in percent of allowed quota)"), | 673 | gettext_noop ("Persistent file-sharing data (red) and DHT cache (green)"), |
669 | &getQuotaStat, | 674 | &getQuotaStat, |
670 | NULL, | 675 | NULL, |
671 | 1, | 676 | 2, |
672 | GNUNET_NO, | 677 | GNUNET_NO, |
673 | } | 678 | } |
674 | , | 679 | , |