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