Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / msg_stats.h
blob1126f14e941a23a484ad9c2eb6d74444177bd96f
1 /* $NetBSD$ */
3 #ifndef _MSG_STATS_H_INCLUDED_
4 #define _MSG_STATS_H_INCLUDED_
6 /*++
7 /* NAME
8 /* msg_stats 3h
9 /* SUMMARY
10 /* message delivery profiling
11 /* SYNOPSIS
12 /* #include <msg_stats.h>
13 /* DESCRIPTION
14 /* .nf
17 * System library.
19 #include <sys/time.h>
20 #include <time.h>
21 #include <string.h>
24 * Utility library.
26 #include <attr.h>
27 #include <vstream.h>
30 * External interface.
32 * This structure contains the time stamps from various mail delivery stages,
33 * as well as the connection reuse count. The time stamps provide additional
34 * insight into the nature of performance bottle necks.
36 * For convenience, we record absolute time stamps instead of time differences.
37 * This is because the decision of what numbers to subtract actually depends
38 * on program history. Since we prefer to compute time differences in one
39 * place, we postpone this task until the end, in log_adhoc().
41 * A zero time stamp or reuse count means the information is not supplied.
43 * Specifically, a zero active_arrival value means that the message did not
44 * reach the queue manager; and a zero agent_handoff time means that the
45 * queue manager did not give the message to a delivery agent.
47 * Some network clients update the conn_setup_done value when connection setup
48 * fails or completes.
50 * The deliver_done value is usually left at zero, which means use the wall
51 * clock time when reporting recipient status information. The exception is
52 * with delivery agents that can deliver multiple recipients in a single
53 * transaction. These agents explicitly update the deliver_done time stamp
54 * to ensure that multiple recipient records show the exact same delay
55 * values.
57 typedef struct {
58 struct timeval incoming_arrival; /* incoming queue entry */
59 struct timeval active_arrival; /* active queue entry */
60 struct timeval agent_handoff; /* delivery agent hand-off */
61 struct timeval conn_setup_done; /* connection set-up done */
62 struct timeval deliver_done; /* transmission done */
63 int reuse_count; /* connection reuse count */
64 } MSG_STATS;
66 #define MSG_STATS_INIT(st) \
67 ( \
68 memset((char *) (st), 0, sizeof(*(st))), \
69 (st) \
72 #define MSG_STATS_INIT1(st, member, value) \
73 ( \
74 memset((char *) (st), 0, sizeof(*(st))), \
75 ((st)->member = (value)), \
76 (st) \
79 #define MSG_STATS_INIT2(st, m1, v1, m2, v2) \
80 ( \
81 memset((char *) (st), 0, sizeof(*(st))), \
82 ((st)->m1 = (v1)), \
83 ((st)->m2 = (v2)), \
84 (st) \
87 extern int msg_stats_scan(ATTR_SCAN_MASTER_FN, VSTREAM *, int, void *);
88 extern int msg_stats_print(ATTR_PRINT_MASTER_FN, VSTREAM *, int, void *);
90 /* LICENSE
91 /* .ad
92 /* .fi
93 /* The Secure Mailer license must be distributed with this software.
94 /* AUTHOR(S)
95 /* Wietse Venema
96 /* IBM T.J. Watson Research
97 /* P.O. Box 704
98 /* Yorktown Heights, NY 10598, USA
99 /*--*/
101 #endif