aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-daemon-fsprofiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-daemon-fsprofiler.c')
-rw-r--r--src/fs/gnunet-daemon-fsprofiler.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c
index a19fa1ef6..d4c2b1c02 100644
--- a/src/fs/gnunet-daemon-fsprofiler.c
+++ b/src/fs/gnunet-daemon-fsprofiler.c
@@ -164,7 +164,7 @@ static struct Pattern *download_tail;
164 164
165 165
166/** 166/**
167 * Parse a pattern string and store the corresponding 167 * Parse a pattern string and store the corresponding
168 * 'struct Pattern' in the given head/tail. 168 * 'struct Pattern' in the given head/tail.
169 * 169 *
170 * @param head where to store the head 170 * @param head where to store the head
@@ -243,7 +243,7 @@ make_file (uint64_t length,
243 return NULL; 243 return NULL;
244 /* initialize data with 'unique' data only depending on 'kval' and 'size', 244 /* initialize data with 'unique' data only depending on 'kval' and 'size',
245 making sure that blocks do not repeat */ 245 making sure that blocks do not repeat */
246 for (i=0;i<length; i+=8) 246 for (i=0;i<length; i+=8)
247 { 247 {
248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024); 248 xor = length ^ kval ^ (uint64_t) (i / 32 / 1024);
249 memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t))); 249 memcpy (&data[i], &xor, GNUNET_MIN (length - i, sizeof (uint64_t)));
@@ -396,8 +396,8 @@ progress_cb (void *cls,
396 case GNUNET_FS_STATUS_PUBLISH_COMPLETED: 396 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
397 p = info->value.publish.cctx; 397 p = info->value.publish.cctx;
398 GNUNET_STATISTICS_update (stats_handle, 398 GNUNET_STATISTICS_update (stats_handle,
399 "# publishing time (ms)", 399 "# publishing time (ms)",
400 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 400 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
401 GNUNET_NO); 401 GNUNET_NO);
402 p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); 402 p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p);
403 return p; 403 return p;
@@ -424,9 +424,9 @@ progress_cb (void *cls,
424 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: 424 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
425 p = info->value.download.cctx; 425 p = info->value.download.cctx;
426 GNUNET_STATISTICS_update (stats_handle, 426 GNUNET_STATISTICS_update (stats_handle,
427 "# download time (ms)", 427 "# download time (ms)",
428 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 428 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
429 GNUNET_NO); 429 GNUNET_NO);
430 p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); 430 p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p);
431 return p; 431 return p;
432 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: 432 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
@@ -450,12 +450,12 @@ progress_cb (void *cls,
450 if (p->y != GNUNET_FS_uri_chk_get_file_size (uri)) 450 if (p->y != GNUNET_FS_uri_chk_get_file_size (uri))
451 return NULL; /* not what we want */ 451 return NULL; /* not what we want */
452 GNUNET_STATISTICS_update (stats_handle, 452 GNUNET_STATISTICS_update (stats_handle,
453 "# search time (ms)", 453 "# search time (ms)",
454 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL, 454 (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value_us / 1000LL,
455 GNUNET_NO); 455 GNUNET_NO);
456 p->start_time = GNUNET_TIME_absolute_get (); 456 p->start_time = GNUNET_TIME_absolute_get ();
457 p->ctx = GNUNET_FS_download_start (fs_handle, uri, 457 p->ctx = GNUNET_FS_download_start (fs_handle, uri,
458 NULL, NULL, NULL, 458 NULL, NULL, NULL,
459 0, GNUNET_FS_uri_chk_get_file_size (uri), 459 0, GNUNET_FS_uri_chk_get_file_size (uri),
460 anonymity_level, 460 anonymity_level,
461 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES, 461 GNUNET_FS_DOWNLOAD_NO_TEMPORARIES,
@@ -483,7 +483,7 @@ progress_cb (void *cls,
483 GNUNET_free (p); 483 GNUNET_free (p);
484 } 484 }
485 return NULL; 485 return NULL;
486 default: 486 default:
487 /* unexpected event during profiling */ 487 /* unexpected event during profiling */
488 GNUNET_break (0); 488 GNUNET_break (0);
489 return NULL; 489 return NULL;
@@ -497,7 +497,7 @@ progress_cb (void *cls,
497 * @param cls the 'struct Pattern' specifying the operation to perform 497 * @param cls the 'struct Pattern' specifying the operation to perform
498 * @param tc scheduler context 498 * @param tc scheduler context
499 */ 499 */
500static void 500static void
501start_publish (void *cls, 501start_publish (void *cls,
502 const struct GNUNET_SCHEDULER_TaskContext *tc) 502 const struct GNUNET_SCHEDULER_TaskContext *tc)
503{ 503{
@@ -522,7 +522,7 @@ start_publish (void *cls,
522 * @param cls the 'struct Pattern' specifying the operation to perform 522 * @param cls the 'struct Pattern' specifying the operation to perform
523 * @param tc scheduler context 523 * @param tc scheduler context
524 */ 524 */
525static void 525static void
526start_download (void *cls, 526start_download (void *cls,
527 const struct GNUNET_SCHEDULER_TaskContext *tc) 527 const struct GNUNET_SCHEDULER_TaskContext *tc)
528{ 528{
@@ -563,7 +563,7 @@ run (void *cls, char *const *args GNUNET_UNUSED,
563 NULL); 563 NULL);
564 564
565 if (GNUNET_OK != 565 if (GNUNET_OK !=
566 GNUNET_CONFIGURATION_get_value_number (cfg, 566 GNUNET_CONFIGURATION_get_value_number (cfg,
567 "TESTBED", "PEERID", 567 "TESTBED", "PEERID",
568 &my_peerid)) 568 &my_peerid))
569 { 569 {
@@ -574,28 +574,28 @@ run (void *cls, char *const *args GNUNET_UNUSED,
574 return; 574 return;
575 } 575 }
576 if (GNUNET_OK != 576 if (GNUNET_OK !=
577 GNUNET_CONFIGURATION_get_value_number (cfg, 577 GNUNET_CONFIGURATION_get_value_number (cfg,
578 "FSPROFILER", "ANONYMITY_LEVEL", 578 "FSPROFILER", "ANONYMITY_LEVEL",
579 &anonymity_level)) 579 &anonymity_level))
580 anonymity_level = 1; 580 anonymity_level = 1;
581 if (GNUNET_OK != 581 if (GNUNET_OK !=
582 GNUNET_CONFIGURATION_get_value_number (cfg, 582 GNUNET_CONFIGURATION_get_value_number (cfg,
583 "FSPROFILER", "REPLICATION_LEVEL", 583 "FSPROFILER", "REPLICATION_LEVEL",
584 &replication_level)) 584 &replication_level))
585 replication_level = 1; 585 replication_level = 1;
586 GNUNET_snprintf (myoptname, sizeof (myoptname), 586 GNUNET_snprintf (myoptname, sizeof (myoptname),
587 "DOWNLOAD-PATTERN-%u", my_peerid); 587 "DOWNLOAD-PATTERN-%u", my_peerid);
588 if (GNUNET_OK != 588 if (GNUNET_OK !=
589 GNUNET_CONFIGURATION_get_value_string (cfg, 589 GNUNET_CONFIGURATION_get_value_string (cfg,
590 "FSPROFILER", myoptname, 590 "FSPROFILER", myoptname,
591 &download_pattern)) 591 &download_pattern))
592 download_pattern = GNUNET_strdup (""); 592 download_pattern = GNUNET_strdup ("");
593 GNUNET_snprintf (myoptname, sizeof (myoptname), 593 GNUNET_snprintf (myoptname, sizeof (myoptname),
594 "PUBLISH-PATTERN-%u", my_peerid); 594 "PUBLISH-PATTERN-%u", my_peerid);
595 if (GNUNET_OK != 595 if (GNUNET_OK !=
596 GNUNET_CONFIGURATION_get_value_string (cfg, 596 GNUNET_CONFIGURATION_get_value_string (cfg,
597 "FSPROFILER", myoptname, 597 "FSPROFILER", myoptname,
598 &publish_pattern)) 598 &publish_pattern))
599 publish_pattern = GNUNET_strdup (""); 599 publish_pattern = GNUNET_strdup ("");
600 if ( (GNUNET_OK != 600 if ( (GNUNET_OK !=
601 parse_pattern (&download_head, 601 parse_pattern (&download_head,