diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-12-08 15:14:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-12-08 15:14:00 +0000 |
commit | 33ead6c4ef534690c738a16f5467f2e4fa1ed9c9 (patch) | |
tree | 8eba75cdbf19abaf95b20bbb9570831e7834e09b /src/fs/gnunet-daemon-fsprofiler.c | |
parent | a9c860c0fff4cb75afa7518a9137977b096e8bff (diff) | |
download | gnunet-33ead6c4ef534690c738a16f5467f2e4fa1ed9c9.tar.gz gnunet-33ead6c4ef534690c738a16f5467f2e4fa1ed9c9.zip |
-virtually finished fs profiler
Diffstat (limited to 'src/fs/gnunet-daemon-fsprofiler.c')
-rw-r--r-- | src/fs/gnunet-daemon-fsprofiler.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/fs/gnunet-daemon-fsprofiler.c b/src/fs/gnunet-daemon-fsprofiler.c index 49583962d..16a74b8a0 100644 --- a/src/fs/gnunet-daemon-fsprofiler.c +++ b/src/fs/gnunet-daemon-fsprofiler.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * TODO: | 26 | * TODO: |
27 | * - actually collect performance metrics | ||
28 | * - how to signal driver that we're done? | 27 | * - how to signal driver that we're done? |
29 | */ | 28 | */ |
30 | #include "platform.h" | 29 | #include "platform.h" |
@@ -387,13 +386,19 @@ progress_cb (void *cls, | |||
387 | p = info->value.publish.cctx; | 386 | p = info->value.publish.cctx; |
388 | return p; | 387 | return p; |
389 | case GNUNET_FS_STATUS_PUBLISH_ERROR: | 388 | case GNUNET_FS_STATUS_PUBLISH_ERROR: |
390 | // FIXME: statistics... | 389 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
390 | "Publishing failed\n"); | ||
391 | GNUNET_STATISTICS_update (stats_handle, | ||
392 | "# failed publish operations", 1, GNUNET_NO); | ||
391 | p = info->value.publish.cctx; | 393 | p = info->value.publish.cctx; |
392 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); | 394 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); |
393 | return p; | 395 | return p; |
394 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: | 396 | case GNUNET_FS_STATUS_PUBLISH_COMPLETED: |
395 | // FIXME: statistics... | ||
396 | p = info->value.publish.cctx; | 397 | p = info->value.publish.cctx; |
398 | GNUNET_STATISTICS_update (stats_handle, | ||
399 | "# publishing time (ms)", | ||
400 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | ||
401 | GNUNET_NO); | ||
397 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); | 402 | p->task = GNUNET_SCHEDULER_add_now (&publish_stop_task, p); |
398 | return p; | 403 | return p; |
399 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: | 404 | case GNUNET_FS_STATUS_PUBLISH_STOPPED: |
@@ -409,14 +414,19 @@ progress_cb (void *cls, | |||
409 | p = info->value.download.cctx; | 414 | p = info->value.download.cctx; |
410 | return p; | 415 | return p; |
411 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: | 416 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: |
412 | // FIXME: statistics | 417 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
418 | "Download failed\n"); | ||
419 | GNUNET_STATISTICS_update (stats_handle, | ||
420 | "# failed downloads", 1, GNUNET_NO); | ||
413 | p = info->value.download.cctx; | 421 | p = info->value.download.cctx; |
414 | p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); | 422 | p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); |
415 | return p; | 423 | return p; |
416 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 424 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
417 | // FIXME: statistics | ||
418 | p = info->value.download.cctx; | 425 | p = info->value.download.cctx; |
419 | p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); | 426 | GNUNET_STATISTICS_update (stats_handle, |
427 | "# download time (ms)", | ||
428 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | ||
429 | GNUNET_NO); p->task = GNUNET_SCHEDULER_add_now (&download_stop_task, p); | ||
420 | return p; | 430 | return p; |
421 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 431 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
422 | p = info->value.download.cctx; | 432 | p = info->value.download.cctx; |
@@ -438,6 +448,11 @@ progress_cb (void *cls, | |||
438 | return NULL; /* not what we want */ | 448 | return NULL; /* not what we want */ |
439 | if (p->y != GNUNET_FS_uri_chk_get_file_size (uri)) | 449 | if (p->y != GNUNET_FS_uri_chk_get_file_size (uri)) |
440 | return NULL; /* not what we want */ | 450 | return NULL; /* not what we want */ |
451 | GNUNET_STATISTICS_update (stats_handle, | ||
452 | "# search time (ms)", | ||
453 | (long long) GNUNET_TIME_absolute_get_duration (p->start_time).rel_value, | ||
454 | GNUNET_NO); | ||
455 | p->start_time = GNUNET_TIME_absolute_get (); | ||
441 | p->ctx = GNUNET_FS_download_start (fs_handle, uri, | 456 | p->ctx = GNUNET_FS_download_start (fs_handle, uri, |
442 | NULL, NULL, NULL, | 457 | NULL, NULL, NULL, |
443 | 0, GNUNET_FS_uri_chk_get_file_size (uri), | 458 | 0, GNUNET_FS_uri_chk_get_file_size (uri), |
@@ -451,7 +466,10 @@ progress_cb (void *cls, | |||
451 | case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED: | 466 | case GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED: |
452 | return NULL; /* don't care */ | 467 | return NULL; /* don't care */ |
453 | case GNUNET_FS_STATUS_SEARCH_ERROR: | 468 | case GNUNET_FS_STATUS_SEARCH_ERROR: |
454 | // FIXME: statistics | 469 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
470 | "Search failed\n"); | ||
471 | GNUNET_STATISTICS_update (stats_handle, | ||
472 | "# failed searches", 1, GNUNET_NO); | ||
455 | p = info->value.search.cctx; | 473 | p = info->value.search.cctx; |
456 | p->stask = GNUNET_SCHEDULER_add_now (&search_stop_task, p); | 474 | p->stask = GNUNET_SCHEDULER_add_now (&search_stop_task, p); |
457 | return p; | 475 | return p; |
@@ -489,6 +507,7 @@ start_publish (void *cls, | |||
489 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 507 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
490 | return; | 508 | return; |
491 | fi = make_file (p->x, p->y, p); | 509 | fi = make_file (p->x, p->y, p); |
510 | p->start_time = GNUNET_TIME_absolute_get (); | ||
492 | p->ctx = GNUNET_FS_publish_start (fs_handle, | 511 | p->ctx = GNUNET_FS_publish_start (fs_handle, |
493 | fi, | 512 | fi, |
494 | NULL, NULL, NULL, | 513 | NULL, NULL, NULL, |
@@ -513,6 +532,7 @@ start_download (void *cls, | |||
513 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 532 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
514 | return; | 533 | return; |
515 | keywords = make_keywords (p->x); | 534 | keywords = make_keywords (p->x); |
535 | p->start_time = GNUNET_TIME_absolute_get (); | ||
516 | p->sctx = GNUNET_FS_search_start (fs_handle, keywords, | 536 | p->sctx = GNUNET_FS_search_start (fs_handle, keywords, |
517 | anonymity_level, | 537 | anonymity_level, |
518 | GNUNET_FS_SEARCH_OPTION_NONE, | 538 | GNUNET_FS_SEARCH_OPTION_NONE, |