diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-08-16 19:12:41 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-08-16 19:12:41 +0000 |
commit | e3c6244fae5acca8cdc87b334c28e7898ec6ca44 (patch) | |
tree | db8a635345654811f8a9acacd682963877d4b8ec /usr.sbin/smtpd | |
parent | 6a9896e1a24892c523d852b5e031a411ae3b0080 (diff) |
smtpctl show sizes, displays the size of queue-related structures, useful
for developers to see the impact of structure changes on memory and disk
usage, and useful for users to better understand 'smtpctl show stats'
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/parser.c | 3 | ||||
-rw-r--r-- | usr.sbin/smtpd/parser.h | 3 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 33 |
3 files changed, 35 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/parser.c b/usr.sbin/smtpd/parser.c index dc8032115ba..61f82eed172 100644 --- a/usr.sbin/smtpd/parser.c +++ b/usr.sbin/smtpd/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.20 2011/07/21 23:29:24 gilles Exp $ */ +/* $OpenBSD: parser.c,v 1.21 2011/08/16 19:12:40 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -82,6 +82,7 @@ static const struct token t_show[] = { {KEYWORD, "queue", SHOW_QUEUE, NULL}, {KEYWORD, "runqueue", SHOW_RUNQUEUE, NULL}, {KEYWORD, "stats", SHOW_STATS, NULL}, + {KEYWORD, "sizes", SHOW_SIZES, NULL}, {ENDTOKEN, "", NONE, NULL} }; diff --git a/usr.sbin/smtpd/parser.h b/usr.sbin/smtpd/parser.h index 694fb0096ed..70ccd3081ff 100644 --- a/usr.sbin/smtpd/parser.h +++ b/usr.sbin/smtpd/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.17 2011/07/21 23:29:24 gilles Exp $ */ +/* $OpenBSD: parser.h,v 1.18 2011/08/16 19:12:40 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -27,6 +27,7 @@ enum actions { SHOW_QUEUE, SHOW_RUNQUEUE, SHOW_STATS, + SHOW_SIZES, PAUSE_MDA, PAUSE_MTA, PAUSE_SMTP, diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 7fe2edcac83..a1ff0daa2fe 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.62 2011/08/16 19:02:03 gilles Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.63 2011/08/16 19:12:40 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -39,7 +39,8 @@ #include "parser.h" void usage(void); -static int show_command_output(struct imsg*); +static void show_sizes(void); +static int show_command_output(struct imsg *); static int show_stats_output(struct imsg *); int proctype; @@ -96,6 +97,9 @@ main(int argc, char *argv[]) break; case SHOW_RUNQUEUE: break; + case SHOW_SIZES: + show_sizes(); + break; default: goto connected; } @@ -258,6 +262,31 @@ show_command_output(struct imsg *imsg) return (1); } +void +show_sizes(void) +{ + /* + * size _does_ matter. + * + * small changes to ramqueue and diskqueue structures may cause + * large changes to memory and disk usage on busy/large hosts. + * + * this will help developers optimize memory/disk use, and help + * admins understand how the ramqueue.size / ramqueue.size.max + * stats are computed (smtpctl show stats). + * + * -- gilles@ + * + */ + printf("struct ramqueue: %ld\n", sizeof (struct ramqueue)); + printf("struct ramqueue_host: %ld\n", sizeof (struct ramqueue_host)); + printf("struct ramqueue_message: %ld\n", sizeof (struct ramqueue_message)); + printf("struct ramqueue_envelope: %ld\n", sizeof (struct ramqueue_envelope)); + + printf("struct envelope: %ld\n", sizeof (struct envelope)); + printf("struct delivery: %ld\n", sizeof (struct delivery)); +} + static int show_stats_output(struct imsg *imsg) { |