aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-24 11:44:16 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-24 11:44:16 +0200
commit72b802f9173bdd0f5d6830c56d7c51c3349073fe (patch)
tree7e8b294412c063f663d5565ab1050c707a281815 /src/namestore
parentb66603db8ece8a5562e321f2c969346d1625d11a (diff)
downloadgnunet-72b802f9173bdd0f5d6830c56d7c51c3349073fe.tar.gz
gnunet-72b802f9173bdd0f5d6830c56d7c51c3349073fe.zip
nicer zoneimport performance logging
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-zoneimport.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index d57bb938d..c26d33bad 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -306,7 +306,7 @@ for_all_records (const struct GNUNET_DNSPARSER_Packet *p,
306 306
307/** 307/**
308 * Return just the label of the hostname in @a req. 308 * Return just the label of the hostname in @a req.
309 * 309 *
310 * @param req request to process hostname of 310 * @param req request to process hostname of
311 * @return statically allocated pointer to the label, 311 * @return statically allocated pointer to the label,
312 * overwritten upon the next request! 312 * overwritten upon the next request!
@@ -316,7 +316,7 @@ get_label (struct Request *req)
316{ 316{
317 static char label[64]; 317 static char label[64];
318 const char *dot; 318 const char *dot;
319 319
320 dot = strchr (req->hostname, 320 dot = strchr (req->hostname,
321 (unsigned char) '.'); 321 (unsigned char) '.');
322 if (NULL == dot) 322 if (NULL == dot)
@@ -339,7 +339,7 @@ get_label (struct Request *req)
339 339
340/** 340/**
341 * Build DNS query for @a hostname. 341 * Build DNS query for @a hostname.
342 * 342 *
343 * @param hostname host to build query for 343 * @param hostname host to build query for
344 * @param raw_size[out] number of bytes in the query 344 * @param raw_size[out] number of bytes in the query
345 * @return NULL on error, otherwise pointer to statically (!) 345 * @return NULL on error, otherwise pointer to statically (!)
@@ -384,7 +384,7 @@ build_dns_query (struct Request *req,
384 rejects++; 384 rejects++;
385 GNUNET_break (0); 385 GNUNET_break (0);
386 GNUNET_free (rawp); 386 GNUNET_free (rawp);
387 return NULL; 387 return NULL;
388 } 388 }
389 memcpy (raw, 389 memcpy (raw,
390 rawp, 390 rawp,
@@ -741,10 +741,10 @@ process_record (void *cls,
741 break; 741 break;
742 case GNUNET_DNSPARSER_TYPE_DNAME: 742 case GNUNET_DNSPARSER_TYPE_DNAME:
743 /* No support for DNAME in GNS yet! FIXME: support later! */ 743 /* No support for DNAME in GNS yet! FIXME: support later! */
744 fprintf (stdout, 744 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
745 "FIXME: not supported: %s DNAME %s\n", 745 "FIXME: not supported: %s DNAME %s\n",
746 rec->name, 746 rec->name,
747 rec->data.hostname); 747 rec->data.hostname);
748 break; 748 break;
749 case GNUNET_DNSPARSER_TYPE_MX: 749 case GNUNET_DNSPARSER_TYPE_MX:
750 if (GNUNET_OK == 750 if (GNUNET_OK ==
@@ -870,6 +870,7 @@ store_completed_cb (void *cls,
870 int32_t success, 870 int32_t success,
871 const char *emsg) 871 const char *emsg)
872{ 872{
873 static struct GNUNET_TIME_Absolute last;
873 static unsigned int pdot; 874 static unsigned int pdot;
874 struct Request *req = cls; 875 struct Request *req = cls;
875 struct Record *rec; 876 struct Record *rec;
@@ -885,12 +886,23 @@ store_completed_cb (void *cls,
885 } 886 }
886 else 887 else
887 { 888 {
888 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
889 "Stored records under `%s'\n", 890 "Stored records under `%s'\n",
890 req->hostname); 891 req->hostname);
892 if (0 == pdot)
893 last = GNUNET_TIME_absolute_get ();
891 pdot++; 894 pdot++;
892 if (0 == pdot % 1000) 895 if (0 == pdot % 1000)
893 fprintf (stderr, "."); 896 {
897 struct GNUNET_TIME_Relative delta;
898
899 delta = GNUNET_TIME_absolute_get_duration (last);
900 last = GNUNET_TIME_absolute_get ();
901 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
902 "Processed 1000 records in %s\n",
903 GNUNET_STRINGS_relative_time_to_string (delta,
904 GNUNET_YES));
905 }
894 } 906 }
895 /* Free records */ 907 /* Free records */
896 while (NULL != (rec = req->rec_head)) 908 while (NULL != (rec = req->rec_head))
@@ -973,7 +985,7 @@ process_result (void *cls,
973 .req = req, 985 .req = req,
974 .p = p 986 .p = p
975 }; 987 };
976 988
977 for_all_records (p, 989 for_all_records (p,
978 &process_record, 990 &process_record,
979 &prc); 991 &prc);
@@ -1392,6 +1404,7 @@ queue (const char *hostname)
1392static void 1404static void
1393process_stdin (void *cls) 1405process_stdin (void *cls)
1394{ 1406{
1407 static struct GNUNET_TIME_Absolute last;
1395 static unsigned int pdot; 1408 static unsigned int pdot;
1396 char hn[256]; 1409 char hn[256];
1397 1410
@@ -1409,9 +1422,20 @@ process_stdin (void *cls)
1409 { 1422 {
1410 if (strlen(hn) > 0) 1423 if (strlen(hn) > 0)
1411 hn[strlen(hn)-1] = '\0'; /* eat newline */ 1424 hn[strlen(hn)-1] = '\0'; /* eat newline */
1425 if (0 == pdot)
1426 last = GNUNET_TIME_absolute_get ();
1412 pdot++; 1427 pdot++;
1413 if (0 == pdot % 1000) 1428 if (0 == pdot % 1000)
1414 fprintf (stderr, "."); 1429 {
1430 struct GNUNET_TIME_Relative delta;
1431
1432 delta = GNUNET_TIME_absolute_get_duration (last);
1433 last = GNUNET_TIME_absolute_get ();
1434 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1435 "Imported 1000 records in %s\n",
1436 GNUNET_STRINGS_relative_time_to_string (delta,
1437 GNUNET_YES));
1438 }
1415 queue (hn); 1439 queue (hn);
1416 return; 1440 return;
1417 } 1441 }