summaryrefslogtreecommitdiff
path: root/source3/include/smb_perfcount.h
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-02-08 23:10:34 -0800
committerTim Prouty <tprouty@samba.org>2009-02-09 13:23:44 -0800
commit54c51a66e3e31c70a641d7efac2d4b08c3007278 (patch)
tree01ea8154819950eec666579dfeaad7724cf3fdb1 /source3/include/smb_perfcount.h
parent98a4327b19e83ffad4e0be7e8895fdbd9e48d49f (diff)
downloadsamba-54c51a66e3e31c70a641d7efac2d4b08c3007278.tar.gz
samba-54c51a66e3e31c70a641d7efac2d4b08c3007278.tar.bz2
samba-54c51a66e3e31c70a641d7efac2d4b08c3007278.zip
S3: New module interface for SMB message statistics gathering
This changelist allows for the addition of custom performance monitoring modules through smb.conf. Entrypoints in the main message processing code have been added to capture the command, subop, ioctl, identity and message size statistics.
Diffstat (limited to 'source3/include/smb_perfcount.h')
-rw-r--r--source3/include/smb_perfcount.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/source3/include/smb_perfcount.h b/source3/include/smb_perfcount.h
new file mode 100644
index 0000000000..218045be88
--- /dev/null
+++ b/source3/include/smb_perfcount.h
@@ -0,0 +1,106 @@
+/*
+ Unix SMB/CIFS implementation.
+ Portable SMB Messaging statistics interfaces
+ Copyright (C) Todd Stecher (2008)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SMB_PERFCOUNT_H_
+#define _SMB_PERFCOUNT_H_
+
+#define SMB_PERFCOUNTER_INTERFACE_VERSION 1
+
+struct smb_perfcount_data{
+ struct smb_perfcount_handlers *handlers;
+ void *context;
+};
+
+struct smb_perfcount_handlers {
+ void (*perfcount_start) (struct smb_perfcount_data *pcd);
+ void (*perfcount_add) (struct smb_perfcount_data *pcd);
+ void (*perfcount_set_op) (struct smb_perfcount_data *pcd, int op);
+ void (*perfcount_set_subop) (struct smb_perfcount_data *pcd, int subop);
+ void (*perfcount_set_ioctl) (struct smb_perfcount_data *pcd, int io_ctl);
+ void (*perfcount_set_msglen_in) (struct smb_perfcount_data *pcd,
+ uint64_t in_bytes);
+ void (*perfcount_set_msglen_out) (struct smb_perfcount_data *pcd,
+ uint64_t out_bytes);
+ void (*perfcount_set_client) (struct smb_perfcount_data *pcd, uid_t uid,
+ const char *user, const char *domain);
+ void (*perfcount_defer_op) (struct smb_perfcount_data *pcd,
+ struct smb_perfcount_data *def_pcd);
+ void (*perfcount_end) (struct smb_perfcount_data *pcd);
+};
+
+bool smb_perfcount_init(void);
+
+NTSTATUS smb_register_perfcounter(int interface_version, const char *name,
+ const struct smb_perfcount_handlers *handlers);
+
+void smb_init_perfcount_data(struct smb_perfcount_data *pcd);
+
+#define SMB_PERFCOUNT_START(_pcd_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_start((_pcd_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_ADD(_pcd_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_add((_pcd_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_SET_OP(_pcd_,_op_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_op((_pcd_), (_op_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_SET_SUBOP(_pcd_,_subop_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_subop((_pcd_), (_subop_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_SET_IOCTL(_pcd_,_subop_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_ioctl((_pcd_), (_subop_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_SET_MSGLEN_IN(_pcd_,_in_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_msglen_in((_pcd_), (_in_));\
+ } while (0)
+
+#define SMB_PERFCOUNT_SET_MSGLEN_OUT(_pcd_,_out_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
+ } while (0)
+
+
+#define SMB_PERFCOUNT_SET_CLIENT(_pcd_,_uid_, _user_, _domain_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_set_client((_pcd_), (_uid_), \
+ (_user_), (_domain_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_DEFER_OP(_pcd_, _def_pcd_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_defer_op((_pcd_), (_def_pcd_)); \
+ } while (0)
+
+#define SMB_PERFCOUNT_END(_pcd_) \
+ do {if((_pcd_) && (_pcd_)->handlers) \
+ (_pcd_)->handlers->perfcount_end((_pcd_));\
+ } while (0)
+
+#endif /* _SMB_PERFCOUNT_H_ */