aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-21 09:17:55 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-21 09:17:55 +0000
commit783afef9032983d0e0feea713b8d1f114469f7a8 (patch)
treef2af8c46ca189b788cbedc144432125d9d9f7b59 /src/fs
parent4d9e0b97f00721bc72f5cd1918ca15cbd79a67d7 (diff)
downloadgnunet-783afef9032983d0e0feea713b8d1f114469f7a8.tar.gz
gnunet-783afef9032983d0e0feea713b8d1f114469f7a8.zip
cleaner stats
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 5064da90b..9ba722c3c 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -69,6 +69,11 @@
69 */ 69 */
70#define FS_DHT_HT_SIZE 1024 70#define FS_DHT_HT_SIZE 1024
71 71
72/**
73 * At what frequency should our datastore load decrease
74 * automatically (since if we don't use it, clearly the
75 * load must be going down).
76 */
72#define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250) 77#define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
73 78
74/** 79/**
@@ -2262,25 +2267,9 @@ test_get_load_too_high (uint32_t priority)
2262 2267
2263 ld = GNUNET_LOAD_get_load (datastore_get_load); 2268 ld = GNUNET_LOAD_get_load (datastore_get_load);
2264 if (ld < 1) 2269 if (ld < 1)
2265 { 2270 return GNUNET_SYSERR;
2266 GNUNET_STATISTICS_update (stats, 2271 if (ld <= priority)
2267 gettext_noop ("# requests done for free (low load)"), 2272 return GNUNET_NO;
2268 1,
2269 GNUNET_NO);
2270 return GNUNET_SYSERR;
2271 }
2272 if (ld <= priority)
2273 {
2274 GNUNET_STATISTICS_update (stats,
2275 gettext_noop ("# requests done for a price (normal load)"),
2276 1,
2277 GNUNET_NO);
2278 return GNUNET_NO;
2279 }
2280 GNUNET_STATISTICS_update (stats,
2281 gettext_noop ("# priority determined to be high"),
2282 1,
2283 GNUNET_NO);
2284 return GNUNET_YES; 2273 return GNUNET_YES;
2285} 2274}
2286 2275
@@ -3845,7 +3834,13 @@ bound_priority (uint32_t prio_in,
3845 3834
3846 ld = test_get_load_too_high (0); 3835 ld = test_get_load_too_high (0);
3847 if (ld == GNUNET_SYSERR) 3836 if (ld == GNUNET_SYSERR)
3848 return 0; /* excess resources */ 3837 {
3838 GNUNET_STATISTICS_update (stats,
3839 gettext_noop ("# requests done for free (low load)"),
3840 1,
3841 GNUNET_NO);
3842 return 0; /* excess resources */
3843 }
3849 ret = change_host_trust (cp, prio_in); 3844 ret = change_host_trust (cp, prio_in);
3850 if (ret > 0) 3845 if (ret > 0)
3851 { 3846 {
@@ -3863,11 +3858,22 @@ bound_priority (uint32_t prio_in,
3863 } 3858 }
3864 if (ld == GNUNET_YES) 3859 if (ld == GNUNET_YES)
3865 { 3860 {
3861 GNUNET_STATISTICS_update (stats,
3862 gettext_noop ("# request dropped, priority insufficient"),
3863 1,
3864 GNUNET_NO);
3866 /* undo charge */ 3865 /* undo charge */
3867 if (ret != 0) 3866 if (ret != 0)
3868 change_host_trust (cp, -ret); 3867 change_host_trust (cp, -ret);
3869 return -1; /* not enough resources */ 3868 return -1; /* not enough resources */
3870 } 3869 }
3870 else
3871 {
3872 GNUNET_STATISTICS_update (stats,
3873 gettext_noop ("# requests done for a price (normal load)"),
3874 1,
3875 GNUNET_NO);
3876 }
3871#undef N 3877#undef N
3872 return ret; 3878 return ret;
3873} 3879}