diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-10-27 14:07:18 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-10-27 14:07:18 +0200 |
commit | 08ea93ee62022a31040e1f1e1b62cf4092c2331b (patch) | |
tree | 82dac32f9f9b9894002adafd3d8fc23ef2686a80 /src | |
parent | 8af95178c5c1ee764091b5e082a1b724ccf35108 (diff) | |
download | gnunet-08ea93ee62022a31040e1f1e1b62cf4092c2331b.tar.gz gnunet-08ea93ee62022a31040e1f1e1b62cf4092c2331b.zip |
-add stats
Diffstat (limited to 'src')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 1c2f31ed3..2e67dc1eb 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -94,6 +94,11 @@ static struct GNUNET_GNS_Handle *gns_handle; | |||
94 | static struct GNUNET_CREDENTIAL_Handle *credential_handle; | 94 | static struct GNUNET_CREDENTIAL_Handle *credential_handle; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Stats handle | ||
98 | */ | ||
99 | static struct GNUNET_STATISTICS_Handle *stats_handle; | ||
100 | |||
101 | /** | ||
97 | * Namestore qe | 102 | * Namestore qe |
98 | */ | 103 | */ |
99 | static struct GNUNET_NAMESTORE_QueueEntry *ns_qe; | 104 | static struct GNUNET_NAMESTORE_QueueEntry *ns_qe; |
@@ -425,6 +430,10 @@ struct ConsumeTicketHandle | |||
425 | */ | 430 | */ |
426 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; | 431 | struct GNUNET_IDENTITY_PROVIDER_AttributeList *attrs; |
427 | 432 | ||
433 | /** | ||
434 | * Lookup time | ||
435 | */ | ||
436 | struct GNUNET_TIME_Absolute lookup_start_time; | ||
428 | 437 | ||
429 | /** | 438 | /** |
430 | * request id | 439 | * request id |
@@ -449,6 +458,11 @@ struct ParallelLookup | |||
449 | /* The handle the return to */ | 458 | /* The handle the return to */ |
450 | struct ConsumeTicketHandle *handle; | 459 | struct ConsumeTicketHandle *handle; |
451 | 460 | ||
461 | /** | ||
462 | * Lookup time | ||
463 | */ | ||
464 | struct GNUNET_TIME_Absolute lookup_start_time; | ||
465 | |||
452 | /* The label to look up */ | 466 | /* The label to look up */ |
453 | char *label; | 467 | char *label; |
454 | }; | 468 | }; |
@@ -620,6 +634,8 @@ cleanup() | |||
620 | GNUNET_NAMESTORE_cancel (ns_qe); | 634 | GNUNET_NAMESTORE_cancel (ns_qe); |
621 | if (NULL != ns_handle) | 635 | if (NULL != ns_handle) |
622 | GNUNET_NAMESTORE_disconnect (ns_handle); | 636 | GNUNET_NAMESTORE_disconnect (ns_handle); |
637 | if (NULL != stats_handle) | ||
638 | GNUNET_STATISTICS_destroy (stats_handle, GNUNET_NO); | ||
623 | if (NULL != token) | 639 | if (NULL != token) |
624 | GNUNET_free (token); | 640 | GNUNET_free (token); |
625 | if (NULL != label) | 641 | if (NULL != label) |
@@ -1569,6 +1585,17 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1569 | handle->parallel_lookups_tail, | 1585 | handle->parallel_lookups_tail, |
1570 | parallel_lookup); | 1586 | parallel_lookup); |
1571 | GNUNET_free (parallel_lookup->label); | 1587 | GNUNET_free (parallel_lookup->label); |
1588 | |||
1589 | GNUNET_STATISTICS_update (stats_handle, | ||
1590 | "attribute_lookup_time_total", | ||
1591 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time).rel_value_us, | ||
1592 | GNUNET_YES); | ||
1593 | GNUNET_STATISTICS_update (stats_handle, | ||
1594 | "attribute_lookups_count", | ||
1595 | 1, | ||
1596 | GNUNET_YES); | ||
1597 | |||
1598 | |||
1572 | GNUNET_free (parallel_lookup); | 1599 | GNUNET_free (parallel_lookup); |
1573 | if (1 != rd_count) | 1600 | if (1 != rd_count) |
1574 | GNUNET_break(0);//TODO | 1601 | GNUNET_break(0);//TODO |
@@ -1696,7 +1723,14 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
1696 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1723 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1697 | "Decrypted bytes: %zd Expected bytes: %zd\n", | 1724 | "Decrypted bytes: %zd Expected bytes: %zd\n", |
1698 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | 1725 | size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); |
1699 | 1726 | GNUNET_STATISTICS_update (stats_handle, | |
1727 | "abe_key_lookup_time_total", | ||
1728 | GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us, | ||
1729 | GNUNET_YES); | ||
1730 | GNUNET_STATISTICS_update (stats_handle, | ||
1731 | "abe_key_lookups_count", | ||
1732 | 1, | ||
1733 | GNUNET_YES); | ||
1700 | scopes = GNUNET_strdup (buf); | 1734 | scopes = GNUNET_strdup (buf); |
1701 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1702 | "Scopes %s\n", scopes); | 1736 | "Scopes %s\n", scopes); |
@@ -1714,6 +1748,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
1714 | parallel_lookup = GNUNET_new (struct ParallelLookup); | 1748 | parallel_lookup = GNUNET_new (struct ParallelLookup); |
1715 | parallel_lookup->handle = handle; | 1749 | parallel_lookup->handle = handle; |
1716 | parallel_lookup->label = GNUNET_strdup (scope); | 1750 | parallel_lookup->label = GNUNET_strdup (scope); |
1751 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get(); | ||
1717 | parallel_lookup->lookup_request | 1752 | parallel_lookup->lookup_request |
1718 | = GNUNET_GNS_lookup (gns_handle, | 1753 | = GNUNET_GNS_lookup (gns_handle, |
1719 | lookup_query, | 1754 | lookup_query, |
@@ -1767,7 +1802,7 @@ handle_consume_ticket_message (void *cls, | |||
1767 | rnd_label); | 1802 | rnd_label); |
1768 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1803 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1769 | "Looking for ABE key under %s\n", lookup_query); | 1804 | "Looking for ABE key under %s\n", lookup_query); |
1770 | 1805 | ch->lookup_start_time = GNUNET_TIME_absolute_get (); | |
1771 | ch->lookup_request | 1806 | ch->lookup_request |
1772 | = GNUNET_GNS_lookup (gns_handle, | 1807 | = GNUNET_GNS_lookup (gns_handle, |
1773 | lookup_query, | 1808 | lookup_query, |
@@ -2069,7 +2104,7 @@ iterate_after_abe_bootstrap (void *cls, | |||
2069 | 2104 | ||
2070 | void | 2105 | void |
2071 | iterate_next_after_abe_bootstrap (void *cls, | 2106 | iterate_next_after_abe_bootstrap (void *cls, |
2072 | struct GNUNET_CRYPTO_AbeMasterKey *abe_key) | 2107 | struct GNUNET_CRYPTO_AbeMasterKey *abe_key) |
2073 | { | 2108 | { |
2074 | struct AttributeIterator *ai = cls; | 2109 | struct AttributeIterator *ai = cls; |
2075 | ai->abe_key = abe_key; | 2110 | ai->abe_key = abe_key; |
@@ -2440,7 +2475,8 @@ run (void *cls, | |||
2440 | identity_handle = GNUNET_IDENTITY_connect (cfg, | 2475 | identity_handle = GNUNET_IDENTITY_connect (cfg, |
2441 | NULL, | 2476 | NULL, |
2442 | NULL); | 2477 | NULL); |
2443 | 2478 | stats_handle = GNUNET_STATISTICS_create ("identity-provider", | |
2479 | cfg); | ||
2444 | /* Loading DB plugin */ | 2480 | /* Loading DB plugin */ |
2445 | if (GNUNET_OK != | 2481 | if (GNUNET_OK != |
2446 | GNUNET_CONFIGURATION_get_value_string (cfg, | 2482 | GNUNET_CONFIGURATION_get_value_string (cfg, |