OpenDNSSEC-signer
1.3.9
Main Page
Data Structures
Files
File List
Globals
signer
src
signer
stats.c
Go to the documentation of this file.
1
/*
2
* $Id: stats.c 4543 2011-03-09 14:04:19Z matthijs $
3
*
4
* Copyright (c) 2009 NLNet Labs. All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*
27
*/
28
34
#include "
shared/log.h
"
35
#include "
signer/stats.h
"
36
41
stats_type
*
42
stats_create
(
void
)
43
{
44
stats_type
* stats = (
stats_type
*) malloc(
sizeof
(
stats_type
));
45
stats_clear
(stats);
46
lock_basic_init
(&stats->
stats_lock
);
47
return
stats;
48
}
49
50
55
void
56
stats_clear
(
stats_type
* stats)
57
{
58
ods_log_assert
(stats);
59
stats->
sort_count
= 0;
60
stats->
sort_time
= 0;
61
stats->
sort_done
= 0;
62
stats->
nsec_count
= 0;
63
stats->
nsec_time
= 0;
64
stats->
sig_count
= 0;
65
stats->
sig_soa_count
= 0;
66
stats->
sig_reuse
= 0;
67
stats->
sig_time
= 0;
68
stats->
audit_time
= 0;
69
stats->
start_time
= 0;
70
stats->
end_time
= 0;
71
}
72
73
78
void
79
stats_log
(
stats_type
* stats,
const
char
* name, ldns_rr_type nsec_type)
80
{
81
uint32_t avsign = 0;
82
83
if
(!stats) {
84
return
;
85
}
86
ods_log_assert
(stats);
87
if
(stats->
sig_time
) {
88
avsign = (uint32_t) (stats->
sig_count
/stats->
sig_time
);
89
}
90
ods_log_info
(
"[STATS] %s RR[count=%u time=%u(sec)] "
91
"NSEC%s[count=%u time=%u(sec)] "
92
"RRSIG[new=%u reused=%u time=%u(sec) avg=%u(sig/sec)] "
93
"AUDIT[time=%u(sec)] TOTAL[time=%u(sec)] "
,
94
name?name:
"(null)"
, stats->
sort_count
, stats->
sort_time
,
95
nsec_type==LDNS_RR_TYPE_NSEC3?
"3"
:
""
, stats->
nsec_count
,
96
stats->
nsec_time
, stats->
sig_count
, stats->
sig_reuse
,
97
stats->
sig_time
, avsign, stats->
audit_time
,
98
(uint32_t) (stats->
end_time
- stats->
start_time
));
99
return
;
100
}
101
102
107
void
108
stats_cleanup
(
stats_type
* stats)
109
{
110
lock_basic_destroy
(&stats->
stats_lock
);
111
free((
void
*) stats);
112
return
;
113
}
Generated on Tue Jan 15 2013 20:54:49 for OpenDNSSEC-signer by
1.8.2