diff options
author | Ira Cooper <samba@ira.wakeful.net> | 2010-07-01 17:51:41 -0400 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-07-07 18:06:59 -0700 |
commit | 90b1a1d29623c6c2abc86e2571b535a7832dd376 (patch) | |
tree | 17f897993f4db085ea4bc573a251263f56cf0fe2 | |
parent | 609b8656910eccbb409b58050c306798be22a078 (diff) | |
download | samba-90b1a1d29623c6c2abc86e2571b535a7832dd376.tar.gz samba-90b1a1d29623c6c2abc86e2571b535a7832dd376.tar.bz2 samba-90b1a1d29623c6c2abc86e2571b535a7832dd376.zip |
s3: Add SMB2 performance counters.
A performance counter was added for every base type of SMB2 op.
-rw-r--r-- | source3/include/smbprofile.h | 87 | ||||
-rw-r--r-- | source3/profile/profile.c | 19 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 77 | ||||
-rw-r--r-- | source3/utils/status_profile.c | 41 |
4 files changed, 203 insertions, 21 deletions
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index 5b52bad8c1..b406c7dd27 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -26,7 +26,7 @@ #define PROF_SHMEM_KEY ((key_t)0x07021999) #define PROF_SHM_MAGIC 0x6349985 -#define PROF_SHM_VERSION 11 +#define PROF_SHM_VERSION 12 /* time values in the following structure are in microseconds */ @@ -756,6 +756,82 @@ enum profile_stats_values #define election_count __profile_stats_value(PR_VALUE_ELECTION, count) #define election_time __profile_stats_value(PR_VALUE_ELECTION, time) + PR_VALUE_SMB2_NEGPROT, +#define smb2_negprot_count __profile_stats_value(PR_VALUE_SMB2_NEGPROT, count) +#define smb2_negprot_time __profile_stats_value(PR_VALUE_SMB2_NEGPROT, time) + + PR_VALUE_SMB2_SESSSETUP, +#define smb2_sesssetup_count __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, count) +#define smb2_sesssetup_time __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, time) + + PR_VALUE_SMB2_LOGOFF, +#define smb2_logoff_count __profile_stats_value(PR_VALUE_SMB2_LOGOFF, count) +#define smb2_logoff_time __profile_stats_value(PR_VALUE_SMB2_LOGOFF, time) + + PR_VALUE_SMB2_TCON, +#define smb2_tcon_count __profile_stats_value(PR_VALUE_SMB2_TCON, count) +#define smb2_tcon_time __profile_stats_value(PR_VALUE_SMB2_TCON, time) + + PR_VALUE_SMB2_TDIS, +#define smb2_tdis_count __profile_stats_value(PR_VALUE_SMB2_TDIS, count) +#define smb2_tdis_time __profile_stats_value(PR_VALUE_SMB2_TDIS, time) + + PR_VALUE_SMB2_CREATE, +#define smb2_create_count __profile_stats_value(PR_VALUE_SMB2_CREATE, count) +#define smb2_create_time __profile_stats_value(PR_VALUE_SMB2_CREATE, time) + + PR_VALUE_SMB2_CLOSE, +#define smb2_close_count __profile_stats_value(PR_VALUE_SMB2_CLOSE, count) +#define smb2_close_time __profile_stats_value(PR_VALUE_SMB2_CLOSE, time) + + PR_VALUE_SMB2_FLUSH, +#define smb2_flush_count __profile_stats_value(PR_VALUE_SMB2_FLUSH, count) +#define smb2_flush_time __profile_stats_value(PR_VALUE_SMB2_FLUSH, time) + + PR_VALUE_SMB2_READ, +#define smb2_read_count __profile_stats_value(PR_VALUE_SMB2_READ, count) +#define smb2_read_time __profile_stats_value(PR_VALUE_SMB2_READ, time) + + PR_VALUE_SMB2_WRITE, +#define smb2_write_count __profile_stats_value(PR_VALUE_SMB2_WRITE, count) +#define smb2_write_time __profile_stats_value(PR_VALUE_SMB2_WRITE, time) + + PR_VALUE_SMB2_LOCK, +#define smb2_lock_count __profile_stats_value(PR_VALUE_SMB2_LOCK, count) +#define smb2_lock_time __profile_stats_value(PR_VALUE_SMB2_LOCK, time) + + PR_VALUE_SMB2_IOCTL, +#define smb2_ioctl_count __profile_stats_value(PR_VALUE_SMB2_IOCTL, count) +#define smb2_ioctl_time __profile_stats_value(PR_VALUE_SMB2_IOCTL, time) + + PR_VALUE_SMB2_CANCEL, +#define smb2_cancel_count __profile_stats_value(PR_VALUE_SMB2_CANCEL, count) +#define smb2_cancel_time __profile_stats_value(PR_VALUE_SMB2_CANCEL, time) + + PR_VALUE_SMB2_KEEPALIVE, +#define smb2_keepalive_count __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, count) +#define smb2_keepalive_time __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, time) + + PR_VALUE_SMB2_FIND, +#define smb2_find_count __profile_stats_value(PR_VALUE_SMB2_FIND, count) +#define smb2_find_time __profile_stats_value(PR_VALUE_SMB2_FIND, time) + + PR_VALUE_SMB2_NOTIFY, +#define smb2_notify_count __profile_stats_value(PR_VALUE_SMB2_NOTIFY, count) +#define smb2_notify_time __profile_stats_value(PR_VALUE_SMB2_NOTIFY, time) + + PR_VALUE_SMB2_GETINFO, +#define smb2_getinfo_count __profile_stats_value(PR_VALUE_SMB2_GETINFO, count) +#define smb2_getinfo_time __profile_stats_value(PR_VALUE_SMB2_GETINFO, time) + + PR_VALUE_SMB2_SETINFO, +#define smb2_setinfo_count __profile_stats_value(PR_VALUE_SMB2_SETINFO, count) +#define smb2_setinfo_time __profile_stats_value(PR_VALUE_SMB2_SETINFO, time) + + PR_VALUE_SMB2_BREAK, +#define smb2_break_count __profile_stats_value(PR_VALUE_SMB2_BREAK, count) +#define smb2_break_time __profile_stats_value(PR_VALUE_SMB2_BREAK, time) + /* This mist remain the last value. */ PR_VALUE_MAX }; /* enum profile_stats_values */ @@ -890,6 +966,13 @@ static inline uint64_t profile_timestamp(void) profile_timestamp() - __profstamp_##x); \ } +#define PROFILE_AND_RETURN(x,t,c) { \ + t __return_value; \ + START_PROFILE(x); \ + __return_value = (c); \ + END_PROFILE(x); \ + return __return_value; \ +} #else /* WITH_PROFILE */ @@ -900,7 +983,7 @@ static inline uint64_t profile_timestamp(void) #define START_PROFILE(x) #define START_PROFILE_BYTES(x,n) #define END_PROFILE(x) - +#define PROFILE_AND_RETURN(x,t,c) return (c); #endif /* WITH_PROFILE */ #endif diff --git a/source3/profile/profile.c b/source3/profile/profile.c index 817bbb6b2d..c8e7c38da7 100644 --- a/source3/profile/profile.c +++ b/source3/profile/profile.c @@ -455,6 +455,25 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) "sync_browse_lists", /* PR_VALUE_SYNC_BROWSE_LISTS */ "run_elections", /* PR_VALUE_RUN_ELECTIONS */ "election", /* PR_VALUE_ELECTION */ + "smb2_negprot", /* PR_VALUE_SMB2_NEGPROT */ + "smb2_sesssetup", /* PR_VALUE_SMB2_SESSETUP */ + "smb2_logoff", /* PR_VALUE_SMB2_LOGOFF */ + "smb2_tcon", /* PR_VALUE_SMB2_TCON */ + "smb2_tdis", /* PR_VALUE_SMB2_TDIS */ + "smb2_create", /* PR_VALUE_SMB2_CREATE */ + "smb2_close", /* PR_VALUE_SMB2_CLOSE */ + "smb2_flush", /* PR_VALUE_SMB2_FLUSH */ + "smb2_read", /* PR_VALUE_SMB2_READ */ + "smb2_write", /* PR_VALUE_SMB2_WRITE */ + "smb2_lock", /* PR_VALUE_SMB2_LOCK */ + "smb2_ioctl", /* PR_VALUE_SMB2_IOCTL */ + "smb2_cancel", /* PR_VALUE_SMB2_CANCEL */ + "smb2_keepalive", /* PR_VALUE_SMB2_KEEPALIVE */ + "smb2_find", /* PR_VALUE_SMB2_FIND */ + "smb2_notify", /* PR_VALUE_SMB2_NOTIFY */ + "smb2_getinfo", /* PR_VALUE_SMB2_GETINFO */ + "smb2_setinfo" /* PR_VALUE_SMB2_SETINFO */ + "smb2_break", /* PR_VALUE_SMB2_BREAK */ "" /* PR_VALUE_MAX */ }; diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index c977653e8d..85310c4a25 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1018,16 +1018,22 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) switch (opcode) { case SMB2_OP_NEGPROT: - return smbd_smb2_request_process_negprot(req); + PROFILE_AND_RETURN(smb2_negprot, + NTSTATUS, + smbd_smb2_request_process_negprot(req)); case SMB2_OP_SESSSETUP: - return smbd_smb2_request_process_sesssetup(req); + PROFILE_AND_RETURN(smb2_sesssetup, + NTSTATUS, + smbd_smb2_request_process_sesssetup(req)); case SMB2_OP_LOGOFF: if (!NT_STATUS_IS_OK(session_status)) { return smbd_smb2_request_error(req, session_status); } - return smbd_smb2_request_process_logoff(req); + PROFILE_AND_RETURN(smb2_logoff, + NTSTATUS, + smbd_smb2_request_process_logoff(req)); case SMB2_OP_TCON: if (!NT_STATUS_IS_OK(session_status)) { @@ -1037,7 +1043,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_tcon(req); + PROFILE_AND_RETURN(smb2_tcon, + NTSTATUS, + smbd_smb2_request_process_tcon(req)); case SMB2_OP_TDIS: if (!NT_STATUS_IS_OK(session_status)) { @@ -1047,7 +1055,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_tdis(req); + PROFILE_AND_RETURN(smb2_tdis, + NTSTATUS, + smbd_smb2_request_process_tdis(req)); case SMB2_OP_CREATE: if (!NT_STATUS_IS_OK(session_status)) { @@ -1057,7 +1067,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_create(req); + PROFILE_AND_RETURN(smb2_create, + NTSTATUS, + smbd_smb2_request_process_create(req)); case SMB2_OP_CLOSE: if (!NT_STATUS_IS_OK(session_status)) { @@ -1067,7 +1079,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_close(req); + PROFILE_AND_RETURN(smb2_close, + NTSTATUS, + smbd_smb2_request_process_close(req)); case SMB2_OP_FLUSH: if (!NT_STATUS_IS_OK(session_status)) { @@ -1077,7 +1091,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_flush(req); + PROFILE_AND_RETURN(smb2_flush, + NTSTATUS, + smbd_smb2_request_process_flush(req)); case SMB2_OP_READ: if (!NT_STATUS_IS_OK(session_status)) { @@ -1087,7 +1103,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_read(req); + PROFILE_AND_RETURN(smb2_read, + NTSTATUS, + smbd_smb2_request_process_read(req)); case SMB2_OP_WRITE: if (!NT_STATUS_IS_OK(session_status)) { @@ -1097,7 +1115,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_write(req); + PROFILE_AND_RETURN(smb2_write, + NTSTATUS, + smbd_smb2_request_process_write(req)); case SMB2_OP_LOCK: if (!NT_STATUS_IS_OK(session_status)) { @@ -1115,7 +1135,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) } return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_lock(req); + PROFILE_AND_RETURN(smb2_lock, + NTSTATUS, + smbd_smb2_request_process_lock(req)); case SMB2_OP_IOCTL: if (!NT_STATUS_IS_OK(session_status)) { @@ -1125,13 +1147,20 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_ioctl(req); + PROFILE_AND_RETURN(smb2_ioctl, + NTSTATUS, + smbd_smb2_request_process_ioctl(req)); case SMB2_OP_CANCEL: - return smbd_smb2_request_process_cancel(req); + PROFILE_AND_RETURN(smb2_cancel, + NTSTATUS, + smbd_smb2_request_process_cancel(req)); case SMB2_OP_KEEPALIVE: - return smbd_smb2_request_process_keepalive(req); + PROFILE_AND_RETURN(smb2_keepalive, + NTSTATUS, + smbd_smb2_request_process_keepalive(req)); + case SMB2_OP_FIND: if (!NT_STATUS_IS_OK(session_status)) { @@ -1141,7 +1170,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_find(req); + PROFILE_AND_RETURN(smb2_find, + NTSTATUS, + smbd_smb2_request_process_find(req)); case SMB2_OP_NOTIFY: if (!NT_STATUS_IS_OK(session_status)) { @@ -1151,7 +1182,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_notify(req); + PROFILE_AND_RETURN(smb2_notify, + NTSTATUS, + smbd_smb2_request_process_notify(req)); case SMB2_OP_GETINFO: if (!NT_STATUS_IS_OK(session_status)) { @@ -1161,7 +1194,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_getinfo(req); + PROFILE_AND_RETURN(smb2_getinfo, + NTSTATUS, + smbd_smb2_request_process_getinfo(req)); case SMB2_OP_SETINFO: if (!NT_STATUS_IS_OK(session_status)) { @@ -1171,7 +1206,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_setinfo(req); + PROFILE_AND_RETURN(smb2_setinfo, + NTSTATUS, + smbd_smb2_request_process_setinfo(req)); case SMB2_OP_BREAK: if (!NT_STATUS_IS_OK(session_status)) { @@ -1181,7 +1218,9 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req) if (!NT_STATUS_IS_OK(status)) { return smbd_smb2_request_error(req, status); } - return smbd_smb2_request_process_break(req); + PROFILE_AND_RETURN(smb2_break, + NTSTATUS, + smbd_smb2_request_process_break(req)); } return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c index a51537d3da..d39ae2d074 100644 --- a/source3/utils/status_profile.c +++ b/source3/utils/status_profile.c @@ -400,7 +400,48 @@ bool status_profile_dump(bool verbose) d_printf("run_elections_time: %u\n", profile_p->run_elections_time); d_printf("election_count: %u\n", profile_p->election_count); d_printf("election_time: %u\n", profile_p->election_time); + profile_separator("SMB2 Calls"); + d_printf("smb2_negprot_count: %u\n", profile_p->smb2_negprot_count); + d_printf("smb2_negprot_time: %u\n", profile_p->smb2_negprot_time); + d_printf("smb2_sesssetup_count: %u\n", profile_p->smb2_sesssetup_count); + d_printf("smb2_sesssetup_time: %u\n", profile_p->smb2_sesssetup_time); + d_printf("smb2_logoff_count: %u\n", profile_p->smb2_logoff_count); + d_printf("smb2_logoff_time: %u\n", profile_p->smb2_logoff_time); + d_printf("smb2_tcon_count: %u\n", profile_p->smb2_tcon_count); + d_printf("smb2_tcon_time: %u\n", profile_p->smb2_tcon_time); + d_printf("smb2_tdis_count: %u\n", profile_p->smb2_tdis_count); + d_printf("smb2_tdis_time: %u\n", profile_p->smb2_tdis_time); + d_printf("smb2_create_count: %u\n", profile_p->smb2_create_count); + d_printf("smb2_create_time: %u\n", profile_p->smb2_create_time); + d_printf("smb2_close_count: %u\n", profile_p->smb2_close_count); + d_printf("smb2_close_time: %u\n", profile_p->smb2_close_time); + d_printf("smb2_flush_count: %u\n", profile_p->smb2_flush_count); + d_printf("smb2_flush_time: %u\n", profile_p->smb2_flush_time); + d_printf("smb2_read_count: %u\n", profile_p->smb2_read_count); + d_printf("smb2_read_time: %u\n", profile_p->smb2_read_time); + d_printf("smb2_write_count: %u\n", profile_p->smb2_write_count); + d_printf("smb2_write_time: %u\n", profile_p->smb2_write_time); + d_printf("smb2_lock_count: %u\n", profile_p->smb2_lock_count); + d_printf("smb2_lock_time: %u\n", profile_p->smb2_lock_time); + d_printf("smb2_ioctl_count: %u\n", profile_p->smb2_ioctl_count); + d_printf("smb2_ioctl_time: %u\n", profile_p->smb2_ioctl_time); + d_printf("smb2_cancel_count: %u\n", profile_p->smb2_cancel_count); + d_printf("smb2_cancel_time: %u\n", profile_p->smb2_cancel_time); + d_printf("smb2_keepalive_count: %u\n", profile_p->smb2_keepalive_count); + d_printf("smb2_keepalive_time: %u\n", profile_p->smb2_keepalive_time); + d_printf("smb2_find_count: %u\n", profile_p->smb2_find_count); + d_printf("smb2_find_time: %u\n", profile_p->smb2_find_time); + d_printf("smb2_notify_count: %u\n", profile_p->smb2_notify_count); + d_printf("smb2_notify_time: %u\n", profile_p->smb2_notify_time); + d_printf("smb2_getinfo_count: %u\n", profile_p->smb2_getinfo_count); + d_printf("smb2_getinfo_time: %u\n", profile_p->smb2_getinfo_time); + d_printf("smb2_setinfo_count: %u\n", profile_p->smb2_setinfo_count); + d_printf("smb2_setinfo_time: %u\n", profile_p->smb2_setinfo_time); + d_printf("smb2_break_count: %u\n", profile_p->smb2_break_count); + d_printf("smb2_break_time: %u\n", profile_p->smb2_break_time); + #else /* WITH_PROFILE */ + fprintf(stderr, "Profile data unavailable\n"); #endif /* WITH_PROFILE */ |