Commit 96ade2bc authored by Mark Andrews's avatar Mark Andrews
Browse files

3134. [bug] Improve the accuracy of dnssec-signzone's signing

                        statistics. [RT #16030]
parent 4a2fa3c5
3134. [bug] Improve the accuracy of dnssec-signzone's signing
statistics. [RT #16030]
3133. [bug] Change #3114 was incomplete. [RT #24577] 3133. [bug] Change #3114 was incomplete. [RT #24577]
3132. [placeholder] 3132. [placeholder]
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: dnssec-signzone.c,v 1.277 2011/06/10 01:51:08 each Exp $ */ /* $Id: dnssec-signzone.c,v 1.278 2011/07/19 04:09:27 marka Exp $ */
/*! \file */ /*! \file */
...@@ -3395,28 +3395,36 @@ removetempfile(void) { ...@@ -3395,28 +3395,36 @@ removetempfile(void) {
} }
static void static void
print_stats(isc_time_t *timer_start, isc_time_t *timer_finish) { print_stats(isc_time_t *timer_start, isc_time_t *timer_finish,
isc_uint64_t runtime_us; /* Runtime in microseconds */ isc_time_t *sign_start, isc_time_t *sign_finish)
isc_uint64_t runtime_ms; /* Runtime in milliseconds */ {
isc_uint64_t time_us; /* Time in microseconds */
isc_uint64_t time_ms; /* Time in milliseconds */
isc_uint64_t sig_ms; /* Signatures per millisecond */ isc_uint64_t sig_ms; /* Signatures per millisecond */
runtime_us = isc_time_microdiff(timer_finish, timer_start);
printf("Signatures generated: %10d\n", nsigned); printf("Signatures generated: %10d\n", nsigned);
printf("Signatures retained: %10d\n", nretained); printf("Signatures retained: %10d\n", nretained);
printf("Signatures dropped: %10d\n", ndropped); printf("Signatures dropped: %10d\n", ndropped);
printf("Signatures successfully verified: %10d\n", nverified); printf("Signatures successfully verified: %10d\n", nverified);
printf("Signatures unsuccessfully verified: %10d\n", nverifyfailed); printf("Signatures unsuccessfully verified: %10d\n", nverifyfailed);
runtime_ms = runtime_us / 1000;
printf("Runtime in seconds: %7u.%03u\n", time_us = isc_time_microdiff(sign_finish, sign_start);
(unsigned int) (runtime_ms / 1000), time_ms = time_us / 1000;
(unsigned int) (runtime_ms % 1000)); printf("Signing time in seconds: %7u.%03u\n",
if (runtime_us > 0) { (unsigned int) (time_ms / 1000),
sig_ms = ((isc_uint64_t)nsigned * 1000000000) / runtime_us; (unsigned int) (time_ms % 1000));
if (time_us > 0) {
sig_ms = ((isc_uint64_t)nsigned * 1000000000) / time_us;
printf("Signatures per second: %7u.%03u\n", printf("Signatures per second: %7u.%03u\n",
(unsigned int) sig_ms / 1000, (unsigned int) sig_ms / 1000,
(unsigned int) sig_ms % 1000); (unsigned int) sig_ms % 1000);
} }
time_us = isc_time_microdiff(timer_finish, timer_start);
time_ms = time_us / 1000;
printf("Runtime in seconds: %7u.%03u\n",
(unsigned int) (time_ms / 1000),
(unsigned int) (time_ms % 1000));
} }
int int
...@@ -3431,6 +3439,7 @@ main(int argc, char *argv[]) { ...@@ -3431,6 +3439,7 @@ main(int argc, char *argv[]) {
int ndskeys = 0; int ndskeys = 0;
char *endp; char *endp;
isc_time_t timer_start, timer_finish; isc_time_t timer_start, timer_finish;
isc_time_t sign_start, sign_finish;
dns_dnsseckey_t *key; dns_dnsseckey_t *key;
isc_result_t result; isc_result_t result;
isc_log_t *log = NULL; isc_log_t *log = NULL;
...@@ -4001,6 +4010,7 @@ main(int argc, char *argv[]) { ...@@ -4001,6 +4010,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_mutex_init(&statslock) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mutex_init(&statslock) == ISC_R_SUCCESS);
presign(); presign();
TIME_NOW(&sign_start);
signapex(); signapex();
if (!finished) { if (!finished) {
/* /*
...@@ -4025,6 +4035,7 @@ main(int argc, char *argv[]) { ...@@ -4025,6 +4035,7 @@ main(int argc, char *argv[]) {
isc_taskmgr_destroy(&taskmgr); isc_taskmgr_destroy(&taskmgr);
isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *)); isc_mem_put(mctx, tasks, ntasks * sizeof(isc_task_t *));
postsign(); postsign();
TIME_NOW(&sign_finish);
verifyzone(); verifyzone();
if (outputformat != dns_masterformat_text) { if (outputformat != dns_masterformat_text) {
...@@ -4078,7 +4089,8 @@ main(int argc, char *argv[]) { ...@@ -4078,7 +4089,8 @@ main(int argc, char *argv[]) {
if (printstats) { if (printstats) {
TIME_NOW(&timer_finish); TIME_NOW(&timer_finish);
print_stats(&timer_start, &timer_finish); print_stats(&timer_start, &timer_finish,
&sign_start, &sign_finish);
} }
return (0); return (0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment