diff options
author | Julius Bünger <buenger@mytum.de> | 2019-02-28 09:24:17 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-02-28 09:25:04 +0100 |
commit | 799e269d52cb5acdfa2828d2c3f010d07ccca0bb (patch) | |
tree | 20a7431593b1c06392b8c6cf36f6a21a43402ef0 /src/rps | |
parent | bcb5e8d91393d99ea26128f8d5e0261fe6adccc4 (diff) | |
download | gnunet-799e269d52cb5acdfa2828d2c3f010d07ccca0bb.tar.gz gnunet-799e269d52cb5acdfa2828d2c3f010d07ccca0bb.zip |
RPS: Disable too happy writing to disk
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 1f9f7ba79..63d4c1865 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -354,16 +354,20 @@ struct Sub | |||
354 | */ | 354 | */ |
355 | struct RPS_Sampler *sampler; | 355 | struct RPS_Sampler *sampler; |
356 | 356 | ||
357 | #ifdef TO_FILE_FULL | ||
357 | /** | 358 | /** |
358 | * Name to log view to | 359 | * Name to log view to |
359 | */ | 360 | */ |
360 | char *file_name_view_log; | 361 | char *file_name_view_log; |
362 | #endif /* TO_FILE_FULL */ | ||
361 | 363 | ||
362 | #ifdef TO_FILE | 364 | #ifdef TO_FILE |
365 | #ifdef TO_FILE_FULL | ||
363 | /** | 366 | /** |
364 | * Name to log number of observed peers to | 367 | * Name to log number of observed peers to |
365 | */ | 368 | */ |
366 | char *file_name_observed_log; | 369 | char *file_name_observed_log; |
370 | #endif /* TO_FILE_FULL */ | ||
367 | 371 | ||
368 | /** | 372 | /** |
369 | * @brief Count the observed peers | 373 | * @brief Count the observed peers |
@@ -2400,9 +2404,11 @@ hist_update (const struct GNUNET_PeerIdentity *ids, | |||
2400 | { | 2404 | { |
2401 | clients_notify_stream_peer (sub, 1, &ids[i]); | 2405 | clients_notify_stream_peer (sub, 1, &ids[i]); |
2402 | } | 2406 | } |
2407 | #ifdef TO_FILE_FULL | ||
2403 | to_file (sub->file_name_view_log, | 2408 | to_file (sub->file_name_view_log, |
2404 | "+%s\t(hist)", | 2409 | "+%s\t(hist)", |
2405 | GNUNET_i2s_full (ids)); | 2410 | GNUNET_i2s_full (ids)); |
2411 | #endif /* TO_FILE_FULL */ | ||
2406 | } | 2412 | } |
2407 | clients_notify_view_update (sub); | 2413 | clients_notify_view_update (sub); |
2408 | } | 2414 | } |
@@ -2605,11 +2611,13 @@ insert_in_sampler (void *cls, | |||
2605 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 2611 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
2606 | uint32_t num_observed_unique_peers = | 2612 | uint32_t num_observed_unique_peers = |
2607 | GNUNET_CONTAINER_multipeermap_size (sub->observed_unique_peers); | 2613 | GNUNET_CONTAINER_multipeermap_size (sub->observed_unique_peers); |
2614 | #ifdef TO_FILE_FULL | ||
2608 | to_file (sub->file_name_observed_log, | 2615 | to_file (sub->file_name_observed_log, |
2609 | "%" PRIu32 " %" PRIu32 " %f\n", | 2616 | "%" PRIu32 " %" PRIu32 " %f\n", |
2610 | sub->num_observed_peers, | 2617 | sub->num_observed_peers, |
2611 | num_observed_unique_peers, | 2618 | num_observed_unique_peers, |
2612 | 1.0*num_observed_unique_peers/sub->num_observed_peers) | 2619 | 1.0*num_observed_unique_peers/sub->num_observed_peers) |
2620 | #endif /* TO_FILE_FULL */ | ||
2613 | #endif /* TO_FILE */ | 2621 | #endif /* TO_FILE */ |
2614 | } | 2622 | } |
2615 | 2623 | ||
@@ -2905,10 +2913,14 @@ new_sub (const struct GNUNET_HashCode *hash, | |||
2905 | round_interval); | 2913 | round_interval); |
2906 | 2914 | ||
2907 | /* Logging of internals */ | 2915 | /* Logging of internals */ |
2916 | #ifdef TO_FILE_FULL | ||
2908 | sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); | 2917 | sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); |
2918 | #endif /* TO_FILE_FULL */ | ||
2909 | #ifdef TO_FILE | 2919 | #ifdef TO_FILE |
2920 | #ifdef TO_FILE_FULL | ||
2910 | sub->file_name_observed_log = store_prefix_file_name (&own_identity, | 2921 | sub->file_name_observed_log = store_prefix_file_name (&own_identity, |
2911 | "observed"); | 2922 | "observed"); |
2923 | #endif /* TO_FILE_FULL */ | ||
2912 | sub->num_observed_peers = 0; | 2924 | sub->num_observed_peers = 0; |
2913 | sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, | 2925 | sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, |
2914 | GNUNET_NO); | 2926 | GNUNET_NO); |
@@ -3007,11 +3019,15 @@ destroy_sub (struct Sub *sub) | |||
3007 | peers_terminate (sub); | 3019 | peers_terminate (sub); |
3008 | 3020 | ||
3009 | /* Free leftover data structures */ | 3021 | /* Free leftover data structures */ |
3022 | #ifdef TO_FILE_FULL | ||
3010 | GNUNET_free (sub->file_name_view_log); | 3023 | GNUNET_free (sub->file_name_view_log); |
3011 | sub->file_name_view_log = NULL; | 3024 | sub->file_name_view_log = NULL; |
3025 | #endif /* TO_FILE_FULL */ | ||
3012 | #ifdef TO_FILE | 3026 | #ifdef TO_FILE |
3027 | #ifdef TO_FILE_FULL | ||
3013 | GNUNET_free (sub->file_name_observed_log); | 3028 | GNUNET_free (sub->file_name_observed_log); |
3014 | sub->file_name_observed_log = NULL; | 3029 | sub->file_name_observed_log = NULL; |
3030 | #endif /* TO_FILE_FULL */ | ||
3015 | 3031 | ||
3016 | /* Write push frequencies to disk */ | 3032 | /* Write push frequencies to disk */ |
3017 | write_histogram_to_file (sub->push_recv, | 3033 | write_histogram_to_file (sub->push_recv, |
@@ -4183,18 +4199,20 @@ do_round (void *cls) | |||
4183 | GNUNET_STATISTICS_update (stats, "# rounds", 1, GNUNET_NO); | 4199 | GNUNET_STATISTICS_update (stats, "# rounds", 1, GNUNET_NO); |
4184 | } | 4200 | } |
4185 | sub->do_round_task = NULL; | 4201 | sub->do_round_task = NULL; |
4186 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 4202 | #ifdef TO_FILE_FULL |
4187 | "Printing view:\n"); | ||
4188 | to_file (sub->file_name_view_log, | 4203 | to_file (sub->file_name_view_log, |
4189 | "___ new round ___"); | 4204 | "___ new round ___"); |
4205 | #endif /* TO_FILE_FULL */ | ||
4190 | view_array = View_get_as_array (sub->view); | 4206 | view_array = View_get_as_array (sub->view); |
4191 | for (i = 0; i < View_size (sub->view); i++) | 4207 | for (i = 0; i < View_size (sub->view); i++) |
4192 | { | 4208 | { |
4193 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 4209 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
4194 | "\t%s\n", GNUNET_i2s (&view_array[i])); | 4210 | "\t%s\n", GNUNET_i2s (&view_array[i])); |
4211 | #ifdef TO_FILE_FULL | ||
4195 | to_file (sub->file_name_view_log, | 4212 | to_file (sub->file_name_view_log, |
4196 | "=%s\t(do round)", | 4213 | "=%s\t(do round)", |
4197 | GNUNET_i2s_full (&view_array[i])); | 4214 | GNUNET_i2s_full (&view_array[i])); |
4215 | #endif /* TO_FILE_FULL */ | ||
4198 | } | 4216 | } |
4199 | 4217 | ||
4200 | 4218 | ||
@@ -4269,8 +4287,10 @@ do_round (void *cls) | |||
4269 | 4287 | ||
4270 | /* Seems like recreating is the easiest way of emptying the peermap */ | 4288 | /* Seems like recreating is the easiest way of emptying the peermap */ |
4271 | View_clear (sub->view); | 4289 | View_clear (sub->view); |
4290 | #ifdef TO_FILE_FULL | ||
4272 | to_file (sub->file_name_view_log, | 4291 | to_file (sub->file_name_view_log, |
4273 | "--- emptied ---"); | 4292 | "--- emptied ---"); |
4293 | #endif /* TO_FILE_FULL */ | ||
4274 | 4294 | ||
4275 | first_border = GNUNET_MIN (ceil (alpha * sub->view_size_est_need), | 4295 | first_border = GNUNET_MIN (ceil (alpha * sub->view_size_est_need), |
4276 | CustomPeerMap_size (sub->push_map)); | 4296 | CustomPeerMap_size (sub->push_map)); |
@@ -4300,9 +4320,11 @@ do_round (void *cls) | |||
4300 | 1, | 4320 | 1, |
4301 | CustomPeerMap_get_peer_by_index (sub->push_map, permut[i])); | 4321 | CustomPeerMap_get_peer_by_index (sub->push_map, permut[i])); |
4302 | } | 4322 | } |
4323 | #ifdef TO_FILE_FULL | ||
4303 | to_file (sub->file_name_view_log, | 4324 | to_file (sub->file_name_view_log, |
4304 | "+%s\t(push list)", | 4325 | "+%s\t(push list)", |
4305 | GNUNET_i2s_full (&view_array[i])); | 4326 | GNUNET_i2s_full (&view_array[i])); |
4327 | #endif /* TO_FILE_FULL */ | ||
4306 | // TODO change the peer_flags accordingly | 4328 | // TODO change the peer_flags accordingly |
4307 | } | 4329 | } |
4308 | GNUNET_free (permut); | 4330 | GNUNET_free (permut); |
@@ -4324,9 +4346,11 @@ do_round (void *cls) | |||
4324 | CustomPeerMap_get_peer_by_index (sub->pull_map, | 4346 | CustomPeerMap_get_peer_by_index (sub->pull_map, |
4325 | permut[i - first_border])); | 4347 | permut[i - first_border])); |
4326 | } | 4348 | } |
4349 | #ifdef TO_FILE_FULL | ||
4327 | to_file (sub->file_name_view_log, | 4350 | to_file (sub->file_name_view_log, |
4328 | "+%s\t(pull list)", | 4351 | "+%s\t(pull list)", |
4329 | GNUNET_i2s_full (&view_array[i])); | 4352 | GNUNET_i2s_full (&view_array[i])); |
4353 | #endif /* TO_FILE_FULL */ | ||
4330 | // TODO change the peer_flags accordingly | 4354 | // TODO change the peer_flags accordingly |
4331 | } | 4355 | } |
4332 | GNUNET_free (permut); | 4356 | GNUNET_free (permut); |
@@ -4345,9 +4369,11 @@ do_round (void *cls) | |||
4345 | /* Clean peers that were removed from the view */ | 4369 | /* Clean peers that were removed from the view */ |
4346 | for (i = 0; i < peers_to_clean_size; i++) | 4370 | for (i = 0; i < peers_to_clean_size; i++) |
4347 | { | 4371 | { |
4372 | #ifdef TO_FILE_FULL | ||
4348 | to_file (sub->file_name_view_log, | 4373 | to_file (sub->file_name_view_log, |
4349 | "-%s", | 4374 | "-%s", |
4350 | GNUNET_i2s_full (&peers_to_clean[i])); | 4375 | GNUNET_i2s_full (&peers_to_clean[i])); |
4376 | #endif /* TO_FILE_FULL */ | ||
4351 | clean_peer (sub, &peers_to_clean[i]); | 4377 | clean_peer (sub, &peers_to_clean[i]); |
4352 | } | 4378 | } |
4353 | 4379 | ||