profiling patches (Re: Remove NMBD related profiling)
Stefan (metze) Metzmacher
metze at samba.org
Mon Nov 17 12:28:56 MST 2014
Am 31.10.2014 um 17:29 schrieb Jeremy Allison:
> On Fri, Oct 31, 2014 at 08:38:48AM +0100, Stefan (metze) Metzmacher wrote:
>> Hi,
>>
>> I just noticed that nmbd never calls profile_setup(),
>> which means that profiling is always disabled and there's
>> no way to activate it, also smbcontrol can't activate it.
>>
>> Would it be ok if I remove nmbd profiling completely?
>>
>> Comments please:-)
>
> +1 from me. The less code in nmbd the better.
:-)
Here're the patches and some more cleanups and improvements.
There's more to come, converting the sysv share memory into
a profiles.tdb and detailed profiling per user+share (at least
for SMB2).
Please review and push.
Thanks!
metze
-------------- next part --------------
From 7399dbfa3370e0410ef76a206ed53c179ad00a1d Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 23 Oct 2014 18:30:41 +0200
Subject: [PATCH 01/18] s3:smbprofile: add END_PROFILE_BYTES() marco
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index a37ac4f..589bdb6 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -953,6 +953,9 @@ static inline uint64_t profile_timestamp(void)
#define END_PROFILE(x) \
END_PROFILE_RAW(x, __profstamp_##x, x##_time)
+#define END_PROFILE_BYTES(x) \
+ END_PROFILE_RAW(x, __profstamp_##x, x##_time)
+
#else /* WITH_PROFILE */
#define DO_PROFILE_INC(x)
@@ -964,6 +967,7 @@ static inline uint64_t profile_timestamp(void)
#define START_PROFILE_BYTES(x,n)
#define END_PROFILE_STAMP(x, _stamp)
#define END_PROFILE(x)
+#define END_PROFILE_BYTES(x)
#endif /* WITH_PROFILE */
--
1.9.1
From 783a1597f4bf290d13d882c1e5afc7082ef1f113 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 23 Oct 2014 18:31:09 +0200
Subject: [PATCH 02/18] s3:modules: make use of END_PROFILE_BYTES() when
START_PROFILE_BYTES() was used
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/modules/vfs_default.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 3a3943b..5fb3b1c 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -550,7 +550,7 @@ static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void *
START_PROFILE_BYTES(syscall_read, n);
result = sys_read(fsp->fh->fd, data, n);
- END_PROFILE(syscall_read);
+ END_PROFILE_BYTES(syscall_read);
return result;
}
@@ -562,7 +562,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void
#if defined(HAVE_PREAD) || defined(HAVE_PREAD64)
START_PROFILE_BYTES(syscall_pread, n);
result = sys_pread(fsp->fh->fd, data, n, offset);
- END_PROFILE(syscall_pread);
+ END_PROFILE_BYTES(syscall_pread);
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be seeked (sought?) on. */
@@ -604,7 +604,7 @@ static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const
START_PROFILE_BYTES(syscall_write, n);
result = sys_write(fsp->fh->fd, data, n);
- END_PROFILE(syscall_write);
+ END_PROFILE_BYTES(syscall_write);
return result;
}
@@ -616,7 +616,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons
#if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64)
START_PROFILE_BYTES(syscall_pwrite, n);
result = sys_pwrite(fsp->fh->fd, data, n, offset);
- END_PROFILE(syscall_pwrite);
+ END_PROFILE_BYTES(syscall_pwrite);
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be sought on. */
@@ -886,7 +886,7 @@ static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struc
START_PROFILE_BYTES(syscall_sendfile, n);
result = sys_sendfile(tofd, fromfsp->fh->fd, hdr, offset, n);
- END_PROFILE(syscall_sendfile);
+ END_PROFILE_BYTES(syscall_sendfile);
return result;
}
@@ -900,7 +900,7 @@ static ssize_t vfswrap_recvfile(vfs_handle_struct *handle,
START_PROFILE_BYTES(syscall_recvfile, n);
result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n);
- END_PROFILE(syscall_recvfile);
+ END_PROFILE_BYTES(syscall_recvfile);
return result;
}
--
1.9.1
From 86134c69d468851c5def02ef521b24c6c245c9b7 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 5 Nov 2014 13:10:49 +0100
Subject: [PATCH 03/18] s3:nmbd: remove START/END_PROFILE() calls
nmbd never calls profile_setup() and never collects any profiling data.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/nmbd/nmbd_elections.c | 10 +--------
source3/nmbd/nmbd_incomingdgrams.c | 43 +++++++-------------------------------
source3/nmbd/nmbd_synclists.c | 7 +------
source3/wscript_build | 2 +-
4 files changed, 11 insertions(+), 51 deletions(-)
diff --git a/source3/nmbd/nmbd_elections.c b/source3/nmbd/nmbd_elections.c
index 1947e37..04a0807 100644
--- a/source3/nmbd/nmbd_elections.c
+++ b/source3/nmbd/nmbd_elections.c
@@ -22,7 +22,6 @@
#include "includes.h"
#include "nmbd/nmbd.h"
-#include "smbprofile.h"
/* Election parameters. */
extern time_t StartupTime;
@@ -167,11 +166,8 @@ void run_elections(time_t t)
struct subnet_record *subrec;
- START_PROFILE(run_elections);
-
/* Send election packets once every 2 seconds - note */
if (lastime && (t - lastime < 2)) {
- END_PROFILE(run_elections);
return;
}
@@ -211,7 +207,6 @@ yet registered on subnet %s\n", nmb_namestr(&nmbname), subrec->subnet_name ));
}
}
}
- END_PROFILE(run_elections);
}
/*******************************************************************
@@ -271,8 +266,6 @@ void process_election(struct subnet_record *subrec, struct packet_struct *p, con
struct work_record *work;
unstring workgroup_name;
- START_PROFILE(election);
-
pull_ascii_nstring(server_name, sizeof(server_name), buf+13);
pull_ascii_nstring(workgroup_name, sizeof(workgroup_name), dgram->dest_name.name);
@@ -319,8 +312,7 @@ is not my workgroup.\n", work->work_group, subrec->subnet_name ));
}
}
done:
-
- END_PROFILE(election);
+ return;
}
/****************************************************************************
diff --git a/source3/nmbd/nmbd_incomingdgrams.c b/source3/nmbd/nmbd_incomingdgrams.c
index 153a86d..3623c08 100644
--- a/source3/nmbd/nmbd_incomingdgrams.c
+++ b/source3/nmbd/nmbd_incomingdgrams.c
@@ -23,7 +23,6 @@
#include "includes.h"
#include "../librpc/gen_ndr/svcctl.h"
#include "nmbd/nmbd.h"
-#include "smbprofile.h"
extern bool found_lm_clients;
@@ -107,8 +106,6 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p
unstring work_name;
unstring source_name;
- START_PROFILE(host_announce);
-
pull_ascii_fstring(comment, buf+31);
pull_ascii_nstring(announce_name, sizeof(announce_name), buf+5);
@@ -187,8 +184,7 @@ void process_host_announce(struct subnet_record *subrec, struct packet_struct *p
subrec->work_changed = True;
done:
-
- END_PROFILE(host_announce);
+ return;
}
/*******************************************************************
@@ -206,8 +202,6 @@ void process_workgroup_announce(struct subnet_record *subrec, struct packet_stru
unstring source_name;
unstring dest_name;
- START_PROFILE(workgroup_announce);
-
pull_ascii_nstring(workgroup_announce_name,sizeof(workgroup_announce_name),buf+5);
pull_ascii_nstring(master_name,sizeof(master_name),buf+31);
pull_ascii_nstring(source_name,sizeof(source_name),dgram->source_name.name);
@@ -244,8 +238,7 @@ void process_workgroup_announce(struct subnet_record *subrec, struct packet_stru
subrec->work_changed = True;
done:
-
- END_PROFILE(workgroup_announce);
+ return;
}
/*******************************************************************
@@ -264,8 +257,6 @@ void process_local_master_announce(struct subnet_record *subrec, struct packet_s
struct server_record *servrec;
unstring source_name;
- START_PROFILE(local_master_announce);
-
pull_ascii_nstring(server_name,sizeof(server_name),buf+5);
pull_ascii_fstring(comment, buf+31);
pull_ascii_nstring(source_name, sizeof(source_name), dgram->source_name.name);
@@ -355,8 +346,7 @@ a local master browser for workgroup %s and we think we are master. Forcing elec
subrec->work_changed = True;
done:
-
- END_PROFILE(local_master_announce);
+ return;
}
/*******************************************************************
@@ -373,8 +363,6 @@ void process_master_browser_announce(struct subnet_record *subrec,
struct work_record *work;
struct browse_cache_record *browrec;
- START_PROFILE(master_browser_announce);
-
pull_ascii_nstring(local_master_name,sizeof(local_master_name),buf);
DEBUG(3,("process_master_browser_announce: Local master announce from %s IP %s.\n",
@@ -410,8 +398,7 @@ master - ignoring master announce.\n"));
}
done:
-
- END_PROFILE(master_browser_announce);
+ return;
}
/*******************************************************************
@@ -433,7 +420,6 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct
fstring comment;
char *s = get_safe_str_ptr(buf,len,discard_const_p(char, buf),9);
- START_PROFILE(lm_host_announce);
if (!s) {
goto done;
}
@@ -529,8 +515,7 @@ originate from OS/2 Warp client. Ignoring packet.\n"));
found_lm_clients = True;
done:
-
- END_PROFILE(lm_host_announce);
+ return;
}
/****************************************************************************
@@ -654,7 +639,6 @@ void process_get_backup_list_request(struct subnet_record *subrec,
unstring workgroup_name;
struct subnet_record *search_subrec = subrec;
- START_PROFILE(get_backup_list);
pull_ascii_nstring(workgroup_name, sizeof(workgroup_name), dgram->dest_name.name);
DEBUG(3,("process_get_backup_list_request: request from %s IP %s to %s.\n",
@@ -712,8 +696,7 @@ and I am not a local master browser.\n", workgroup_name));
max_number_requested, token, p->ip, p->port);
done:
-
- END_PROFILE(get_backup_list);
+ return;
}
/*******************************************************************
@@ -733,8 +716,6 @@ void process_reset_browser(struct subnet_record *subrec,
int state = CVAL(buf,0);
struct subnet_record *sr;
- START_PROFILE(reset_browser);
-
DEBUG(1,("process_reset_browser: received diagnostic browser reset \
request from %s IP %s state=0x%X\n",
nmb_namestr(&dgram->source_name), inet_ntoa(p->ip), state));
@@ -767,8 +748,6 @@ request from %s IP %s state=0x%X\n",
/* Request to stop browsing altogether. */
if (state & 0x4)
DEBUG(1,("process_reset_browser: ignoring request to stop being a browser.\n"));
-
- END_PROFILE(reset_browser);
}
/*******************************************************************
@@ -785,8 +764,6 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct
struct work_record *work;
unstring workgroup_name;
- START_PROFILE(announce_request);
-
pull_ascii_nstring(workgroup_name, sizeof(workgroup_name), dgram->dest_name.name);
DEBUG(3,("process_announce_request: Announce request from %s IP %s to %s.\n",
nmb_namestr(&dgram->source_name), inet_ntoa(p->ip),
@@ -807,8 +784,7 @@ void process_announce_request(struct subnet_record *subrec, struct packet_struct
work->needannounce = True;
done:
-
- END_PROFILE(announce_request);
+ return;
}
/*******************************************************************
@@ -825,8 +801,6 @@ void process_lm_announce_request(struct subnet_record *subrec, struct packet_str
struct dgram_packet *dgram = &p->packet.dgram;
unstring workgroup_name;
- START_PROFILE(lm_announce_request);
-
pull_ascii_nstring(workgroup_name, sizeof(workgroup_name), dgram->dest_name.name);
DEBUG(3,("process_lm_announce_request: Announce request from %s IP %s to %s.\n",
nmb_namestr(&dgram->source_name), inet_ntoa(p->ip),
@@ -848,6 +822,5 @@ void process_lm_announce_request(struct subnet_record *subrec, struct packet_str
found_lm_clients = True;
done:
-
- END_PROFILE(lm_announce_request);
+ return;
}
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 19e3ed0..70c1750 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -31,7 +31,6 @@
#include "nmbd/nmbd.h"
#include "libsmb/libsmb.h"
#include "libsmb/clirap.h"
-#include "smbprofile.h"
#include "../libcli/smb/smbXcli_base.h"
struct sync_record {
@@ -139,12 +138,10 @@ void sync_browse_lists(struct work_record *work,
struct sync_record *s;
static int counter;
- START_PROFILE(sync_browse_lists);
/* Check we're not trying to sync with ourselves. This can
happen if we are a domain *and* a local master browser. */
if (ismyip_v4(ip)) {
done:
- END_PROFILE(sync_browse_lists);
return;
}
@@ -167,7 +164,7 @@ done:
DLIST_ADD(syncs, s);
/* the parent forks and returns, leaving the child to do the
- actual sync and call END_PROFILE*/
+ actual sync */
CatchChild();
if ((s->pid = fork())) return;
@@ -178,7 +175,6 @@ done:
fp = x_fopen(s->fname,O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (!fp) {
- END_PROFILE(sync_browse_lists);
_exit(1);
}
@@ -186,7 +182,6 @@ done:
s->fname);
x_fclose(fp);
- END_PROFILE(sync_browse_lists);
_exit(0);
}
diff --git a/source3/wscript_build b/source3/wscript_build
index 54ba3a7..7a7fea4 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -860,7 +860,7 @@ bld.SAMBA3_BINARY('nmbd/nmbd',
param
libsmb
popt_samba3
- PROFILE''',
+ ''',
install_path='${SBINDIR}')
--
1.9.1
From 02ce7221b17f4ded45c109cae84ec2bf9924800e Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 5 Nov 2014 13:13:35 +0100
Subject: [PATCH 04/18] s3:smbprofile: remove unused nmbd related counters
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 73 ------------------------------------------
source3/profile/profile.c | 20 +-----------
source3/utils/status_profile.c | 73 ------------------------------------------
3 files changed, 1 insertion(+), 165 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 589bdb6..1afd97c 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -684,79 +684,6 @@ enum profile_stats_values
#define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count)
#define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time)
-/* These are nmbd stats */
- PR_VALUE_NAME_RELEASE,
-#define name_release_count __profile_stats_value(PR_VALUE_NAME_RELEASE, count)
-#define name_release_time __profile_stats_value(PR_VALUE_NAME_RELEASE, time)
-
- PR_VALUE_NAME_REFRESH,
-#define name_refresh_count __profile_stats_value(PR_VALUE_NAME_REFRESH, count)
-#define name_refresh_time __profile_stats_value(PR_VALUE_NAME_REFRESH, time)
-
- PR_VALUE_NAME_REGISTRATION,
-#define name_registration_count __profile_stats_value(PR_VALUE_NAME_REGISTRATION, count)
-#define name_registration_time __profile_stats_value(PR_VALUE_NAME_REGISTRATION, time)
-
- PR_VALUE_NODE_STATUS,
-#define node_status_count __profile_stats_value(PR_VALUE_NODE_STATUS, count)
-#define node_status_time __profile_stats_value(PR_VALUE_NODE_STATUS, time)
-
- PR_VALUE_NAME_QUERY,
-#define name_query_count __profile_stats_value(PR_VALUE_NAME_QUERY, count)
-#define name_query_time __profile_stats_value(PR_VALUE_NAME_QUERY, time)
-
- PR_VALUE_HOST_ANNOUNCE,
-#define host_announce_count __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, count)
-#define host_announce_time __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, time)
-
- PR_VALUE_WORKGROUP_ANNOUNCE,
-#define workgroup_announce_count __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, count)
-#define workgroup_announce_time __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, time)
-
- PR_VALUE_LOCAL_MASTER_ANNOUNCE,
-#define local_master_announce_count __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, count)
-#define local_master_announce_time __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, time)
-
- PR_VALUE_MASTER_BROWSER_ANNOUNCE,
-#define master_browser_announce_count __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, count)
-#define master_browser_announce_time __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, time)
-
- PR_VALUE_LM_HOST_ANNOUNCE,
-#define lm_host_announce_count __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, count)
-#define lm_host_announce_time __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, time)
-
- PR_VALUE_GET_BACKUP_LIST,
-#define get_backup_list_count __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, count)
-#define get_backup_list_time __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, time)
-
- PR_VALUE_RESET_BROWSER,
-#define reset_browser_count __profile_stats_value(PR_VALUE_RESET_BROWSER, count)
-#define reset_browser_time __profile_stats_value(PR_VALUE_RESET_BROWSER, time)
-
- PR_VALUE_ANNOUNCE_REQUEST,
-#define announce_request_count __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, count)
-#define announce_request_time __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, time)
-
- PR_VALUE_LM_ANNOUNCE_REQUEST,
-#define lm_announce_request_count __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, count)
-#define lm_announce_request_time __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, time)
-
- PR_VALUE_DOMAIN_LOGON,
-#define domain_logon_count __profile_stats_value(PR_VALUE_DOMAIN_LOGON, count)
-#define domain_logon_time __profile_stats_value(PR_VALUE_DOMAIN_LOGON, time)
-
- PR_VALUE_SYNC_BROWSE_LISTS,
-#define sync_browse_lists_count __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, count)
-#define sync_browse_lists_time __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, time)
-
- PR_VALUE_RUN_ELECTIONS,
-#define run_elections_count __profile_stats_value(PR_VALUE_RUN_ELECTIONS, count)
-#define run_elections_time __profile_stats_value(PR_VALUE_RUN_ELECTIONS, time)
-
- PR_VALUE_ELECTION,
-#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)
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 7aeee85..faeae7a 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -27,7 +27,7 @@
#define PROF_SHMEM_KEY ((key_t)0x07021999)
#define PROF_SHM_MAGIC 0x6349985
-#define PROF_SHM_VERSION 13
+#define PROF_SHM_VERSION 14
#define IPC_PERMS ((S_IRUSR | S_IWUSR) | S_IRGRP | S_IROTH)
@@ -355,24 +355,6 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
"fset_nt_acl", /* PR_VALUE_FSET_NT_ACL */
"chmod_acl", /* PR_VALUE_CHMOD_ACL */
"fchmod_acl", /* PR_VALUE_FCHMOD_ACL */
- "name_release", /* PR_VALUE_NAME_RELEASE */
- "name_refresh", /* PR_VALUE_NAME_REFRESH */
- "name_registration", /* PR_VALUE_NAME_REGISTRATION */
- "node_status", /* PR_VALUE_NODE_STATUS */
- "name_query", /* PR_VALUE_NAME_QUERY */
- "host_announce", /* PR_VALUE_HOST_ANNOUNCE */
- "workgroup_announce", /* PR_VALUE_WORKGROUP_ANNOUNCE */
- "local_master_announce", /* PR_VALUE_LOCAL_MASTER_ANNOUNCE */
- "master_browser_announce", /* PR_VALUE_MASTER_BROWSER_ANNOUNCE */
- "lm_host_announce", /* PR_VALUE_LM_HOST_ANNOUNCE */
- "get_backup_list", /* PR_VALUE_GET_BACKUP_LIST */
- "reset_browser", /* PR_VALUE_RESET_BROWSER */
- "announce_request", /* PR_VALUE_ANNOUNCE_REQUEST */
- "lm_announce_request", /* PR_VALUE_LM_ANNOUNCE_REQUEST */
- "domain_logon", /* PR_VALUE_DOMAIN_LOGON */
- "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 */
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index 282dea3..a1bbb1e 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -650,79 +650,6 @@ bool status_profile_dump(bool verbose)
d_printf("fchmod_acl_time: %u\n",
profile_p->fchmod_acl_time);
- profile_separator("NMBD Calls");
- d_printf("name_release_count: %u\n",
- profile_p->name_release_count);
- d_printf("name_release_time: %u\n",
- profile_p->name_release_time);
- d_printf("name_refresh_count: %u\n",
- profile_p->name_refresh_count);
- d_printf("name_refresh_time: %u\n",
- profile_p->name_refresh_time);
- d_printf("name_registration_count: %u\n",
- profile_p->name_registration_count);
- d_printf("name_registration_time: %u\n",
- profile_p->name_registration_time);
- d_printf("node_status_count: %u\n",
- profile_p->node_status_count);
- d_printf("node_status_time: %u\n",
- profile_p->node_status_time);
- d_printf("name_query_count: %u\n",
- profile_p->name_query_count);
- d_printf("name_query_time: %u\n",
- profile_p->name_query_time);
- d_printf("host_announce_count: %u\n",
- profile_p->host_announce_count);
- d_printf("host_announce_time: %u\n",
- profile_p->host_announce_time);
- d_printf("workgroup_announce_count: %u\n",
- profile_p->workgroup_announce_count);
- d_printf("workgroup_announce_time: %u\n",
- profile_p->workgroup_announce_time);
- d_printf("local_master_announce_count: %u\n",
- profile_p->local_master_announce_count);
- d_printf("local_master_announce_time: %u\n",
- profile_p->local_master_announce_time);
- d_printf("master_browser_announce_count: %u\n",
- profile_p->master_browser_announce_count);
- d_printf("master_browser_announce_time: %u\n",
- profile_p->master_browser_announce_time);
- d_printf("lm_host_announce_count: %u\n",
- profile_p->lm_host_announce_count);
- d_printf("lm_host_announce_time: %u\n",
- profile_p->lm_host_announce_time);
- d_printf("get_backup_list_count: %u\n",
- profile_p->get_backup_list_count);
- d_printf("get_backup_list_time: %u\n",
- profile_p->get_backup_list_time);
- d_printf("reset_browser_count: %u\n",
- profile_p->reset_browser_count);
- d_printf("reset_browser_time: %u\n",
- profile_p->reset_browser_time);
- d_printf("announce_request_count: %u\n",
- profile_p->announce_request_count);
- d_printf("announce_request_time: %u\n",
- profile_p->announce_request_time);
- d_printf("lm_announce_request_count: %u\n",
- profile_p->lm_announce_request_count);
- d_printf("lm_announce_request_time: %u\n",
- profile_p->lm_announce_request_time);
- d_printf("domain_logon_count: %u\n",
- profile_p->domain_logon_count);
- d_printf("domain_logon_time: %u\n",
- profile_p->domain_logon_time);
- d_printf("sync_browse_lists_count: %u\n",
- profile_p->sync_browse_lists_count);
- d_printf("sync_browse_lists_time: %u\n",
- profile_p->sync_browse_lists_time);
- d_printf("run_elections_count: %u\n",
- profile_p->run_elections_count);
- 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);
--
1.9.1
From 30db1bbe2b2afbf7a268c6d68ce182a6ee5dc57e Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 7 Nov 2014 15:18:44 +0100
Subject: [PATCH 05/18] s3:wscript_build: remove unused to dependency from
'smbtree' to 'PROFILE'
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/wscript_build | 1 -
1 file changed, 1 deletion(-)
diff --git a/source3/wscript_build b/source3/wscript_build
index 7a7fea4..56c1a98 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -1202,7 +1202,6 @@ bld.SAMBA3_BINARY('smbtree',
libsmb
msrpc3
popt_samba3
- PROFILE
RPC_NDR_SRVSVC''')
bld.SAMBA3_BINARY('smbpasswd',
--
1.9.1
From e24c73e7213c48e4f9b385ff3ff3b808864175b6 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 5 Nov 2014 15:54:02 +0100
Subject: [PATCH 06/18] s3:smbd: improve writecache profiling
In order to have useful profiling counters should never be decremented.
We need a separate counter for deallocation events.
The current value can be calculated by allocations - deallocations.
We also use better names and avoid having an array for the flush reasons.
This will simplify further profiling improvements a lot.
The value writecache_num_write_caches (this was similar to writecache_allocations)
is replaced by writecache_cached_writes, which counts the amount of writes which
were completely handled by the cache.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smb.h | 3 +--
source3/include/smbprofile.h | 22 +++++++++++-----
source3/smbd/fileio.c | 39 +++++++++++++++++++++++-----
source3/utils/status_profile.c | 58 ++++++++++++++++++++++--------------------
4 files changed, 79 insertions(+), 43 deletions(-)
diff --git a/source3/include/smb.h b/source3/include/smb.h
index aab4ff5..53d3edc 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -819,7 +819,6 @@ enum flush_reason_enum {
SAMBA_CLOSE_FLUSH,
SAMBA_SYNC_FLUSH,
SAMBA_SIZECHANGE_FLUSH,
- /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
- SAMBA_NUM_FLUSH_REASONS};
+};
#endif /* _SMB_H */
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 1afd97c..26a2ed1 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -789,16 +789,24 @@ struct profile_stats {
unsigned statcache_hits;
/* write cache counters */
- unsigned writecache_read_hits;
- unsigned writecache_abutted_writes;
+ unsigned writecache_allocations;
+ unsigned writecache_deallocations;
+ unsigned writecache_cached_reads;
unsigned writecache_total_writes;
+ unsigned writecache_init_writes;
+ unsigned writecache_abutted_writes;
unsigned writecache_non_oplock_writes;
unsigned writecache_direct_writes;
- unsigned writecache_init_writes;
- unsigned writecache_flushed_writes[SAMBA_NUM_FLUSH_REASONS];
- unsigned writecache_num_perfect_writes;
- unsigned writecache_num_write_caches;
- unsigned writecache_allocated_write_caches;
+ unsigned writecache_cached_writes;
+ unsigned writecache_perfect_writes;
+ unsigned writecache_flush_reason_seek;
+ unsigned writecache_flush_reason_read;
+ unsigned writecache_flush_reason_readraw;
+ unsigned writecache_flush_reason_write;
+ unsigned writecache_flush_reason_oplock;
+ unsigned writecache_flush_reason_close;
+ unsigned writecache_flush_reason_sync;
+ unsigned writecache_flush_reason_sizechange;
};
extern struct profile_stats *profile_p;
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 37c3f66..9f3cc1a 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -53,7 +53,7 @@ static bool read_from_write_cache(files_struct *fsp,char *data,off_t pos,size_t
memcpy(data, wcp->data + (pos - wcp->offset), n);
- DO_PROFILE_INC(writecache_read_hits);
+ DO_PROFILE_INC(writecache_cached_reads);
return True;
}
@@ -799,6 +799,7 @@ n = %u, wcp->offset=%.0f, wcp->data_size=%u\n",
*/
if (n) {
+ DO_PROFILE_INC(writecache_cached_writes);
if (wcp->data_size) {
DO_PROFILE_INC(writecache_abutted_writes);
} else {
@@ -827,7 +828,6 @@ n = %u, wcp->offset=%.0f, wcp->data_size=%u\n",
memcpy(wcp->data+wcp->data_size, data, n);
if (wcp->data_size == 0) {
wcp->offset = pos;
- DO_PROFILE_INC(writecache_num_write_caches);
}
wcp->data_size += n;
@@ -866,7 +866,7 @@ void delete_write_cache(files_struct *fsp)
return;
}
- DO_PROFILE_DEC(writecache_allocated_write_caches);
+ DO_PROFILE_INC(writecache_deallocations);
allocated_write_caches--;
SMB_ASSERT(wcp->data_size == 0);
@@ -914,7 +914,7 @@ static bool setup_write_cache(files_struct *fsp, off_t file_size)
memset(wcp->data, '\0', wcp->alloc_size );
fsp->wcp = wcp;
- DO_PROFILE_INC(writecache_allocated_write_caches);
+ DO_PROFILE_INC(writecache_allocations);
allocated_write_caches++;
DEBUG(10,("setup_write_cache: File %s allocated write cache size %lu\n",
@@ -963,13 +963,40 @@ ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason)
data_size = wcp->data_size;
wcp->data_size = 0;
- DO_PROFILE_DEC_INC(writecache_num_write_caches,writecache_flushed_writes[reason]);
+ switch (reason) {
+ case SAMBA_SEEK_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_seek);
+ break;
+ case SAMBA_READ_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_read);
+ break;
+ case SAMBA_WRITE_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_write);;
+ break;
+ case SAMBA_READRAW_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_readraw);
+ break;
+ case SAMBA_OPLOCK_RELEASE_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_oplock);
+ break;
+ case SAMBA_CLOSE_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_close);
+ break;
+ case SAMBA_SYNC_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_sync);
+ break;
+ case SAMBA_SIZECHANGE_FLUSH:
+ DO_PROFILE_INC(writecache_flush_reason_sizechange);
+ break;
+ default:
+ break;
+ }
DEBUG(9,("flushing write cache: fd = %d, off=%.0f, size=%u\n",
fsp->fh->fd, (double)wcp->offset, (unsigned int)data_size));
if(data_size == wcp->alloc_size) {
- DO_PROFILE_INC(writecache_num_perfect_writes);
+ DO_PROFILE_INC(writecache_perfect_writes);
}
ret = real_write_file(NULL, fsp, wcp->data, wcp->offset, data_size);
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index a1bbb1e..b4e6d56 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -199,40 +199,42 @@ bool status_profile_dump(bool verbose)
profile_p->statcache_hits);
profile_separator("Write Cache");
- d_printf("read_hits: %u\n",
- profile_p->writecache_read_hits);
- d_printf("abutted_writes: %u\n",
- profile_p->writecache_abutted_writes);
+ d_printf("allocations: %u\n",
+ profile_p->writecache_allocations);
+ d_printf("deallocations: %u\n",
+ profile_p->writecache_deallocations);
+ d_printf("cached_reads: %u\n",
+ profile_p->writecache_cached_reads);
d_printf("total_writes: %u\n",
profile_p->writecache_total_writes);
+ d_printf("init_writes: %u\n",
+ profile_p->writecache_init_writes);
+ d_printf("abutted_writes: %u\n",
+ profile_p->writecache_abutted_writes);
d_printf("non_oplock_writes: %u\n",
profile_p->writecache_non_oplock_writes);
d_printf("direct_writes: %u\n",
profile_p->writecache_direct_writes);
- d_printf("init_writes: %u\n",
- profile_p->writecache_init_writes);
- d_printf("flushed_writes[SEEK]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_SEEK_FLUSH]);
- d_printf("flushed_writes[READ]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_READ_FLUSH]);
- d_printf("flushed_writes[WRITE]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_WRITE_FLUSH]);
- d_printf("flushed_writes[READRAW]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_READRAW_FLUSH]);
- d_printf("flushed_writes[OPLOCK_RELEASE]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_OPLOCK_RELEASE_FLUSH]);
- d_printf("flushed_writes[CLOSE]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_CLOSE_FLUSH]);
- d_printf("flushed_writes[SYNC]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_SYNC_FLUSH]);
- d_printf("flushed_writes[SIZECHANGE]: %u\n",
- profile_p->writecache_flushed_writes[SAMBA_SIZECHANGE_FLUSH]);
- d_printf("num_perfect_writes: %u\n",
- profile_p->writecache_num_perfect_writes);
- d_printf("num_write_caches: %u\n",
- profile_p->writecache_num_write_caches);
- d_printf("allocated_write_caches: %u\n",
- profile_p->writecache_allocated_write_caches);
+ d_printf("cached_writes: %u\n",
+ profile_p->writecache_cached_writes);
+ d_printf("perfect_writes: %u\n",
+ profile_p->writecache_perfect_writes);
+ d_printf("flush_reason_seek: %u\n",
+ profile_p->writecache_flush_reason_seek);
+ d_printf("flush_reason_read: %u\n",
+ profile_p->writecache_flush_reason_read);
+ d_printf("flush_reason_readraw: %u\n",
+ profile_p->writecache_flush_reason_readraw);
+ d_printf("flush_reason_write: %u\n",
+ profile_p->writecache_flush_reason_write);
+ d_printf("flush_reason_oplock: %u\n",
+ profile_p->writecache_flush_reason_oplock);
+ d_printf("flush_reason_close: %u\n",
+ profile_p->writecache_flush_reason_close);
+ d_printf("flush_reason_sync: %u\n",
+ profile_p->writecache_flush_reason_sync);
+ d_printf("flush_reason_sizechange: %u\n",
+ profile_p->writecache_flush_reason_sizechange);
profile_separator("SMB Calls");
d_printf("mkdir_count: %u\n",
--
1.9.1
From 86ecd802c104681072367a1ca4e8bd8bb33b3c33 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 9 Oct 2014 12:41:03 +0000
Subject: [PATCH 07/18] s3:smbprofile: Make smbprofile.h includable on its own
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 26a2ed1..9f7b3a2 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -909,6 +909,8 @@ static inline uint64_t profile_timestamp(void)
/* The following definitions come from profile/profile.c */
void set_profile_level(int level, struct server_id src);
+
+struct messaging_context;
bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
#endif
--
1.9.1
From 3088f7f7ce88fdddaae67c4198dde714812287ca Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 10 Oct 2014 14:18:50 +0200
Subject: [PATCH 08/18] s3:smbprofile: Make "status_profile.h" a proper header
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
source3/utils/status.c | 4 +---
source3/utils/status_profile.c | 4 +---
source3/utils/status_profile.h | 28 ++++++++++++++++++++++++++++
source3/utils/status_profile_dummy.c | 1 +
4 files changed, 31 insertions(+), 6 deletions(-)
create mode 100644 source3/utils/status_profile.h
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 978d3c5..64c2a93 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -44,6 +44,7 @@
#include "librpc/gen_ndr/notify.h"
#include "lib/conn_tdb.h"
#include "serverid.h"
+#include "status_profile.h"
#define SMB_MAXPIDS 2048
static uid_t Ucrit_uid = 0; /* added by OH */
@@ -61,9 +62,6 @@ static bool do_checks = true;
const char *username = NULL;
-extern bool status_profile_dump(bool be_verbose);
-extern bool status_profile_rates(bool be_verbose);
-
/* added by OH */
static void Ucrit_addUid(uid_t uid)
{
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index b4e6d56..059d321 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -20,9 +20,7 @@
#include "includes.h"
#include "smbprofile.h"
-
-bool status_profile_dump(bool be_verbose);
-bool status_profile_rates(bool be_verbose);
+#include "status_profile.h"
static void profile_separator(const char * title)
{
diff --git a/source3/utils/status_profile.h b/source3/utils/status_profile.h
new file mode 100644
index 0000000..a8a73e1
--- /dev/null
+++ b/source3/utils/status_profile.h
@@ -0,0 +1,28 @@
+/*
+ * Samba Unix/Linux SMB client library
+ * Dump profiles
+ * Copyright (C) Volker Lendecke 2014
+ *
+ * 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 __STATUS_PROFILE_H__
+#define __STATUS_PROFILE_H__
+
+#include "replace.h"
+
+bool status_profile_dump(bool be_verbose);
+bool status_profile_rates(bool be_verbose);
+
+#endif
diff --git a/source3/utils/status_profile_dummy.c b/source3/utils/status_profile_dummy.c
index c58f696..dfc5da7 100644
--- a/source3/utils/status_profile_dummy.c
+++ b/source3/utils/status_profile_dummy.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "smbprofile.h"
+#include "status_profile.h"
bool status_profile_dump(bool be_verbose)
{
--
1.9.1
From cdd2bf9eb7af622b8ed7cdcbaade57675da01213 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 9 Oct 2014 12:56:28 +0000
Subject: [PATCH 09/18] param: add "smbd profiling level" option
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
docs-xml/smbdotconf/misc/smbdprofilinglevel.xml | 16 ++++++++++++++++
lib/param/loadparm.c | 2 ++
lib/param/param_table.c | 13 +++++++++++++
source3/param/loadparm.c | 1 +
4 files changed, 32 insertions(+)
create mode 100644 docs-xml/smbdotconf/misc/smbdprofilinglevel.xml
diff --git a/docs-xml/smbdotconf/misc/smbdprofilinglevel.xml b/docs-xml/smbdotconf/misc/smbdprofilinglevel.xml
new file mode 100644
index 0000000..d92e5dc
--- /dev/null
+++ b/docs-xml/smbdotconf/misc/smbdprofilinglevel.xml
@@ -0,0 +1,16 @@
+<samba:parameter name="smbd profiling level"
+ context="G"
+ type="enum"
+ xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+ <para>
+ This parameter allows the administrator to enable profiling support.
+ </para>
+ <para>
+ Possible values are <constant>off</constant>,
+ <constant>count</constant> and <constant>on</constant>.
+ </para>
+</description>
+<value type="default">off</value>
+<value type="example">on</value>
+</samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index b9a3e20..30b1155 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2634,6 +2634,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
lpcfg_do_global_parameter(lp_ctx, "keepalive", "300");
+ lpcfg_do_global_parameter(lp_ctx, "smbd profiling level", "off");
+
lpcfg_do_global_parameter(lp_ctx, "winbind cache time", "300");
lpcfg_do_global_parameter(lp_ctx, "level2 oplocks", "yes");
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 7a13e6f..5dbcda8 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -174,6 +174,10 @@ static const struct enum_list enum_config_backend[] = {
{-1, NULL}
};
+static const struct enum_list enum_smbd_profiling_level[] = {
+ {0, "off"}, {1, "count"}, {2, "on"}, {-1, NULL}
+};
+
/* ADS kerberos ticket verification options */
@@ -1510,6 +1514,15 @@ struct parm_struct parm_table[] = {
.flags = FLAG_ADVANCED,
},
{
+ .label = "smbd profiling level",
+ .type = P_ENUM,
+ .p_class = P_GLOBAL,
+ .offset = GLOBAL_VAR(smbd_profiling_level),
+ .special = NULL,
+ .enum_list = enum_smbd_profiling_level,
+ .flags = FLAG_ADVANCED,
+ },
+ {
.label = "profile acls",
.type = P_BOOL,
.p_class = P_LOCAL,
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d6ba8fb..f246c28 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -688,6 +688,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
Globals.passwd_chat_timeout = 2; /* 2 second default. */
Globals.nt_pipe_support = true; /* Do NT pipes by default. */
Globals.nt_status_support = true; /* Use NT status by default. */
+ Globals.smbd_profiling_level = 0;
Globals.stat_cache = true; /* use stat cache by default */
Globals.max_stat_cache_size = 256; /* 256k by default */
Globals.restrict_anonymous = 0;
--
1.9.1
From 1595101e0ca74db9e7327af4b3ebf47e2c43d4ba Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 10 Oct 2014 13:38:27 +0200
Subject: [PATCH 10/18] s3:smbd: Use "smbd profiling level"
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Volker Lendecke <vl at samba.org>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/smbd/server.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 0d649e1..8c90fe8 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1091,6 +1091,7 @@ extern void build_options(bool screen);
struct messaging_context *msg_ctx;
struct server_id server_id;
struct tevent_signal *se;
+ int profiling_level;
char *np_dir = NULL;
static const struct smbd_shim smbd_shim_fns =
{
@@ -1308,14 +1309,13 @@ extern void build_options(bool screen);
DEBUG(0,("ERROR: failed to setup profiling\n"));
return -1;
}
- if (profile_level != NULL) {
- int pl = atoi(profile_level);
- struct server_id src;
- DEBUG(1, ("setting profiling level: %s\n",profile_level));
- src.pid = getpid();
- set_profile_level(pl, src);
+ if (profile_level != NULL) {
+ profiling_level = atoi(profile_level);
+ } else {
+ profiling_level = lp_smbd_profiling_level();
}
+ set_profile_level(profiling_level, messaging_server_id(msg_ctx));
if (!is_daemon && !is_a_socket(0)) {
if (!interactive) {
--
1.9.1
From 49502a8e8d38e4e8073593ddbcef685effb7c3fe Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 23 Oct 2014 18:06:15 +0200
Subject: [PATCH 11/18] s3:smbprofile: rewrite the internal macros
We now autogenerate a lot of code using
SMBPROFILE_STATS_ALL_SECTIONS macro which expands to
different SMBPROFILE_STATS_{COUNT,BASIC,BYTES,IOBYTES} macros.
This also allows async profiling using:
struct mystate {
...
SMBPROFILE_BASIC_ASYNC_STATE(profile_state);
...
};
...
SMBPROFILE_BASIC_ASYNC_START(SMB2_negotiate, profile_p, mystate->profile_state);
...
SMBPROFILE_BYTES_ASYNC_SET_IDLE(mystate->profile_state);
...
SMBPROFILE_BYTES_ASYNC_SET_BUSY(mystate->profile_state);
...
SMBPROFILE_BASIC_ASYNC_END(mystate->profile_state);
The current START_PROFILE*()/END_PROFILE*() are implemented as legacy wrappers.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 1296 +++++++++++++++-------------------------
source3/profile/profile.c | 189 +-----
source3/utils/status_profile.c | 929 +++++++---------------------
3 files changed, 686 insertions(+), 1728 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 9f7b3a2..bae691b 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -23,804 +23,449 @@
#ifdef WITH_PROFILE
+#define SMBPROFILE_STATS_ALL_SECTIONS \
+ SMBPROFILE_STATS_START \
+ \
+ SMBPROFILE_STATS_SECTION_START("SMBD loop") \
+ SMBPROFILE_STATS_COUNT(smb_count) \
+ SMBPROFILE_STATS_COUNT(uid_changes) \
+ SMBPROFILE_STATS_BASIC(smbd_idle) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("System Calls") \
+ SMBPROFILE_STATS_BASIC(syscall_opendir) \
+ SMBPROFILE_STATS_BASIC(syscall_fdopendir) \
+ SMBPROFILE_STATS_BASIC(syscall_readdir) \
+ SMBPROFILE_STATS_BASIC(syscall_seekdir) \
+ SMBPROFILE_STATS_BASIC(syscall_telldir) \
+ SMBPROFILE_STATS_BASIC(syscall_rewinddir) \
+ SMBPROFILE_STATS_BASIC(syscall_mkdir) \
+ SMBPROFILE_STATS_BASIC(syscall_rmdir) \
+ SMBPROFILE_STATS_BASIC(syscall_closedir) \
+ SMBPROFILE_STATS_BASIC(syscall_open) \
+ SMBPROFILE_STATS_BASIC(syscall_createfile) \
+ SMBPROFILE_STATS_BASIC(syscall_close) \
+ SMBPROFILE_STATS_BYTES(syscall_read) \
+ SMBPROFILE_STATS_BYTES(syscall_pread) \
+ SMBPROFILE_STATS_BYTES(syscall_write) \
+ SMBPROFILE_STATS_BYTES(syscall_pwrite) \
+ SMBPROFILE_STATS_BASIC(syscall_lseek) \
+ SMBPROFILE_STATS_BYTES(syscall_sendfile) \
+ SMBPROFILE_STATS_BYTES(syscall_recvfile) \
+ SMBPROFILE_STATS_BASIC(syscall_rename) \
+ SMBPROFILE_STATS_BASIC(syscall_rename_at) \
+ SMBPROFILE_STATS_BASIC(syscall_fsync) \
+ SMBPROFILE_STATS_BASIC(syscall_stat) \
+ SMBPROFILE_STATS_BASIC(syscall_fstat) \
+ SMBPROFILE_STATS_BASIC(syscall_lstat) \
+ SMBPROFILE_STATS_BASIC(syscall_get_alloc_size) \
+ SMBPROFILE_STATS_BASIC(syscall_unlink) \
+ SMBPROFILE_STATS_BASIC(syscall_chmod) \
+ SMBPROFILE_STATS_BASIC(syscall_fchmod) \
+ SMBPROFILE_STATS_BASIC(syscall_chown) \
+ SMBPROFILE_STATS_BASIC(syscall_fchown) \
+ SMBPROFILE_STATS_BASIC(syscall_lchown) \
+ SMBPROFILE_STATS_BASIC(syscall_chdir) \
+ SMBPROFILE_STATS_BASIC(syscall_getwd) \
+ SMBPROFILE_STATS_BASIC(syscall_ntimes) \
+ SMBPROFILE_STATS_BASIC(syscall_ftruncate) \
+ SMBPROFILE_STATS_BASIC(syscall_fallocate) \
+ SMBPROFILE_STATS_BASIC(syscall_fcntl_lock) \
+ SMBPROFILE_STATS_BASIC(syscall_kernel_flock) \
+ SMBPROFILE_STATS_BASIC(syscall_linux_setlease) \
+ SMBPROFILE_STATS_BASIC(syscall_fcntl_getlock) \
+ SMBPROFILE_STATS_BASIC(syscall_readlink) \
+ SMBPROFILE_STATS_BASIC(syscall_symlink) \
+ SMBPROFILE_STATS_BASIC(syscall_link) \
+ SMBPROFILE_STATS_BASIC(syscall_mknod) \
+ SMBPROFILE_STATS_BASIC(syscall_realpath) \
+ SMBPROFILE_STATS_BASIC(syscall_get_quota) \
+ SMBPROFILE_STATS_BASIC(syscall_set_quota) \
+ SMBPROFILE_STATS_BASIC(syscall_get_sd) \
+ SMBPROFILE_STATS_BASIC(syscall_set_sd) \
+ SMBPROFILE_STATS_BASIC(syscall_brl_lock) \
+ SMBPROFILE_STATS_BASIC(syscall_brl_unlock) \
+ SMBPROFILE_STATS_BASIC(syscall_brl_cancel) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("ACL Calls") \
+ SMBPROFILE_STATS_BASIC(get_nt_acl) \
+ SMBPROFILE_STATS_BASIC(fget_nt_acl) \
+ SMBPROFILE_STATS_BASIC(fset_nt_acl) \
+ SMBPROFILE_STATS_BASIC(chmod_acl) \
+ SMBPROFILE_STATS_BASIC(fchmod_acl) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("Stat Cache") \
+ SMBPROFILE_STATS_COUNT(statcache_lookups) \
+ SMBPROFILE_STATS_COUNT(statcache_misses) \
+ SMBPROFILE_STATS_COUNT(statcache_hits) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("Write Cache") \
+ SMBPROFILE_STATS_COUNT(writecache_allocations) \
+ SMBPROFILE_STATS_COUNT(writecache_deallocations) \
+ SMBPROFILE_STATS_COUNT(writecache_cached_reads) \
+ SMBPROFILE_STATS_COUNT(writecache_total_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_init_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_abutted_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_non_oplock_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_direct_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_cached_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_perfect_writes) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_seek) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_read) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_readraw) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_write) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_oplock) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_close) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_sync) \
+ SMBPROFILE_STATS_COUNT(writecache_flush_reason_sizechange) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("SMB Calls") \
+ SMBPROFILE_STATS_BASIC(SMBmkdir) \
+ SMBPROFILE_STATS_BASIC(SMBrmdir) \
+ SMBPROFILE_STATS_BASIC(SMBopen) \
+ SMBPROFILE_STATS_BASIC(SMBcreate) \
+ SMBPROFILE_STATS_BASIC(SMBclose) \
+ SMBPROFILE_STATS_BASIC(SMBflush) \
+ SMBPROFILE_STATS_BASIC(SMBunlink) \
+ SMBPROFILE_STATS_BASIC(SMBmv) \
+ SMBPROFILE_STATS_BASIC(SMBgetatr) \
+ SMBPROFILE_STATS_BASIC(SMBsetatr) \
+ SMBPROFILE_STATS_BASIC(SMBread) \
+ SMBPROFILE_STATS_BASIC(SMBwrite) \
+ SMBPROFILE_STATS_BASIC(SMBlock) \
+ SMBPROFILE_STATS_BASIC(SMBunlock) \
+ SMBPROFILE_STATS_BASIC(SMBctemp) \
+ SMBPROFILE_STATS_BASIC(SMBmknew) \
+ SMBPROFILE_STATS_BASIC(SMBcheckpath) \
+ SMBPROFILE_STATS_BASIC(SMBexit) \
+ SMBPROFILE_STATS_BASIC(SMBlseek) \
+ SMBPROFILE_STATS_BASIC(SMBlockread) \
+ SMBPROFILE_STATS_BASIC(SMBwriteunlock) \
+ SMBPROFILE_STATS_BASIC(SMBreadbraw) \
+ SMBPROFILE_STATS_BASIC(SMBreadBmpx) \
+ SMBPROFILE_STATS_BASIC(SMBreadBs) \
+ SMBPROFILE_STATS_BASIC(SMBwritebraw) \
+ SMBPROFILE_STATS_BASIC(SMBwriteBmpx) \
+ SMBPROFILE_STATS_BASIC(SMBwriteBs) \
+ SMBPROFILE_STATS_BASIC(SMBwritec) \
+ SMBPROFILE_STATS_BASIC(SMBsetattrE) \
+ SMBPROFILE_STATS_BASIC(SMBgetattrE) \
+ SMBPROFILE_STATS_BASIC(SMBlockingX) \
+ SMBPROFILE_STATS_BASIC(SMBtrans) \
+ SMBPROFILE_STATS_BASIC(SMBtranss) \
+ SMBPROFILE_STATS_BASIC(SMBioctl) \
+ SMBPROFILE_STATS_BASIC(SMBioctls) \
+ SMBPROFILE_STATS_BASIC(SMBcopy) \
+ SMBPROFILE_STATS_BASIC(SMBmove) \
+ SMBPROFILE_STATS_BASIC(SMBecho) \
+ SMBPROFILE_STATS_BASIC(SMBwriteclose) \
+ SMBPROFILE_STATS_BASIC(SMBopenX) \
+ SMBPROFILE_STATS_BASIC(SMBreadX) \
+ SMBPROFILE_STATS_BASIC(SMBwriteX) \
+ SMBPROFILE_STATS_BASIC(SMBtrans2) \
+ SMBPROFILE_STATS_BASIC(SMBtranss2) \
+ SMBPROFILE_STATS_BASIC(SMBfindclose) \
+ SMBPROFILE_STATS_BASIC(SMBfindnclose) \
+ SMBPROFILE_STATS_BASIC(SMBtcon) \
+ SMBPROFILE_STATS_BASIC(SMBtdis) \
+ SMBPROFILE_STATS_BASIC(SMBnegprot) \
+ SMBPROFILE_STATS_BASIC(SMBsesssetupX) \
+ SMBPROFILE_STATS_BASIC(SMBulogoffX) \
+ SMBPROFILE_STATS_BASIC(SMBtconX) \
+ SMBPROFILE_STATS_BASIC(SMBdskattr) \
+ SMBPROFILE_STATS_BASIC(SMBsearch) \
+ SMBPROFILE_STATS_BASIC(SMBffirst) \
+ SMBPROFILE_STATS_BASIC(SMBfunique) \
+ SMBPROFILE_STATS_BASIC(SMBfclose) \
+ SMBPROFILE_STATS_BASIC(SMBnttrans) \
+ SMBPROFILE_STATS_BASIC(SMBnttranss) \
+ SMBPROFILE_STATS_BASIC(SMBntcreateX) \
+ SMBPROFILE_STATS_BASIC(SMBntcancel) \
+ SMBPROFILE_STATS_BASIC(SMBntrename) \
+ SMBPROFILE_STATS_BASIC(SMBsplopen) \
+ SMBPROFILE_STATS_BASIC(SMBsplwr) \
+ SMBPROFILE_STATS_BASIC(SMBsplclose) \
+ SMBPROFILE_STATS_BASIC(SMBsplretq) \
+ SMBPROFILE_STATS_BASIC(SMBsends) \
+ SMBPROFILE_STATS_BASIC(SMBsendb) \
+ SMBPROFILE_STATS_BASIC(SMBfwdname) \
+ SMBPROFILE_STATS_BASIC(SMBcancelf) \
+ SMBPROFILE_STATS_BASIC(SMBgetmac) \
+ SMBPROFILE_STATS_BASIC(SMBsendstrt) \
+ SMBPROFILE_STATS_BASIC(SMBsendend) \
+ SMBPROFILE_STATS_BASIC(SMBsendtxt) \
+ SMBPROFILE_STATS_BASIC(SMBinvalid) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("Trans2 Calls") \
+ SMBPROFILE_STATS_BASIC(Trans2_open) \
+ SMBPROFILE_STATS_BASIC(Trans2_findfirst) \
+ SMBPROFILE_STATS_BASIC(Trans2_findnext) \
+ SMBPROFILE_STATS_BASIC(Trans2_qfsinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_setfsinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_qpathinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_setpathinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_qfileinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_setfileinfo) \
+ SMBPROFILE_STATS_BASIC(Trans2_fsctl) \
+ SMBPROFILE_STATS_BASIC(Trans2_ioctl) \
+ SMBPROFILE_STATS_BASIC(Trans2_findnotifyfirst) \
+ SMBPROFILE_STATS_BASIC(Trans2_findnotifynext) \
+ SMBPROFILE_STATS_BASIC(Trans2_mkdir) \
+ SMBPROFILE_STATS_BASIC(Trans2_session_setup) \
+ SMBPROFILE_STATS_BASIC(Trans2_get_dfs_referral) \
+ SMBPROFILE_STATS_BASIC(Trans2_report_dfs_inconsistancy) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("NT Transact Calls") \
+ SMBPROFILE_STATS_BASIC(NT_transact_create) \
+ SMBPROFILE_STATS_BASIC(NT_transact_ioctl) \
+ SMBPROFILE_STATS_BASIC(NT_transact_set_security_desc) \
+ SMBPROFILE_STATS_BASIC(NT_transact_notify_change) \
+ SMBPROFILE_STATS_BASIC(NT_transact_rename) \
+ SMBPROFILE_STATS_BASIC(NT_transact_query_security_desc) \
+ SMBPROFILE_STATS_BASIC(NT_transact_get_user_quota) \
+ SMBPROFILE_STATS_BASIC(NT_transact_set_user_quota) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START("SMB2 Calls") \
+ SMBPROFILE_STATS_BASIC(smb2_negprot) \
+ SMBPROFILE_STATS_BASIC(smb2_sesssetup) \
+ SMBPROFILE_STATS_BASIC(smb2_logoff) \
+ SMBPROFILE_STATS_BASIC(smb2_tcon) \
+ SMBPROFILE_STATS_BASIC(smb2_tdis) \
+ SMBPROFILE_STATS_BASIC(smb2_create) \
+ SMBPROFILE_STATS_BASIC(smb2_close) \
+ SMBPROFILE_STATS_BASIC(smb2_flush) \
+ SMBPROFILE_STATS_BASIC(smb2_read) \
+ SMBPROFILE_STATS_BASIC(smb2_write) \
+ SMBPROFILE_STATS_BASIC(smb2_lock) \
+ SMBPROFILE_STATS_BASIC(smb2_ioctl) \
+ SMBPROFILE_STATS_BASIC(smb2_cancel) \
+ SMBPROFILE_STATS_BASIC(smb2_keepalive) \
+ SMBPROFILE_STATS_BASIC(smb2_find) \
+ SMBPROFILE_STATS_BASIC(smb2_notify) \
+ SMBPROFILE_STATS_BASIC(smb2_getinfo) \
+ SMBPROFILE_STATS_BASIC(smb2_setinfo) \
+ SMBPROFILE_STATS_BASIC(smb2_break) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_END
+
/* this file defines the profile structure in the profile shared
memory area */
/* time values in the following structure are in microseconds */
-#define __profile_stats_value(which, domain) domain[which]
-
-enum profile_stats_values
-{
- PR_VALUE_SMBD_IDLE = 0,
-#define smbd_idle_count __profile_stats_value(PR_VALUE_SMBD_IDLE, count)
-#define smbd_idle_time __profile_stats_value(PR_VALUE_SMBD_IDLE, time)
-
-/* system call counters */
- PR_VALUE_SYSCALL_OPENDIR,
-#define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count)
-#define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
-
- PR_VALUE_SYSCALL_FDOPENDIR,
-#define syscall_fdopendir_count __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, count)
-#define syscall_fdopendir_time __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, time)
-
- PR_VALUE_SYSCALL_READDIR,
-#define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
-#define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time)
-
- PR_VALUE_SYSCALL_SEEKDIR,
-#define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count)
-#define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time)
-
- PR_VALUE_SYSCALL_TELLDIR,
-#define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count)
-#define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time)
-
- PR_VALUE_SYSCALL_REWINDDIR,
-#define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count)
-#define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time)
-
- PR_VALUE_SYSCALL_MKDIR,
-#define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count)
-#define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time)
-
- PR_VALUE_SYSCALL_RMDIR,
-#define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count)
-#define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time)
-
- PR_VALUE_SYSCALL_CLOSEDIR,
-#define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count)
-#define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time)
-
- PR_VALUE_SYSCALL_OPEN,
-#define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
-#define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
-
- PR_VALUE_SYSCALL_CREATEFILE,
-#define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count)
-#define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time)
-
- PR_VALUE_SYSCALL_CLOSE,
-#define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
-#define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
-
- PR_VALUE_SYSCALL_READ,
-#define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count)
-#define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time)
-
- PR_VALUE_SYSCALL_PREAD,
-#define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count)
-#define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time)
-
- PR_VALUE_SYSCALL_WRITE,
-#define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count)
-#define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time)
-
- PR_VALUE_SYSCALL_PWRITE,
-#define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count)
-#define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time)
-
- PR_VALUE_SYSCALL_LSEEK,
-#define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count)
-#define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time)
-
- PR_VALUE_SYSCALL_SENDFILE,
-#define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count)
-#define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time)
-
- PR_VALUE_SYSCALL_RECVFILE,
-#define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count)
-#define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time)
-
- PR_VALUE_SYSCALL_RENAME,
-#define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
-#define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
-
- PR_VALUE_SYSCALL_RENAME_AT,
-#define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count)
-#define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time)
-
- PR_VALUE_SYSCALL_FSYNC,
-#define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
-#define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
-
- PR_VALUE_SYSCALL_STAT,
-#define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count)
-#define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time)
-
- PR_VALUE_SYSCALL_FSTAT,
-#define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count)
-#define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time)
-
- PR_VALUE_SYSCALL_LSTAT,
-#define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count)
-#define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time)
-
- PR_VALUE_SYSCALL_GET_ALLOC_SIZE,
-#define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count)
-#define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time)
-
- PR_VALUE_SYSCALL_UNLINK,
-#define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count)
-#define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time)
-
- PR_VALUE_SYSCALL_CHMOD,
-#define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count)
-#define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time)
-
- PR_VALUE_SYSCALL_FCHMOD,
-#define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count)
-#define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time)
-
- PR_VALUE_SYSCALL_CHOWN,
-#define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count)
-#define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time)
-
- PR_VALUE_SYSCALL_FCHOWN,
-#define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count)
-#define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time)
-
- PR_VALUE_SYSCALL_LCHOWN,
-#define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count)
-#define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time)
-
- PR_VALUE_SYSCALL_CHDIR,
-#define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count)
-#define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time)
-
- PR_VALUE_SYSCALL_GETWD,
-#define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count)
-#define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time)
-
- PR_VALUE_SYSCALL_NTIMES,
-#define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count)
-#define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time)
-
- PR_VALUE_SYSCALL_FTRUNCATE,
-#define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count)
-#define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time)
-
- PR_VALUE_SYSCALL_FALLOCATE,
-#define syscall_fallocate_count __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, count)
-#define syscall_fallocate_time __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, time)
-
- PR_VALUE_SYSCALL_FCNTL_LOCK,
-#define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count)
-#define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time)
-
- PR_VALUE_SYSCALL_KERNEL_FLOCK,
-#define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count)
-#define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time)
-
- PR_VALUE_SYSCALL_LINUX_SETLEASE,
-#define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count)
-#define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time)
-
- PR_VALUE_SYSCALL_FCNTL_GETLOCK,
-#define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count)
-#define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time)
-
- PR_VALUE_SYSCALL_READLINK,
-#define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count)
-#define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time)
-
- PR_VALUE_SYSCALL_SYMLINK,
-#define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count)
-#define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time)
-
- PR_VALUE_SYSCALL_LINK,
-#define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count)
-#define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time)
-
- PR_VALUE_SYSCALL_MKNOD,
-#define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count)
-#define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time)
-
- PR_VALUE_SYSCALL_REALPATH,
-#define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count)
-#define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time)
-
- PR_VALUE_SYSCALL_GET_QUOTA,
-#define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count)
-#define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time)
-
- PR_VALUE_SYSCALL_SET_QUOTA,
-#define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
-#define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
-
- PR_VALUE_SYSCALL_GET_SD,
-#define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count)
-#define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time)
-
- PR_VALUE_SYSCALL_SET_SD,
-#define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count)
-#define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time)
-
- PR_VALUE_SYSCALL_BRL_LOCK,
-#define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count)
-#define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time)
-
- PR_VALUE_SYSCALL_BRL_UNLOCK,
-#define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count)
-#define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time)
-
- PR_VALUE_SYSCALL_BRL_CANCEL,
-#define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count)
-#define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time)
-
- PR_VALUE_SYSCALL_STRICT_LOCK,
-#define syscall_strict_lock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, count)
-#define syscall_strict_lock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, time)
-
- PR_VALUE_SYSCALL_STRICT_UNLOCK,
-#define syscall_strict_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, count)
-#define syscall_strict_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, time)
-
-/* counters for individual SMB types */
- PR_VALUE_SMBMKDIR,
-#define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)
-#define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time)
-
- PR_VALUE_SMBRMDIR,
-#define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count)
-#define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time)
-
- PR_VALUE_SMBOPEN,
-#define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count)
-#define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time)
-
- PR_VALUE_SMBCREATE,
-#define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count)
-#define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time)
-
- PR_VALUE_SMBCLOSE,
-#define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count)
-#define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time)
-
- PR_VALUE_SMBFLUSH,
-#define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count)
-#define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time)
-
- PR_VALUE_SMBUNLINK,
-#define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count)
-#define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time)
-
- PR_VALUE_SMBMV,
-#define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count)
-#define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time)
-
- PR_VALUE_SMBGETATR,
-#define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count)
-#define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time)
-
- PR_VALUE_SMBSETATR,
-#define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count)
-#define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time)
-
- PR_VALUE_SMBREAD,
-#define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count)
-#define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time)
-
- PR_VALUE_SMBWRITE,
-#define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count)
-#define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time)
-
- PR_VALUE_SMBLOCK,
-#define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count)
-#define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time)
-
- PR_VALUE_SMBUNLOCK,
-#define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count)
-#define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time)
-
- PR_VALUE_SMBCTEMP,
-#define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count)
-#define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time)
-
- /* SMBmknew stats are currently combined with SMBcreate */
- PR_VALUE_SMBMKNEW,
-#define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count)
-#define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time)
-
- PR_VALUE_SMBCHECKPATH,
-#define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count)
-#define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time)
-
- PR_VALUE_SMBEXIT,
-#define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count)
-#define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time)
-
- PR_VALUE_SMBLSEEK,
-#define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count)
-#define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time)
-
- PR_VALUE_SMBLOCKREAD,
-#define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count)
-#define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time)
-
- PR_VALUE_SMBWRITEUNLOCK,
-#define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count)
-#define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time)
-
- PR_VALUE_SMBREADBRAW,
-#define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count)
-#define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time)
-
- PR_VALUE_SMBREADBMPX,
-#define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count)
-#define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time)
-
- PR_VALUE_SMBREADBS,
-#define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count)
-#define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time)
-
- PR_VALUE_SMBWRITEBRAW,
-#define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count)
-#define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time)
-
- PR_VALUE_SMBWRITEBMPX,
-#define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count)
-#define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time)
-
- PR_VALUE_SMBWRITEBS,
-#define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count)
-#define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time)
-
- PR_VALUE_SMBWRITEC,
-#define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count)
-#define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time)
-
- PR_VALUE_SMBSETATTRE,
-#define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count)
-#define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time)
-
- PR_VALUE_SMBGETATTRE,
-#define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count)
-#define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time)
-
- PR_VALUE_SMBLOCKINGX,
-#define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count)
-#define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time)
-
- PR_VALUE_SMBTRANS,
-#define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count)
-#define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time)
-
- PR_VALUE_SMBTRANSS,
-#define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count)
-#define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time)
-
- PR_VALUE_SMBIOCTL,
-#define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count)
-#define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time)
-
- PR_VALUE_SMBIOCTLS,
-#define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count)
-#define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time)
-
- PR_VALUE_SMBCOPY,
-#define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count)
-#define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time)
-
- PR_VALUE_SMBMOVE,
-#define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count)
-#define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time)
-
- PR_VALUE_SMBECHO,
-#define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count)
-#define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time)
-
- PR_VALUE_SMBWRITECLOSE,
-#define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count)
-#define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time)
-
- PR_VALUE_SMBOPENX,
-#define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count)
-#define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time)
-
- PR_VALUE_SMBREADX,
-#define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count)
-#define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time)
-
- PR_VALUE_SMBWRITEX,
-#define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count)
-#define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time)
-
- PR_VALUE_SMBTRANS2,
-#define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count)
-#define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time)
-
- PR_VALUE_SMBTRANSS2,
-#define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count)
-#define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time)
-
- PR_VALUE_SMBFINDCLOSE,
-#define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count)
-#define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time)
-
- PR_VALUE_SMBFINDNCLOSE,
-#define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count)
-#define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time)
-
- PR_VALUE_SMBTCON,
-#define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count)
-#define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time)
-
- PR_VALUE_SMBTDIS,
-#define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count)
-#define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time)
-
- PR_VALUE_SMBNEGPROT,
-#define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count)
-#define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time)
-
- PR_VALUE_SMBSESSSETUPX,
-#define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count)
-#define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time)
-
- PR_VALUE_SMBULOGOFFX,
-#define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count)
-#define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time)
-
- PR_VALUE_SMBTCONX,
-#define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count)
-#define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time)
-
- PR_VALUE_SMBDSKATTR,
-#define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count)
-#define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time)
-
- PR_VALUE_SMBSEARCH,
-#define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count)
-#define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time)
-
- /* SBMffirst stats combined with SMBsearch */
- PR_VALUE_SMBFFIRST,
-#define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count)
-#define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time)
-
- /* SBMfunique stats combined with SMBsearch */
- PR_VALUE_SMBFUNIQUE,
-#define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count)
-#define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time)
-
- PR_VALUE_SMBFCLOSE,
-#define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count)
-#define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time)
-
- PR_VALUE_SMBNTTRANS,
-#define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count)
-#define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time)
-
- PR_VALUE_SMBNTTRANSS,
-#define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count)
-#define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time)
-
- PR_VALUE_SMBNTCREATEX,
-#define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count)
-#define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time)
-
- PR_VALUE_SMBNTCANCEL,
-#define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count)
-#define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time)
-
- PR_VALUE_SMBNTRENAME,
-#define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count)
-#define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time)
-
- PR_VALUE_SMBSPLOPEN,
-#define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count)
-#define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time)
-
- PR_VALUE_SMBSPLWR,
-#define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count)
-#define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time)
-
- PR_VALUE_SMBSPLCLOSE,
-#define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count)
-#define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time)
-
- PR_VALUE_SMBSPLRETQ,
-#define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count)
-#define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time)
-
- PR_VALUE_SMBSENDS,
-#define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count)
-#define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time)
-
- PR_VALUE_SMBSENDB,
-#define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count)
-#define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time)
-
- PR_VALUE_SMBFWDNAME,
-#define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count)
-#define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time)
-
- PR_VALUE_SMBCANCELF,
-#define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count)
-#define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time)
-
- PR_VALUE_SMBGETMAC,
-#define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count)
-#define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time)
-
- PR_VALUE_SMBSENDSTRT,
-#define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count)
-#define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time)
-
- PR_VALUE_SMBSENDEND,
-#define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count)
-#define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time)
-
- PR_VALUE_SMBSENDTXT,
-#define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count)
-#define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time)
-
- PR_VALUE_SMBINVALID,
-#define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count)
-#define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time)
-
-/* These are the TRANS2 sub commands */
- PR_VALUE_TRANS2_OPEN,
-#define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count)
-#define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time)
-
- PR_VALUE_TRANS2_FINDFIRST,
-#define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count)
-#define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time)
-
- PR_VALUE_TRANS2_FINDNEXT,
-#define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count)
-#define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time)
-
- PR_VALUE_TRANS2_QFSINFO,
-#define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count)
-#define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time)
-
- PR_VALUE_TRANS2_SETFSINFO,
-#define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count)
-#define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time)
-
- PR_VALUE_TRANS2_QPATHINFO,
-#define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count)
-#define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time)
-
- PR_VALUE_TRANS2_SETPATHINFO,
-#define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count)
-#define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time)
-
- PR_VALUE_TRANS2_QFILEINFO,
-#define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count)
-#define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time)
-
- PR_VALUE_TRANS2_SETFILEINFO,
-#define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count)
-#define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time)
-
- PR_VALUE_TRANS2_FSCTL,
-#define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count)
-#define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time)
-
- PR_VALUE_TRANS2_IOCTL,
-#define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count)
-#define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time)
-
- PR_VALUE_TRANS2_FINDNOTIFYFIRST,
-#define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count)
-#define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time)
-
- PR_VALUE_TRANS2_FINDNOTIFYNEXT,
-#define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count)
-#define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time)
-
- PR_VALUE_TRANS2_MKDIR,
-#define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count)
-#define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time)
-
- PR_VALUE_TRANS2_SESSION_SETUP,
-#define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count)
-#define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time)
-
- PR_VALUE_TRANS2_GET_DFS_REFERRAL,
-#define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count)
-#define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time)
-
- PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY,
-#define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count)
-#define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time)
-
-/* These are the NT transact sub commands. */
- PR_VALUE_NT_TRANSACT_CREATE,
-#define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count)
-#define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time)
-
- PR_VALUE_NT_TRANSACT_IOCTL,
-#define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count)
-#define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time)
-
- PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC,
-#define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count)
-#define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time)
-
- PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE,
-#define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count)
-#define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time)
-
- PR_VALUE_NT_TRANSACT_RENAME,
-#define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count)
-#define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time)
-
- PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC,
-#define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count)
-#define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time)
-
- PR_VALUE_NT_TRANSACT_GET_USER_QUOTA,
-#define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count)
-#define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time)
-
- PR_VALUE_NT_TRANSACT_SET_USER_QUOTA,
-#define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count)
-#define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time)
-
-/* These are ACL manipulation calls */
- PR_VALUE_GET_NT_ACL,
-#define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count)
-#define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time)
-
- PR_VALUE_FGET_NT_ACL,
-#define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count)
-#define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time)
-
- PR_VALUE_FSET_NT_ACL,
-#define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count)
-#define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time)
-
- PR_VALUE_CHMOD_ACL,
-#define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count)
-#define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time)
-
- PR_VALUE_FCHMOD_ACL,
-#define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count)
-#define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, 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)
+struct smbprofile_stats_count {
+ uint64_t count; /* number of events */
+};
- 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)
+struct smbprofile_stats_time {
+ uint64_t time; /* microseconds */
+};
- 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)
+struct smbprofile_stats_time_async {
+ uint64_t start;
+ struct smbprofile_stats_time *stats;
+};
- 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)
+struct smbprofile_stats_basic {
+ uint64_t count; /* number of events */
+ uint64_t time; /* microseconds */
+};
- 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)
+struct smbprofile_stats_basic_async {
+ uint64_t start;
+ struct smbprofile_stats_basic *stats;
+};
- 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)
+struct smbprofile_stats_bytes {
+ uint64_t count; /* number of events */
+ uint64_t time; /* microseconds */
+ uint64_t idle; /* idle time compared to 'time' microseconds */
+ uint64_t bytes; /* bytes */
+};
- 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)
+struct smbprofile_stats_bytes_async {
+ uint64_t start;
+ uint64_t idle_start;
+ uint64_t idle_time;
+ struct smbprofile_stats_bytes *stats;
+};
- /* This must remain the last value. */
- PR_VALUE_MAX
-}; /* enum profile_stats_values */
+struct smbprofile_stats_iobytes {
+ uint64_t count; /* number of events */
+ uint64_t time; /* microseconds */
+ uint64_t idle; /* idle time compared to 'time' microseconds */
+ uint64_t inbytes; /* bytes read */
+ uint64_t outbytes; /* bytes written */
+};
-const char * profile_value_name(enum profile_stats_values val);
+struct smbprofile_stats_iobytes_async {
+ uint64_t start;
+ uint64_t idle_start;
+ uint64_t idle_time;
+ struct smbprofile_stats_iobytes *stats;
+};
struct profile_stats {
-/* general counters */
- unsigned smb_count; /* how many SMB packets we have processed */
- unsigned uid_changes; /* how many times we change our effective uid */
-
-/* system call and protocol operation counters and cumulative times */
- unsigned count[PR_VALUE_MAX];
- unsigned time[PR_VALUE_MAX];
-
-/* cumulative byte counts */
- unsigned syscall_pread_bytes;
- unsigned syscall_pwrite_bytes;
- unsigned syscall_read_bytes;
- unsigned syscall_write_bytes;
- unsigned syscall_sendfile_bytes;
- unsigned syscall_recvfile_bytes;
-
-/* stat cache counters */
- unsigned statcache_lookups;
- unsigned statcache_misses;
- unsigned statcache_hits;
-
-/* write cache counters */
- unsigned writecache_allocations;
- unsigned writecache_deallocations;
- unsigned writecache_cached_reads;
- unsigned writecache_total_writes;
- unsigned writecache_init_writes;
- unsigned writecache_abutted_writes;
- unsigned writecache_non_oplock_writes;
- unsigned writecache_direct_writes;
- unsigned writecache_cached_writes;
- unsigned writecache_perfect_writes;
- unsigned writecache_flush_reason_seek;
- unsigned writecache_flush_reason_read;
- unsigned writecache_flush_reason_readraw;
- unsigned writecache_flush_reason_write;
- unsigned writecache_flush_reason_oplock;
- unsigned writecache_flush_reason_close;
- unsigned writecache_flush_reason_sync;
- unsigned writecache_flush_reason_sizechange;
+#define SMBPROFILE_STATS_START
+#define SMBPROFILE_STATS_SECTION_START(name)
+#define SMBPROFILE_STATS_COUNT(name) \
+ struct smbprofile_stats_count name##_stats;
+#define SMBPROFILE_STATS_TIME(name) \
+ struct smbprofile_stats_time name##_stats;
+#define SMBPROFILE_STATS_BASIC(name) \
+ struct smbprofile_stats_basic name##_stats;
+#define SMBPROFILE_STATS_BYTES(name) \
+ struct smbprofile_stats_bytes name##_stats;
+#define SMBPROFILE_STATS_IOBYTES(name) \
+ struct smbprofile_stats_iobytes name##_stats;
+#define SMBPROFILE_STATS_SECTION_END
+#define SMBPROFILE_STATS_END
+ SMBPROFILE_STATS_ALL_SECTIONS
+#undef SMBPROFILE_STATS_START
+#undef SMBPROFILE_STATS_SECTION_START
+#undef SMBPROFILE_STATS_COUNT
+#undef SMBPROFILE_STATS_TIME
+#undef SMBPROFILE_STATS_BASIC
+#undef SMBPROFILE_STATS_BYTES
+#undef SMBPROFILE_STATS_IOBYTES
+#undef SMBPROFILE_STATS_SECTION_END
+#undef SMBPROFILE_STATS_END
};
+#define _SMBPROFILE_COUNT_INCREMENT(_stats, _area, _v) do { \
+ if (do_profile_flag) { \
+ (_area)->_stats.count += (_v); \
+ } \
+} while(0)
+#define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v) \
+ _SMBPROFILE_COUNT_INCREMENT(_name##_stats, _area, _v)
+
+#define SMBPROFILE_TIME_ASYNC_STATE(_async_name) \
+ struct smbprofile_stats_time_async _async_name;
+#define _SMBPROFILE_TIME_ASYNC_START(_stats, _area, _async) do { \
+ (_async) = (struct smbprofile_stats_time_async) {}; \
+ if (smbprofile_state.config.do_times) { \
+ (_async).stats = &((_area)->_stats), \
+ (_async).start = profile_timestamp(); \
+ } \
+} while(0)
+#define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async) \
+ _SMBPROFILE_TIME_ASYNC_START(_name##_stats, _area, _async)
+#define SMBPROFILE_TIME_ASYNC_END(_async) do { \
+ if ((_async).start != 0) { \
+ (_async).stats->time += profile_timestamp() - (_async).start; \
+ (_async) = (struct smbprofile_stats_basic_async) {}; \
+ } \
+} while(0)
+
+#define SMBPROFILE_BASIC_ASYNC_STATE(_async_name) \
+ struct smbprofile_stats_basic_async _async_name;
+#define _SMBPROFILE_BASIC_ASYNC_START(_stats, _area, _async) do { \
+ (_async) = (struct smbprofile_stats_basic_async) {}; \
+ if (do_profile_flag) { \
+ if (do_profile_times) { \
+ (_async).start = profile_timestamp(); \
+ (_async).stats = &((_area)->_stats); \
+ } \
+ (_area)->_stats.count += 1; \
+ } \
+} while(0)
+#define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async) \
+ _SMBPROFILE_BASIC_ASYNC_START(_name##_stats, _area, _async)
+#define SMBPROFILE_BASIC_ASYNC_END(_async) do { \
+ if ((_async).start != 0) { \
+ (_async).stats->time += profile_timestamp() - (_async).start; \
+ (_async) = (struct smbprofile_stats_basic_async) {}; \
+ } \
+} while(0)
+
+#define _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async) do { \
+ (_async).stats = &((_area)->_stats); \
+ if (do_profile_times) { \
+ (_async).start = profile_timestamp(); \
+ } \
+} while(0)
+#define _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async) do { \
+ if ((_async).start != 0) { \
+ if ((_async).idle_start == 0) { \
+ (_async).idle_start = profile_timestamp(); \
+ } \
+ } \
+} while(0)
+#define _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async) do { \
+ if ((_async).idle_start != 0) { \
+ (_async).idle_time += \
+ profile_timestamp() - (_async).idle_start; \
+ (_async).idle_start = 0; \
+ } \
+} while(0)
+#define _SMBPROFILE_TIMER_ASYNC_END(_async) do { \
+ if ((_async).start != 0) { \
+ _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async); \
+ (_async).stats->time += profile_timestamp() - (_async).start; \
+ (_async).stats->idle += (_async).idle_time; \
+ } \
+} while(0)
+
+#define SMBPROFILE_BYTES_ASYNC_STATE(_async_name) \
+ struct smbprofile_stats_bytes_async _async_name;
+#define _SMBPROFILE_BYTES_ASYNC_START(_stats, _area, _async, _bytes) do { \
+ (_async) = (struct smbprofile_stats_bytes_async) {}; \
+ if (do_profile_flag) { \
+ _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
+ (_area)->_stats.count += 1; \
+ (_area)->_stats.bytes += (_bytes); \
+ } \
+} while(0)
+#define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _bytes) \
+ _SMBPROFILE_BYTES_ASYNC_START(_name##_stats, _area, _async, _bytes)
+#define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async) \
+ _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async)
+#define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async) \
+ _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async)
+#define SMBPROFILE_BYTES_ASYNC_END(_async) do { \
+ if ((_async).stats != NULL) { \
+ _SMBPROFILE_TIMER_ASYNC_END(_async); \
+ (_async) = (struct smbprofile_stats_bytes_async) {}; \
+ } \
+} while(0)
+
+#define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name) \
+ struct smbprofile_stats_iobytes_async _async_name;
+#define _SMBPROFILE_IOBYTES_ASYNC_START(_stats, _area, _async, _inbytes) do { \
+ (_async) = (struct smbprofile_stats_iobytes_async) {}; \
+ if (do_profile_flag) { \
+ _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
+ (_area)->_stats.count += 1; \
+ (_area)->_stats.inbytes += (_inbytes); \
+ } \
+} while(0)
+#define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes) \
+ _SMBPROFILE_IOBYTES_ASYNC_START(_name##_stats, _area, _async, _inbytes)
+#define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async) \
+ _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async)
+#define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async) \
+ _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async)
+#define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes) do { \
+ if ((_async).stats != NULL) { \
+ (_async).stats->outbytes += (_outbytes); \
+ _SMBPROFILE_TIMER_ASYNC_END(_async); \
+ (_async) = (struct smbprofile_stats_iobytes_async) {}; \
+ } \
+} while(0)
+
extern struct profile_stats *profile_p;
extern bool do_profile_flag;
extern bool do_profile_times;
-/* these are helper macros - do not call them directly in the code
- * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones
- * below which test for the profile flags first
- */
-#define INC_PROFILE_COUNT(x) profile_p->x++
-#define DEC_PROFILE_COUNT(x) profile_p->x--
-#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
-
static inline uint64_t profile_timestamp(void)
{
struct timespec ts;
@@ -831,72 +476,65 @@ static inline uint64_t profile_timestamp(void)
return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
}
-/* end of helper macros */
-
#define DO_PROFILE_INC(x) \
- if (do_profile_flag) { \
- INC_PROFILE_COUNT(x); \
- }
+ _SMBPROFILE_COUNT_INCREMENT(x##_stats, profile_p, 1); \
-#define DO_PROFILE_DEC(x) \
- if (do_profile_flag) { \
- DEC_PROFILE_COUNT(x); \
- }
-
-#define DO_PROFILE_DEC_INC(x,y) \
- if (do_profile_flag) { \
- DEC_PROFILE_COUNT(x); \
- INC_PROFILE_COUNT(y); \
- }
-
-#define DO_PROFILE_ADD(x,n) \
- if (do_profile_flag) { \
- ADD_PROFILE_COUNT(x,n); \
- }
-
-#define START_PROFILE_RAW(x, _stamp, _count) \
- _stamp = 0; \
- if (do_profile_flag) { \
- _stamp = do_profile_times ? profile_timestamp() : 0;\
- INC_PROFILE_COUNT(_count); \
- }
-
-#define START_PROFILE_STAMP(x, _stamp) \
- START_PROFILE_RAW(x, _stamp, x##_count)
+#define START_PROFILE_STAMP(x, _stamp) do { \
+ struct smbprofile_stats_basic_async __profasync_##x = {}; \
+ _SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x); \
+ _stamp = __profasync_##x.start; \
+} while(0)
#define START_PROFILE(x) \
- uint64_t __profstamp_##x = 0; \
- START_PROFILE_RAW(x, __profstamp_##x, x##_count)
+ struct smbprofile_stats_basic_async __profasync_##x = {}; \
+ _SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x);
#define START_PROFILE_BYTES(x,n) \
- uint64_t __profstamp_##x = 0; \
- if (do_profile_flag) { \
- __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
- INC_PROFILE_COUNT(x##_count); \
- ADD_PROFILE_COUNT(x##_bytes, n); \
- }
-
-#define END_PROFILE_RAW(x, _stamp, _time) \
- if (do_profile_times) { \
- ADD_PROFILE_COUNT(_time, \
- profile_timestamp() - _stamp); \
- }
-
-#define END_PROFILE_STAMP(x, _stamp) \
- END_PROFILE_RAW(x, _stamp, x##_time)
+ struct smbprofile_stats_bytes_async __profasync_##x = {}; \
+ _SMBPROFILE_BYTES_ASYNC_START(x##_stats, profile_p, __profasync_##x, n);
+
+#define END_PROFILE_STAMP(x, _stamp) do { \
+ struct smbprofile_stats_basic_async __profasync_##x = {}; \
+ if (do_profile_flag && do_profile_times) { \
+ __profasync_##x = (struct smbprofile_stats_basic_async) { \
+ .start = (_stamp), \
+ .stats = &(profile_p->x##_stats), \
+ }; \
+ } \
+ SMBPROFILE_BASIC_ASYNC_END(__profasync_##x); \
+} while(0)
#define END_PROFILE(x) \
- END_PROFILE_RAW(x, __profstamp_##x, x##_time)
+ SMBPROFILE_BASIC_ASYNC_END(__profasync_##x)
#define END_PROFILE_BYTES(x) \
- END_PROFILE_RAW(x, __profstamp_##x, x##_time)
+ SMBPROFILE_BYTES_ASYNC_END(__profasync_##x)
#else /* WITH_PROFILE */
+#define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v)
+
+#define SMBPROFILE_TIME_ASYNC_STATE(_async_name)
+#define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async)
+#define SMBPROFILE_TIME_ASYNC_END(_async)
+
+#define SMBPROFILE_BASIC_ASYNC_STATE(_async_name)
+#define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async)
+#define SMBPROFILE_BASIC_ASYNC_END(_async)
+
+#define SMBPROFILE_BYTES_ASYNC_STATE(_async_name)
+#define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _inbytes)
+#define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async)
+#define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async)
+#define SMBPROFILE_BYTES_ASYNC_END(_async)
+
+#define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name)
+#define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes)
+#define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async)
+#define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async)
+#define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes)
+
#define DO_PROFILE_INC(x)
-#define DO_PROFILE_DEC(x)
-#define DO_PROFILE_DEC_INC(x,y)
-#define DO_PROFILE_ADD(x,n)
#define START_PROFILE_STAMP(x, _stamp)
#define START_PROFILE(x)
#define START_PROFILE_BYTES(x,n)
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index faeae7a..c720638 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -27,7 +27,7 @@
#define PROF_SHMEM_KEY ((key_t)0x07021999)
#define PROF_SHM_MAGIC 0x6349985
-#define PROF_SHM_VERSION 14
+#define PROF_SHM_VERSION 15
#define IPC_PERMS ((S_IRUSR | S_IWUSR) | S_IRGRP | S_IROTH)
@@ -194,190 +194,3 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
}
return True;
}
-
- const char * profile_value_name(enum profile_stats_values val)
-{
- static const char * valnames[PR_VALUE_MAX + 1] =
- {
- "smbd_idle", /* PR_VALUE_SMBD_IDLE */
- "syscall_opendir", /* PR_VALUE_SYSCALL_OPENDIR */
- "syscall_readdir", /* PR_VALUE_SYSCALL_READDIR */
- "syscall_seekdir", /* PR_VALUE_SYSCALL_SEEKDIR */
- "syscall_telldir", /* PR_VALUE_SYSCALL_TELLDIR */
- "syscall_rewinddir", /* PR_VALUE_SYSCALL_REWINDDIR */
- "syscall_mkdir", /* PR_VALUE_SYSCALL_MKDIR */
- "syscall_rmdir", /* PR_VALUE_SYSCALL_RMDIR */
- "syscall_closedir", /* PR_VALUE_SYSCALL_CLOSEDIR */
- "syscall_open", /* PR_VALUE_SYSCALL_OPEN */
- "syscall_createfile", /* PR_VALUE_SYSCALL_CREATEFILE */
- "syscall_close", /* PR_VALUE_SYSCALL_CLOSE */
- "syscall_read", /* PR_VALUE_SYSCALL_READ */
- "syscall_pread", /* PR_VALUE_SYSCALL_PREAD */
- "syscall_write", /* PR_VALUE_SYSCALL_WRITE */
- "syscall_pwrite", /* PR_VALUE_SYSCALL_PWRITE */
- "syscall_lseek", /* PR_VALUE_SYSCALL_LSEEK */
- "syscall_sendfile", /* PR_VALUE_SYSCALL_SENDFILE */
- "syscall_recvfile", /* PR_VALUE_SYSCALL_RECVFILE */
- "syscall_rename", /* PR_VALUE_SYSCALL_RENAME */
- "syscall_rename_at", /* PR_VALUE_SYSCALL_RENAME_AT */
- "syscall_fsync", /* PR_VALUE_SYSCALL_FSYNC */
- "syscall_stat", /* PR_VALUE_SYSCALL_STAT */
- "syscall_fstat", /* PR_VALUE_SYSCALL_FSTAT */
- "syscall_lstat", /* PR_VALUE_SYSCALL_LSTAT */
- "syscall_unlink", /* PR_VALUE_SYSCALL_UNLINK */
- "syscall_chmod", /* PR_VALUE_SYSCALL_CHMOD */
- "syscall_fchmod", /* PR_VALUE_SYSCALL_FCHMOD */
- "syscall_chown", /* PR_VALUE_SYSCALL_CHOWN */
- "syscall_fchown", /* PR_VALUE_SYSCALL_FCHOWN */
- "syscall_chdir", /* PR_VALUE_SYSCALL_CHDIR */
- "syscall_getwd", /* PR_VALUE_SYSCALL_GETWD */
- "syscall_ntimes", /* PR_VALUE_SYSCALL_NTIMES */
- "syscall_ftruncate", /* PR_VALUE_SYSCALL_FTRUNCATE */
- "syscall_fallocate", /* PR_VALUE_SYSCALL_FALLOCATE */
- "syscall_fcntl_lock", /* PR_VALUE_SYSCALL_FCNTL_LOCK */
- "syscall_kernel_flock", /* PR_VALUE_SYSCALL_KERNEL_FLOCK */
- "syscall_linux_setlease", /* PR_VALUE_SYSCALL_LINUX_SETLEASE */
- "syscall_fcntl_getlock", /* PR_VALUE_SYSCALL_FCNTL_GETLOCK */
- "syscall_readlink", /* PR_VALUE_SYSCALL_READLINK */
- "syscall_symlink", /* PR_VALUE_SYSCALL_SYMLINK */
- "syscall_link", /* PR_VALUE_SYSCALL_LINK */
- "syscall_mknod", /* PR_VALUE_SYSCALL_MKNOD */
- "syscall_realpath", /* PR_VALUE_SYSCALL_REALPATH */
- "syscall_get_quota", /* PR_VALUE_SYSCALL_GET_QUOTA */
- "syscall_set_quota", /* PR_VALUE_SYSCALL_SET_QUOTA */
- "syscall_get_sd", /* PR_VALUE_SYSCALL_GET_SD */
- "syscall_set_sd", /* PR_VALUE_SYSCALL_SET_SD */
- "syscall_brl_lock", /* PR_VALUE_SYSCALL_BRL_LOCK */
- "syscall_brl_unlock", /* PR_VALUE_SYSCALL_BRL_UNLOCK */
- "syscall_brl_cancel", /* PR_VALUE_SYSCALL_BRL_CANCEL */
- "SMBmkdir", /* PR_VALUE_SMBMKDIR */
- "SMBrmdir", /* PR_VALUE_SMBRMDIR */
- "SMBopen", /* PR_VALUE_SMBOPEN */
- "SMBcreate", /* PR_VALUE_SMBCREATE */
- "SMBclose", /* PR_VALUE_SMBCLOSE */
- "SMBflush", /* PR_VALUE_SMBFLUSH */
- "SMBunlink", /* PR_VALUE_SMBUNLINK */
- "SMBmv", /* PR_VALUE_SMBMV */
- "SMBgetatr", /* PR_VALUE_SMBGETATR */
- "SMBsetatr", /* PR_VALUE_SMBSETATR */
- "SMBread", /* PR_VALUE_SMBREAD */
- "SMBwrite", /* PR_VALUE_SMBWRITE */
- "SMBlock", /* PR_VALUE_SMBLOCK */
- "SMBunlock", /* PR_VALUE_SMBUNLOCK */
- "SMBctemp", /* PR_VALUE_SMBCTEMP */
- "SMBmknew", /* PR_VALUE_SMBMKNEW */
- "SMBcheckpath", /* PR_VALUE_SMBCHECKPATH */
- "SMBexit", /* PR_VALUE_SMBEXIT */
- "SMBlseek", /* PR_VALUE_SMBLSEEK */
- "SMBlockread", /* PR_VALUE_SMBLOCKREAD */
- "SMBwriteunlock", /* PR_VALUE_SMBWRITEUNLOCK */
- "SMBreadbraw", /* PR_VALUE_SMBREADBRAW */
- "SMBreadBmpx", /* PR_VALUE_SMBREADBMPX */
- "SMBreadBs", /* PR_VALUE_SMBREADBS */
- "SMBwritebraw", /* PR_VALUE_SMBWRITEBRAW */
- "SMBwriteBmpx", /* PR_VALUE_SMBWRITEBMPX */
- "SMBwriteBs", /* PR_VALUE_SMBWRITEBS */
- "SMBwritec", /* PR_VALUE_SMBWRITEC */
- "SMBsetattrE", /* PR_VALUE_SMBSETATTRE */
- "SMBgetattrE", /* PR_VALUE_SMBGETATTRE */
- "SMBlockingX", /* PR_VALUE_SMBLOCKINGX */
- "SMBtrans", /* PR_VALUE_SMBTRANS */
- "SMBtranss", /* PR_VALUE_SMBTRANSS */
- "SMBioctl", /* PR_VALUE_SMBIOCTL */
- "SMBioctls", /* PR_VALUE_SMBIOCTLS */
- "SMBcopy", /* PR_VALUE_SMBCOPY */
- "SMBmove", /* PR_VALUE_SMBMOVE */
- "SMBecho", /* PR_VALUE_SMBECHO */
- "SMBwriteclose", /* PR_VALUE_SMBWRITECLOSE */
- "SMBopenX", /* PR_VALUE_SMBOPENX */
- "SMBreadX", /* PR_VALUE_SMBREADX */
- "SMBwriteX", /* PR_VALUE_SMBWRITEX */
- "SMBtrans2", /* PR_VALUE_SMBTRANS2 */
- "SMBtranss2", /* PR_VALUE_SMBTRANSS2 */
- "SMBfindclose", /* PR_VALUE_SMBFINDCLOSE */
- "SMBfindnclose", /* PR_VALUE_SMBFINDNCLOSE */
- "SMBtcon", /* PR_VALUE_SMBTCON */
- "SMBtdis", /* PR_VALUE_SMBTDIS */
- "SMBnegprot", /* PR_VALUE_SMBNEGPROT */
- "SMBsesssetupX", /* PR_VALUE_SMBSESSSETUPX */
- "SMBulogoffX", /* PR_VALUE_SMBULOGOFFX */
- "SMBtconX", /* PR_VALUE_SMBTCONX */
- "SMBdskattr", /* PR_VALUE_SMBDSKATTR */
- "SMBsearch", /* PR_VALUE_SMBSEARCH */
- "SMBffirst", /* PR_VALUE_SMBFFIRST */
- "SMBfunique", /* PR_VALUE_SMBFUNIQUE */
- "SMBfclose", /* PR_VALUE_SMBFCLOSE */
- "SMBnttrans", /* PR_VALUE_SMBNTTRANS */
- "SMBnttranss", /* PR_VALUE_SMBNTTRANSS */
- "SMBntcreateX", /* PR_VALUE_SMBNTCREATEX */
- "SMBntcancel", /* PR_VALUE_SMBNTCANCEL */
- "SMBntrename", /* PR_VALUE_SMBNTRENAME */
- "SMBsplopen", /* PR_VALUE_SMBSPLOPEN */
- "SMBsplwr", /* PR_VALUE_SMBSPLWR */
- "SMBsplclose", /* PR_VALUE_SMBSPLCLOSE */
- "SMBsplretq", /* PR_VALUE_SMBSPLRETQ */
- "SMBsends", /* PR_VALUE_SMBSENDS */
- "SMBsendb", /* PR_VALUE_SMBSENDB */
- "SMBfwdname", /* PR_VALUE_SMBFWDNAME */
- "SMBcancelf", /* PR_VALUE_SMBCANCELF */
- "SMBgetmac", /* PR_VALUE_SMBGETMAC */
- "SMBsendstrt", /* PR_VALUE_SMBSENDSTRT */
- "SMBsendend", /* PR_VALUE_SMBSENDEND */
- "SMBsendtxt", /* PR_VALUE_SMBSENDTXT */
- "SMBinvalid", /* PR_VALUE_SMBINVALID */
- "Trans2_open", /* PR_VALUE_TRANS2_OPEN */
- "Trans2_findfirst", /* PR_VALUE_TRANS2_FINDFIRST */
- "Trans2_findnext", /* PR_VALUE_TRANS2_FINDNEXT */
- "Trans2_qfsinfo", /* PR_VALUE_TRANS2_QFSINFO */
- "Trans2_setfsinfo", /* PR_VALUE_TRANS2_SETFSINFO */
- "Trans2_qpathinfo", /* PR_VALUE_TRANS2_QPATHINFO */
- "Trans2_setpathinfo", /* PR_VALUE_TRANS2_SETPATHINFO */
- "Trans2_qfileinfo", /* PR_VALUE_TRANS2_QFILEINFO */
- "Trans2_setfileinfo", /* PR_VALUE_TRANS2_SETFILEINFO */
- "Trans2_fsctl", /* PR_VALUE_TRANS2_FSCTL */
- "Trans2_ioctl", /* PR_VALUE_TRANS2_IOCTL */
- "Trans2_findnotifyfirst", /* PR_VALUE_TRANS2_FINDNOTIFYFIRST */
- "Trans2_findnotifynext", /* PR_VALUE_TRANS2_FINDNOTIFYNEXT */
- "Trans2_mkdir", /* PR_VALUE_TRANS2_MKDIR */
- "Trans2_session_setup", /* PR_VALUE_TRANS2_SESSION_SETUP */
- "Trans2_get_dfs_referral", /* PR_VALUE_TRANS2_GET_DFS_REFERRAL */
- "Trans2_report_dfs_inconsistancy", /* PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY */
- "NT_transact_create", /* PR_VALUE_NT_TRANSACT_CREATE */
- "NT_transact_ioctl", /* PR_VALUE_NT_TRANSACT_IOCTL */
- "NT_transact_set_security_desc", /* PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC */
- "NT_transact_notify_change",/* PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE */
- "NT_transact_rename", /* PR_VALUE_NT_TRANSACT_RENAME */
- "NT_transact_query_security_desc", /* PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC */
- "NT_transact_get_user_quota",/* PR_VALUE_NT_TRANSACT_GET_USER_QUOTA */
- "NT_transact_set_user_quota",/* PR_VALUE_NT_TRANSACT_SET_USER_QUOTA */
- "get_nt_acl", /* PR_VALUE_GET_NT_ACL */
- "fget_nt_acl", /* PR_VALUE_FGET_NT_ACL */
- "fset_nt_acl", /* PR_VALUE_FSET_NT_ACL */
- "chmod_acl", /* PR_VALUE_CHMOD_ACL */
- "fchmod_acl", /* PR_VALUE_FCHMOD_ACL */
- "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 */
- };
-
- SMB_ASSERT(val >= 0);
- SMB_ASSERT(val < PR_VALUE_MAX);
- return valnames[val];
-}
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index 059d321..f0cf405 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -47,686 +47,49 @@ bool status_profile_dump(bool verbose)
return False;
}
- d_printf("smb_count: %u\n",
- profile_p->smb_count);
- d_printf("uid_changes: %u\n",
- profile_p->uid_changes);
-
- profile_separator("System Calls");
- d_printf("opendir_count: %u\n",
- profile_p->syscall_opendir_count);
- d_printf("opendir_time: %u\n",
- profile_p->syscall_opendir_time);
- d_printf("fdopendir_count: %u\n",
- profile_p->syscall_fdopendir_count);
- d_printf("fdopendir_time: %u\n",
- profile_p->syscall_fdopendir_time);
- d_printf("readdir_count: %u\n",
- profile_p->syscall_readdir_count);
- d_printf("readdir_time: %u\n",
- profile_p->syscall_readdir_time);
- d_printf("mkdir_count: %u\n",
- profile_p->syscall_mkdir_count);
- d_printf("mkdir_time: %u\n",
- profile_p->syscall_mkdir_time);
- d_printf("rmdir_count: %u\n",
- profile_p->syscall_rmdir_count);
- d_printf("rmdir_time: %u\n",
- profile_p->syscall_rmdir_time);
- d_printf("closedir_count: %u\n",
- profile_p->syscall_closedir_count);
- d_printf("closedir_time: %u\n",
- profile_p->syscall_closedir_time);
- d_printf("open_count: %u\n",
- profile_p->syscall_open_count);
- d_printf("open_time: %u\n",
- profile_p->syscall_open_time);
- d_printf("close_count: %u\n",
- profile_p->syscall_close_count);
- d_printf("close_time: %u\n",
- profile_p->syscall_close_time);
- d_printf("read_count: %u\n",
- profile_p->syscall_read_count);
- d_printf("read_time: %u\n",
- profile_p->syscall_read_time);
- d_printf("read_bytes: %u\n",
- profile_p->syscall_read_bytes);
- d_printf("write_count: %u\n",
- profile_p->syscall_write_count);
- d_printf("write_time: %u\n",
- profile_p->syscall_write_time);
- d_printf("write_bytes: %u\n",
- profile_p->syscall_write_bytes);
- d_printf("pread_count: %u\n",
- profile_p->syscall_pread_count);
- d_printf("pread_time: %u\n",
- profile_p->syscall_pread_time);
- d_printf("pread_bytes: %u\n",
- profile_p->syscall_pread_bytes);
- d_printf("pwrite_count: %u\n",
- profile_p->syscall_pwrite_count);
- d_printf("pwrite_time: %u\n",
- profile_p->syscall_pwrite_time);
- d_printf("pwrite_bytes: %u\n",
- profile_p->syscall_pwrite_bytes);
- d_printf("sendfile_count: %u\n",
- profile_p->syscall_sendfile_count);
- d_printf("sendfile_time: %u\n",
- profile_p->syscall_sendfile_time);
- d_printf("sendfile_bytes: %u\n",
- profile_p->syscall_sendfile_bytes);
- d_printf("lseek_count: %u\n",
- profile_p->syscall_lseek_count);
- d_printf("lseek_time: %u\n",
- profile_p->syscall_lseek_time);
- d_printf("rename_count: %u\n",
- profile_p->syscall_rename_count);
- d_printf("rename_time: %u\n",
- profile_p->syscall_rename_time);
- d_printf("fsync_count: %u\n",
- profile_p->syscall_fsync_count);
- d_printf("fsync_time: %u\n",
- profile_p->syscall_fsync_time);
- d_printf("stat_count: %u\n",
- profile_p->syscall_stat_count);
- d_printf("stat_time: %u\n",
- profile_p->syscall_stat_time);
- d_printf("fstat_count: %u\n",
- profile_p->syscall_fstat_count);
- d_printf("fstat_time: %u\n",
- profile_p->syscall_fstat_time);
- d_printf("lstat_count: %u\n",
- profile_p->syscall_lstat_count);
- d_printf("lstat_time: %u\n",
- profile_p->syscall_lstat_time);
- d_printf("unlink_count: %u\n",
- profile_p->syscall_unlink_count);
- d_printf("unlink_time: %u\n",
- profile_p->syscall_unlink_time);
- d_printf("chmod_count: %u\n",
- profile_p->syscall_chmod_count);
- d_printf("chmod_time: %u\n",
- profile_p->syscall_chmod_time);
- d_printf("fchmod_count: %u\n",
- profile_p->syscall_fchmod_count);
- d_printf("fchmod_time: %u\n",
- profile_p->syscall_fchmod_time);
- d_printf("chown_count: %u\n",
- profile_p->syscall_chown_count);
- d_printf("chown_time: %u\n",
- profile_p->syscall_chown_time);
- d_printf("fchown_count: %u\n",
- profile_p->syscall_fchown_count);
- d_printf("fchown_time: %u\n",
- profile_p->syscall_fchown_time);
- d_printf("chdir_count: %u\n",
- profile_p->syscall_chdir_count);
- d_printf("chdir_time: %u\n",
- profile_p->syscall_chdir_time);
- d_printf("getwd_count: %u\n",
- profile_p->syscall_getwd_count);
- d_printf("getwd_time: %u\n",
- profile_p->syscall_getwd_time);
- d_printf("ntimes_count: %u\n",
- profile_p->syscall_ntimes_count);
- d_printf("ntimes_time: %u\n",
- profile_p->syscall_ntimes_time);
- d_printf("ftruncate_count: %u\n",
- profile_p->syscall_ftruncate_count);
- d_printf("ftruncate_time: %u\n",
- profile_p->syscall_ftruncate_time);
- d_printf("fcntl_lock_count: %u\n",
- profile_p->syscall_fcntl_lock_count);
- d_printf("fcntl_lock_time: %u\n",
- profile_p->syscall_fcntl_lock_time);
- d_printf("readlink_count: %u\n",
- profile_p->syscall_readlink_count);
- d_printf("readlink_time: %u\n",
- profile_p->syscall_readlink_time);
- d_printf("symlink_count: %u\n",
- profile_p->syscall_symlink_count);
- d_printf("symlink_time: %u\n",
- profile_p->syscall_symlink_time);
-
- profile_separator("Stat Cache");
- d_printf("lookups: %u\n",
- profile_p->statcache_lookups);
- d_printf("misses: %u\n",
- profile_p->statcache_misses);
- d_printf("hits: %u\n",
- profile_p->statcache_hits);
-
- profile_separator("Write Cache");
- d_printf("allocations: %u\n",
- profile_p->writecache_allocations);
- d_printf("deallocations: %u\n",
- profile_p->writecache_deallocations);
- d_printf("cached_reads: %u\n",
- profile_p->writecache_cached_reads);
- d_printf("total_writes: %u\n",
- profile_p->writecache_total_writes);
- d_printf("init_writes: %u\n",
- profile_p->writecache_init_writes);
- d_printf("abutted_writes: %u\n",
- profile_p->writecache_abutted_writes);
- d_printf("non_oplock_writes: %u\n",
- profile_p->writecache_non_oplock_writes);
- d_printf("direct_writes: %u\n",
- profile_p->writecache_direct_writes);
- d_printf("cached_writes: %u\n",
- profile_p->writecache_cached_writes);
- d_printf("perfect_writes: %u\n",
- profile_p->writecache_perfect_writes);
- d_printf("flush_reason_seek: %u\n",
- profile_p->writecache_flush_reason_seek);
- d_printf("flush_reason_read: %u\n",
- profile_p->writecache_flush_reason_read);
- d_printf("flush_reason_readraw: %u\n",
- profile_p->writecache_flush_reason_readraw);
- d_printf("flush_reason_write: %u\n",
- profile_p->writecache_flush_reason_write);
- d_printf("flush_reason_oplock: %u\n",
- profile_p->writecache_flush_reason_oplock);
- d_printf("flush_reason_close: %u\n",
- profile_p->writecache_flush_reason_close);
- d_printf("flush_reason_sync: %u\n",
- profile_p->writecache_flush_reason_sync);
- d_printf("flush_reason_sizechange: %u\n",
- profile_p->writecache_flush_reason_sizechange);
-
- profile_separator("SMB Calls");
- d_printf("mkdir_count: %u\n",
- profile_p->SMBmkdir_count);
- d_printf("mkdir_time: %u\n",
- profile_p->SMBmkdir_time);
- d_printf("rmdir_count: %u\n",
- profile_p->SMBrmdir_count);
- d_printf("rmdir_time: %u\n",
- profile_p->SMBrmdir_time);
- d_printf("open_count: %u\n",
- profile_p->SMBopen_count);
- d_printf("open_time: %u\n",
- profile_p->SMBopen_time);
- d_printf("create_count: %u\n",
- profile_p->SMBcreate_count);
- d_printf("create_time: %u\n",
- profile_p->SMBcreate_time);
- d_printf("close_count: %u\n",
- profile_p->SMBclose_count);
- d_printf("close_time: %u\n",
- profile_p->SMBclose_time);
- d_printf("flush_count: %u\n",
- profile_p->SMBflush_count);
- d_printf("flush_time: %u\n",
- profile_p->SMBflush_time);
- d_printf("unlink_count: %u\n",
- profile_p->SMBunlink_count);
- d_printf("unlink_time: %u\n",
- profile_p->SMBunlink_time);
- d_printf("mv_count: %u\n",
- profile_p->SMBmv_count);
- d_printf("mv_time: %u\n",
- profile_p->SMBmv_time);
- d_printf("getatr_count: %u\n",
- profile_p->SMBgetatr_count);
- d_printf("getatr_time: %u\n",
- profile_p->SMBgetatr_time);
- d_printf("setatr_count: %u\n",
- profile_p->SMBsetatr_count);
- d_printf("setatr_time: %u\n",
- profile_p->SMBsetatr_time);
- d_printf("read_count: %u\n",
- profile_p->SMBread_count);
- d_printf("read_time: %u\n",
- profile_p->SMBread_time);
- d_printf("write_count: %u\n",
- profile_p->SMBwrite_count);
- d_printf("write_time: %u\n",
- profile_p->SMBwrite_time);
- d_printf("lock_count: %u\n",
- profile_p->SMBlock_count);
- d_printf("lock_time: %u\n",
- profile_p->SMBlock_time);
- d_printf("unlock_count: %u\n",
- profile_p->SMBunlock_count);
- d_printf("unlock_time: %u\n",
- profile_p->SMBunlock_time);
- d_printf("ctemp_count: %u\n",
- profile_p->SMBctemp_count);
- d_printf("ctemp_time: %u\n",
- profile_p->SMBctemp_time);
- d_printf("mknew_count: %u\n",
- profile_p->SMBmknew_count);
- d_printf("mknew_time: %u\n",
- profile_p->SMBmknew_time);
- d_printf("checkpath_count: %u\n",
- profile_p->SMBcheckpath_count);
- d_printf("checkpath_time: %u\n",
- profile_p->SMBcheckpath_time);
- d_printf("exit_count: %u\n",
- profile_p->SMBexit_count);
- d_printf("exit_time: %u\n",
- profile_p->SMBexit_time);
- d_printf("lseek_count: %u\n",
- profile_p->SMBlseek_count);
- d_printf("lseek_time: %u\n",
- profile_p->SMBlseek_time);
- d_printf("lockread_count: %u\n",
- profile_p->SMBlockread_count);
- d_printf("lockread_time: %u\n",
- profile_p->SMBlockread_time);
- d_printf("writeunlock_count: %u\n",
- profile_p->SMBwriteunlock_count);
- d_printf("writeunlock_time: %u\n",
- profile_p->SMBwriteunlock_time);
- d_printf("readbraw_count: %u\n",
- profile_p->SMBreadbraw_count);
- d_printf("readbraw_time: %u\n",
- profile_p->SMBreadbraw_time);
- d_printf("readBmpx_count: %u\n",
- profile_p->SMBreadBmpx_count);
- d_printf("readBmpx_time: %u\n",
- profile_p->SMBreadBmpx_time);
- d_printf("readBs_count: %u\n",
- profile_p->SMBreadBs_count);
- d_printf("readBs_time: %u\n",
- profile_p->SMBreadBs_time);
- d_printf("writebraw_count: %u\n",
- profile_p->SMBwritebraw_count);
- d_printf("writebraw_time: %u\n",
- profile_p->SMBwritebraw_time);
- d_printf("writeBmpx_count: %u\n",
- profile_p->SMBwriteBmpx_count);
- d_printf("writeBmpx_time: %u\n",
- profile_p->SMBwriteBmpx_time);
- d_printf("writeBs_count: %u\n",
- profile_p->SMBwriteBs_count);
- d_printf("writeBs_time: %u\n",
- profile_p->SMBwriteBs_time);
- d_printf("writec_count: %u\n",
- profile_p->SMBwritec_count);
- d_printf("writec_time: %u\n",
- profile_p->SMBwritec_time);
- d_printf("setattrE_count: %u\n",
- profile_p->SMBsetattrE_count);
- d_printf("setattrE_time: %u\n",
- profile_p->SMBsetattrE_time);
- d_printf("getattrE_count: %u\n",
- profile_p->SMBgetattrE_count);
- d_printf("getattrE_time: %u\n",
- profile_p->SMBgetattrE_time);
- d_printf("lockingX_count: %u\n",
- profile_p->SMBlockingX_count);
- d_printf("lockingX_time: %u\n",
- profile_p->SMBlockingX_time);
- d_printf("trans_count: %u\n",
- profile_p->SMBtrans_count);
- d_printf("trans_time: %u\n",
- profile_p->SMBtrans_time);
- d_printf("transs_count: %u\n",
- profile_p->SMBtranss_count);
- d_printf("transs_time: %u\n",
- profile_p->SMBtranss_time);
- d_printf("ioctl_count: %u\n",
- profile_p->SMBioctl_count);
- d_printf("ioctl_time: %u\n",
- profile_p->SMBioctl_time);
- d_printf("ioctls_count: %u\n",
- profile_p->SMBioctls_count);
- d_printf("ioctls_time: %u\n",
- profile_p->SMBioctls_time);
- d_printf("copy_count: %u\n",
- profile_p->SMBcopy_count);
- d_printf("copy_time: %u\n",
- profile_p->SMBcopy_time);
- d_printf("move_count: %u\n",
- profile_p->SMBmove_count);
- d_printf("move_time: %u\n",
- profile_p->SMBmove_time);
- d_printf("echo_count: %u\n",
- profile_p->SMBecho_count);
- d_printf("echo_time: %u\n",
- profile_p->SMBecho_time);
- d_printf("writeclose_count: %u\n",
- profile_p->SMBwriteclose_count);
- d_printf("writeclose_time: %u\n",
- profile_p->SMBwriteclose_time);
- d_printf("openX_count: %u\n",
- profile_p->SMBopenX_count);
- d_printf("openX_time: %u\n",
- profile_p->SMBopenX_time);
- d_printf("readX_count: %u\n",
- profile_p->SMBreadX_count);
- d_printf("readX_time: %u\n",
- profile_p->SMBreadX_time);
- d_printf("writeX_count: %u\n",
- profile_p->SMBwriteX_count);
- d_printf("writeX_time: %u\n",
- profile_p->SMBwriteX_time);
- d_printf("trans2_count: %u\n",
- profile_p->SMBtrans2_count);
- d_printf("trans2_time: %u\n",
- profile_p->SMBtrans2_time);
- d_printf("transs2_count: %u\n",
- profile_p->SMBtranss2_count);
- d_printf("transs2_time: %u\n",
- profile_p->SMBtranss2_time);
- d_printf("findclose_count: %u\n",
- profile_p->SMBfindclose_count);
- d_printf("findclose_time: %u\n",
- profile_p->SMBfindclose_time);
- d_printf("findnclose_count: %u\n",
- profile_p->SMBfindnclose_count);
- d_printf("findnclose_time: %u\n",
- profile_p->SMBfindnclose_time);
- d_printf("tcon_count: %u\n",
- profile_p->SMBtcon_count);
- d_printf("tcon_time: %u\n",
- profile_p->SMBtcon_time);
- d_printf("tdis_count: %u\n",
- profile_p->SMBtdis_count);
- d_printf("tdis_time: %u\n",
- profile_p->SMBtdis_time);
- d_printf("negprot_count: %u\n",
- profile_p->SMBnegprot_count);
- d_printf("negprot_time: %u\n",
- profile_p->SMBnegprot_time);
- d_printf("sesssetupX_count: %u\n",
- profile_p->SMBsesssetupX_count);
- d_printf("sesssetupX_time: %u\n",
- profile_p->SMBsesssetupX_time);
- d_printf("ulogoffX_count: %u\n",
- profile_p->SMBulogoffX_count);
- d_printf("ulogoffX_time: %u\n",
- profile_p->SMBulogoffX_time);
- d_printf("tconX_count: %u\n",
- profile_p->SMBtconX_count);
- d_printf("tconX_time: %u\n",
- profile_p->SMBtconX_time);
- d_printf("dskattr_count: %u\n",
- profile_p->SMBdskattr_count);
- d_printf("dskattr_time: %u\n",
- profile_p->SMBdskattr_time);
- d_printf("search_count: %u\n",
- profile_p->SMBsearch_count);
- d_printf("search_time: %u\n",
- profile_p->SMBsearch_time);
- d_printf("ffirst_count: %u\n",
- profile_p->SMBffirst_count);
- d_printf("ffirst_time: %u\n",
- profile_p->SMBffirst_time);
- d_printf("funique_count: %u\n",
- profile_p->SMBfunique_count);
- d_printf("funique_time: %u\n",
- profile_p->SMBfunique_time);
- d_printf("fclose_count: %u\n",
- profile_p->SMBfclose_count);
- d_printf("fclose_time: %u\n",
- profile_p->SMBfclose_time);
- d_printf("nttrans_count: %u\n",
- profile_p->SMBnttrans_count);
- d_printf("nttrans_time: %u\n",
- profile_p->SMBnttrans_time);
- d_printf("nttranss_count: %u\n",
- profile_p->SMBnttranss_count);
- d_printf("nttranss_time: %u\n",
- profile_p->SMBnttranss_time);
- d_printf("ntcreateX_count: %u\n",
- profile_p->SMBntcreateX_count);
- d_printf("ntcreateX_time: %u\n",
- profile_p->SMBntcreateX_time);
- d_printf("ntcancel_count: %u\n",
- profile_p->SMBntcancel_count);
- d_printf("ntcancel_time: %u\n",
- profile_p->SMBntcancel_time);
- d_printf("splopen_count: %u\n",
- profile_p->SMBsplopen_count);
- d_printf("splopen_time: %u\n",
- profile_p->SMBsplopen_time);
- d_printf("splwr_count: %u\n",
- profile_p->SMBsplwr_count);
- d_printf("splwr_time: %u\n",
- profile_p->SMBsplwr_time);
- d_printf("splclose_count: %u\n",
- profile_p->SMBsplclose_count);
- d_printf("splclose_time: %u\n",
- profile_p->SMBsplclose_time);
- d_printf("splretq_count: %u\n",
- profile_p->SMBsplretq_count);
- d_printf("splretq_time: %u\n",
- profile_p->SMBsplretq_time);
- d_printf("sends_count: %u\n",
- profile_p->SMBsends_count);
- d_printf("sends_time: %u\n",
- profile_p->SMBsends_time);
- d_printf("sendb_count: %u\n",
- profile_p->SMBsendb_count);
- d_printf("sendb_time: %u\n",
- profile_p->SMBsendb_time);
- d_printf("fwdname_count: %u\n",
- profile_p->SMBfwdname_count);
- d_printf("fwdname_time: %u\n",
- profile_p->SMBfwdname_time);
- d_printf("cancelf_count: %u\n",
- profile_p->SMBcancelf_count);
- d_printf("cancelf_time: %u\n",
- profile_p->SMBcancelf_time);
- d_printf("getmac_count: %u\n",
- profile_p->SMBgetmac_count);
- d_printf("getmac_time: %u\n",
- profile_p->SMBgetmac_time);
- d_printf("sendstrt_count: %u\n",
- profile_p->SMBsendstrt_count);
- d_printf("sendstrt_time: %u\n",
- profile_p->SMBsendstrt_time);
- d_printf("sendend_count: %u\n",
- profile_p->SMBsendend_count);
- d_printf("sendend_time: %u\n",
- profile_p->SMBsendend_time);
- d_printf("sendtxt_count: %u\n",
- profile_p->SMBsendtxt_count);
- d_printf("sendtxt_time: %u\n",
- profile_p->SMBsendtxt_time);
- d_printf("invalid_count: %u\n",
- profile_p->SMBinvalid_count);
- d_printf("invalid_time: %u\n",
- profile_p->SMBinvalid_time);
-
- profile_separator("Trans2 Calls");
- d_printf("open_count: %u\n",
- profile_p->Trans2_open_count);
- d_printf("open_time: %u\n",
- profile_p->Trans2_open_time);
- d_printf("findfirst_count: %u\n",
- profile_p->Trans2_findfirst_count);
- d_printf("findfirst_time: %u\n",
- profile_p->Trans2_findfirst_time);
- d_printf("findnext_count: %u\n",
- profile_p->Trans2_findnext_count);
- d_printf("findnext_time: %u\n",
- profile_p->Trans2_findnext_time);
- d_printf("qfsinfo_count: %u\n",
- profile_p->Trans2_qfsinfo_count);
- d_printf("qfsinfo_time: %u\n",
- profile_p->Trans2_qfsinfo_time);
- d_printf("setfsinfo_count: %u\n",
- profile_p->Trans2_setfsinfo_count);
- d_printf("setfsinfo_time: %u\n",
- profile_p->Trans2_setfsinfo_time);
- d_printf("qpathinfo_count: %u\n",
- profile_p->Trans2_qpathinfo_count);
- d_printf("qpathinfo_time: %u\n",
- profile_p->Trans2_qpathinfo_time);
- d_printf("setpathinfo_count: %u\n",
- profile_p->Trans2_setpathinfo_count);
- d_printf("setpathinfo_time: %u\n",
- profile_p->Trans2_setpathinfo_time);
- d_printf("qfileinfo_count: %u\n",
- profile_p->Trans2_qfileinfo_count);
- d_printf("qfileinfo_time: %u\n",
- profile_p->Trans2_qfileinfo_time);
- d_printf("setfileinfo_count: %u\n",
- profile_p->Trans2_setfileinfo_count);
- d_printf("setfileinfo_time: %u\n",
- profile_p->Trans2_setfileinfo_time);
- d_printf("fsctl_count: %u\n",
- profile_p->Trans2_fsctl_count);
- d_printf("fsctl_time: %u\n",
- profile_p->Trans2_fsctl_time);
- d_printf("ioctl_count: %u\n",
- profile_p->Trans2_ioctl_count);
- d_printf("ioctl_time: %u\n",
- profile_p->Trans2_ioctl_time);
- d_printf("findnotifyfirst_count: %u\n",
- profile_p->Trans2_findnotifyfirst_count);
- d_printf("findnotifyfirst_time: %u\n",
- profile_p->Trans2_findnotifyfirst_time);
- d_printf("findnotifynext_count: %u\n",
- profile_p->Trans2_findnotifynext_count);
- d_printf("findnotifynext_time: %u\n",
- profile_p->Trans2_findnotifynext_time);
- d_printf("mkdir_count: %u\n",
- profile_p->Trans2_mkdir_count);
- d_printf("mkdir_time: %u\n",
- profile_p->Trans2_mkdir_time);
- d_printf("session_setup_count: %u\n",
- profile_p->Trans2_session_setup_count);
- d_printf("session_setup_time: %u\n",
- profile_p->Trans2_session_setup_time);
- d_printf("get_dfs_referral_count: %u\n",
- profile_p->Trans2_get_dfs_referral_count);
- d_printf("get_dfs_referral_time: %u\n",
- profile_p->Trans2_get_dfs_referral_time);
- d_printf("report_dfs_inconsistancy_count: %u\n",
- profile_p->Trans2_report_dfs_inconsistancy_count);
- d_printf("report_dfs_inconsistancy_time: %u\n",
- profile_p->Trans2_report_dfs_inconsistancy_time);
-
- profile_separator("NT Transact Calls");
- d_printf("create_count: %u\n",
- profile_p->NT_transact_create_count);
- d_printf("create_time: %u\n",
- profile_p->NT_transact_create_time);
- d_printf("ioctl_count: %u\n",
- profile_p->NT_transact_ioctl_count);
- d_printf("ioctl_time: %u\n",
- profile_p->NT_transact_ioctl_time);
- d_printf("set_security_desc_count: %u\n",
- profile_p->NT_transact_set_security_desc_count);
- d_printf("set_security_desc_time: %u\n",
- profile_p->NT_transact_set_security_desc_time);
- d_printf("notify_change_count: %u\n",
- profile_p->NT_transact_notify_change_count);
- d_printf("notify_change_time: %u\n",
- profile_p->NT_transact_notify_change_time);
- d_printf("rename_count: %u\n",
- profile_p->NT_transact_rename_count);
- d_printf("rename_time: %u\n",
- profile_p->NT_transact_rename_time);
- d_printf("query_security_desc_count: %u\n",
- profile_p->NT_transact_query_security_desc_count);
- d_printf("query_security_desc_time: %u\n",
- profile_p->NT_transact_query_security_desc_time);
-
- profile_separator("ACL Calls");
- d_printf("get_nt_acl_count: %u\n",
- profile_p->get_nt_acl_count);
- d_printf("get_nt_acl_time: %u\n",
- profile_p->get_nt_acl_time);
- d_printf("fget_nt_acl_count: %u\n",
- profile_p->fget_nt_acl_count);
- d_printf("fget_nt_acl_time: %u\n",
- profile_p->fget_nt_acl_time);
- d_printf("fset_nt_acl_count: %u\n",
- profile_p->fset_nt_acl_count);
- d_printf("fset_nt_acl_time: %u\n",
- profile_p->fset_nt_acl_time);
- d_printf("chmod_acl_count: %u\n",
- profile_p->chmod_acl_count);
- d_printf("chmod_acl_time: %u\n",
- profile_p->chmod_acl_time);
- d_printf("fchmod_acl_count: %u\n",
- profile_p->fchmod_acl_count);
- d_printf("fchmod_acl_time: %u\n",
- profile_p->fchmod_acl_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);
+#define __PRINT_FIELD_LINE(name, _stats, field) do { \
+ d_printf("%-59s%20ju\n", \
+ name "_" #field ":", \
+ (uintmax_t)profile_p->_stats.field); \
+} while(0);
+#define SMBPROFILE_STATS_START
+#define SMBPROFILE_STATS_SECTION_START(name) profile_separator(#name);
+#define SMBPROFILE_STATS_COUNT(name) do { \
+ __PRINT_FIELD_LINE(#name, name##_stats, count); \
+} while(0);
+#define SMBPROFILE_STATS_TIME(name) do { \
+ __PRINT_FIELD_LINE(#name, name##_stats, time); \
+} while(0);
+#define SMBPROFILE_STATS_BASIC(name) do { \
+ __PRINT_FIELD_LINE(#name, name##_stats, count); \
+ __PRINT_FIELD_LINE(#name, name##_stats, time); \
+} while(0);
+#define SMBPROFILE_STATS_BYTES(name) do { \
+ __PRINT_FIELD_LINE(#name, name##_stats, count); \
+ __PRINT_FIELD_LINE(#name, name##_stats, time); \
+ __PRINT_FIELD_LINE(#name, name##_stats, idle); \
+ __PRINT_FIELD_LINE(#name, name##_stats, bytes); \
+} while(0);
+#define SMBPROFILE_STATS_IOBYTES(name) do { \
+ __PRINT_FIELD_LINE(#name, name##_stats, count); \
+ __PRINT_FIELD_LINE(#name, name##_stats, time); \
+ __PRINT_FIELD_LINE(#name, name##_stats, idle); \
+ __PRINT_FIELD_LINE(#name, name##_stats, inbytes); \
+ __PRINT_FIELD_LINE(#name, name##_stats, outbytes); \
+} while(0);
+#define SMBPROFILE_STATS_SECTION_END
+#define SMBPROFILE_STATS_END
+ SMBPROFILE_STATS_ALL_SECTIONS
+#undef __PRINT_FIELD_LINE
+#undef SMBPROFILE_STATS_START
+#undef SMBPROFILE_STATS_SECTION_START
+#undef SMBPROFILE_STATS_COUNT
+#undef SMBPROFILE_STATS_TIME
+#undef SMBPROFILE_STATS_BASIC
+#undef SMBPROFILE_STATS_BYTES
+#undef SMBPROFILE_STATS_IOBYTES
+#undef SMBPROFILE_STATS_SECTION_END
+#undef SMBPROFILE_STATS_END
return True;
}
@@ -742,52 +105,196 @@ bool status_profile_dump(bool verbose)
#define percent_time(used, period) ((double)(used) / (double)(period) * 100.0 )
-static int print_count_samples(
- const struct profile_stats * const current,
- const struct profile_stats * const last,
+static uint64_t print_count_count_samples(
+ char *buf, const size_t buflen,
+ const char *name,
+ const struct smbprofile_stats_count * const current,
+ const struct smbprofile_stats_count * const last,
uint64_t delta_usec)
{
- int i;
- int count = 0;
- unsigned step;
- uint64_t spent;
- int delta_sec;
- const char * name;
- char buf[40];
+ uint64_t step = current->count - last->count;
+ uint64_t count = 0;
- if (delta_usec == 0) {
- return 0;
+ if (step != 0) {
+ uint64_t delta_sec = usec_to_sec(delta_usec);
+
+ count++;
+
+ if (buf[0] == '\0') {
+ snprintf(buf, buflen,
+ "%s %ju/sec",
+ name, (uintmax_t)(step / delta_sec));
+ } else {
+ printf("%-40s %s %ju/sec\n",
+ buf, name, (uintmax_t)(step / delta_sec));
+ buf[0] = '\0';
+ }
}
- buf[0] = '\0';
- delta_sec = usec_to_sec(delta_usec);
+ return count;
+}
- for (i = 0; i < PR_VALUE_MAX; ++i) {
- step = current->count[i] - last->count[i];
- spent = current->time[i] - last->time[i];
+static uint64_t print_basic_count_samples(
+ char *buf, const size_t buflen,
+ const char *name,
+ const struct smbprofile_stats_basic * const current,
+ const struct smbprofile_stats_basic * const last,
+ uint64_t delta_usec)
+{
+ uint64_t step = current->count - last->count;
+ uint64_t spent = current->time - last->time;
+ uint64_t count = 0;
- if (step) {
- ++count;
+ if (step != 0) {
+ uint64_t delta_sec = usec_to_sec(delta_usec);
- name = profile_value_name(i);
+ count++;
- if (buf[0] == '\0') {
- snprintf(buf, sizeof(buf),
- "%s %d/sec (%.2f%%)",
- name, step / delta_sec,
- percent_time(spent, delta_usec));
- } else {
- printf("%-40s %s %d/sec (%.2f%%)\n",
- buf, name, step / delta_sec,
- percent_time(spent, delta_usec));
- buf[0] = '\0';
- }
+ if (buf[0] == '\0') {
+ snprintf(buf, buflen,
+ "%s %ju/sec (%.2f%%)",
+ name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ } else {
+ printf("%-40s %s %ju/sec (%.2f%%)\n",
+ buf, name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ buf[0] = '\0';
+ }
+ }
+
+ return count;
+}
+
+static uint64_t print_bytes_count_samples(
+ char *buf, const size_t buflen,
+ const char *name,
+ const struct smbprofile_stats_bytes * const current,
+ const struct smbprofile_stats_bytes * const last,
+ uint64_t delta_usec)
+{
+ uint64_t step = current->count - last->count;
+ uint64_t spent = current->time - last->time;
+ uint64_t count = 0;
+
+ if (step != 0) {
+ uint64_t delta_sec = usec_to_sec(delta_usec);
+
+ count++;
+
+ if (buf[0] == '\0') {
+ snprintf(buf, buflen,
+ "%s %ju/sec (%.2f%%)",
+ name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ } else {
+ printf("%-40s %s %ju/sec (%.2f%%)\n",
+ buf, name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ buf[0] = '\0';
}
}
return count;
}
+static uint64_t print_iobytes_count_samples(
+ char *buf, const size_t buflen,
+ const char *name,
+ const struct smbprofile_stats_iobytes * const current,
+ const struct smbprofile_stats_iobytes * const last,
+ uint64_t delta_usec)
+{
+ uint64_t step = current->count - last->count;
+ uint64_t spent = current->time - last->time;
+ uint64_t count = 0;
+
+ if (step != 0) {
+ uint64_t delta_sec = usec_to_sec(delta_usec);
+
+ count++;
+
+ if (buf[0] == '\0') {
+ snprintf(buf, buflen,
+ "%s %ju/sec (%.2f%%)",
+ name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ } else {
+ printf("%-40s %s %ju/sec (%.2f%%)\n",
+ buf, name, (uintmax_t)(step / delta_sec),
+ percent_time(spent, delta_usec));
+ buf[0] = '\0';
+ }
+ }
+
+ return count;
+}
+
+static uint64_t print_count_samples(
+ const struct profile_stats * const current,
+ const struct profile_stats * const last,
+ uint64_t delta_usec)
+{
+ uint64_t count = 0;
+ char buf[40] = { '\0', };
+
+ if (delta_usec == 0) {
+ return 0;
+ }
+
+#define SMBPROFILE_STATS_START
+#define SMBPROFILE_STATS_SECTION_START(name)
+#define SMBPROFILE_STATS_COUNT(name) do { \
+ count += print_count_count_samples(buf, sizeof(buf), \
+ #name, \
+ ¤t->name##_stats, \
+ &last->name##_stats, \
+ delta_usec); \
+} while(0);
+#define SMBPROFILE_STATS_TIME(name) do { \
+} while(0);
+#define SMBPROFILE_STATS_BASIC(name) do { \
+ count += print_basic_count_samples(buf, sizeof(buf), \
+ #name, \
+ ¤t->name##_stats, \
+ &last->name##_stats, \
+ delta_usec); \
+} while(0);
+#define SMBPROFILE_STATS_BYTES(name) do { \
+ count += print_bytes_count_samples(buf, sizeof(buf), \
+ #name, \
+ ¤t->name##_stats, \
+ &last->name##_stats, \
+ delta_usec); \
+} while(0);
+#define SMBPROFILE_STATS_IOBYTES(name) do { \
+ count += print_iobytes_count_samples(buf, sizeof(buf), \
+ #name, \
+ ¤t->name##_stats, \
+ &last->name##_stats, \
+ delta_usec); \
+} while(0);
+#define SMBPROFILE_STATS_SECTION_END
+#define SMBPROFILE_STATS_END
+ SMBPROFILE_STATS_ALL_SECTIONS
+#undef SMBPROFILE_STATS_START
+#undef SMBPROFILE_STATS_SECTION_START
+#undef SMBPROFILE_STATS_COUNT
+#undef SMBPROFILE_STATS_TIME
+#undef SMBPROFILE_STATS_BASIC
+#undef SMBPROFILE_STATS_BYTES
+#undef SMBPROFILE_STATS_IOBYTES
+#undef SMBPROFILE_STATS_SECTION_END
+#undef SMBPROFILE_STATS_END
+
+ if (buf[0] != '\0') {
+ printf("%-40s\n", buf);
+ buf[0] = '\0';
+ }
+
+ return count;
+}
+
static struct profile_stats sample_data[2];
static uint64_t sample_time[2];
--
1.9.1
From 48121cb421da975a2530940bfbe195be88107aef Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 31 Oct 2014 11:15:50 +0100
Subject: [PATCH 12/18] s3:smb2_server: use async smbprofile macros
This improves profiling and corrently counts the total and idle time for async
requests.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 38 +++++-----
source3/smbd/globals.h | 3 +
source3/smbd/smb2_create.c | 1 +
source3/smbd/smb2_lock.c | 4 ++
source3/smbd/smb2_notify.c | 3 +
source3/smbd/smb2_server.c | 161 ++++++++++++++++++-------------------------
6 files changed, 97 insertions(+), 113 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index bae691b..c60f9d9 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -233,25 +233,25 @@
SMBPROFILE_STATS_SECTION_END \
\
SMBPROFILE_STATS_SECTION_START("SMB2 Calls") \
- SMBPROFILE_STATS_BASIC(smb2_negprot) \
- SMBPROFILE_STATS_BASIC(smb2_sesssetup) \
- SMBPROFILE_STATS_BASIC(smb2_logoff) \
- SMBPROFILE_STATS_BASIC(smb2_tcon) \
- SMBPROFILE_STATS_BASIC(smb2_tdis) \
- SMBPROFILE_STATS_BASIC(smb2_create) \
- SMBPROFILE_STATS_BASIC(smb2_close) \
- SMBPROFILE_STATS_BASIC(smb2_flush) \
- SMBPROFILE_STATS_BASIC(smb2_read) \
- SMBPROFILE_STATS_BASIC(smb2_write) \
- SMBPROFILE_STATS_BASIC(smb2_lock) \
- SMBPROFILE_STATS_BASIC(smb2_ioctl) \
- SMBPROFILE_STATS_BASIC(smb2_cancel) \
- SMBPROFILE_STATS_BASIC(smb2_keepalive) \
- SMBPROFILE_STATS_BASIC(smb2_find) \
- SMBPROFILE_STATS_BASIC(smb2_notify) \
- SMBPROFILE_STATS_BASIC(smb2_getinfo) \
- SMBPROFILE_STATS_BASIC(smb2_setinfo) \
- SMBPROFILE_STATS_BASIC(smb2_break) \
+ SMBPROFILE_STATS_IOBYTES(smb2_negprot) \
+ SMBPROFILE_STATS_IOBYTES(smb2_sesssetup) \
+ SMBPROFILE_STATS_IOBYTES(smb2_logoff) \
+ SMBPROFILE_STATS_IOBYTES(smb2_tcon) \
+ SMBPROFILE_STATS_IOBYTES(smb2_tdis) \
+ SMBPROFILE_STATS_IOBYTES(smb2_create) \
+ SMBPROFILE_STATS_IOBYTES(smb2_close) \
+ SMBPROFILE_STATS_IOBYTES(smb2_flush) \
+ SMBPROFILE_STATS_IOBYTES(smb2_read) \
+ SMBPROFILE_STATS_IOBYTES(smb2_write) \
+ SMBPROFILE_STATS_IOBYTES(smb2_lock) \
+ SMBPROFILE_STATS_IOBYTES(smb2_ioctl) \
+ SMBPROFILE_STATS_IOBYTES(smb2_cancel) \
+ SMBPROFILE_STATS_IOBYTES(smb2_keepalive) \
+ SMBPROFILE_STATS_IOBYTES(smb2_find) \
+ SMBPROFILE_STATS_IOBYTES(smb2_notify) \
+ SMBPROFILE_STATS_IOBYTES(smb2_getinfo) \
+ SMBPROFILE_STATS_IOBYTES(smb2_setinfo) \
+ SMBPROFILE_STATS_IOBYTES(smb2_break) \
SMBPROFILE_STATS_SECTION_END \
\
SMBPROFILE_STATS_END
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 36e7f0f..c67c3c3 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -20,6 +20,7 @@
#include "system/select.h"
#include "librpc/gen_ndr/smbXsrv.h"
+#include "smbprofile.h"
extern int aio_pending_size;
extern int outstanding_aio_calls;
@@ -651,6 +652,8 @@ struct smbd_smb2_request {
struct timeval request_time;
+ SMBPROFILE_IOBYTES_ASYNC_STATE(profile);
+
/* fake smb1 request. */
struct smb_request *smb1req;
struct files_struct *compat_chain_fsp;
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 48bc486..31dc3ac 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -957,6 +957,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
&info);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(smb1req->xconn, smb1req->mid)) {
+ SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(smb2req->profile);
return req;
}
tevent_req_nterror(req, status);
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index d712290..c160731 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -349,6 +349,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
if (async) {
tevent_req_defer_callback(req, smb2req->sconn->ev_ctx);
+ SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(smb2req->profile);
return req;
}
@@ -702,6 +703,8 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
if (!smb2req->subreq) {
return;
}
+ SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(smb2req->profile);
+
state = tevent_req_data(smb2req->subreq, struct smbd_smb2_lock_state);
if (!state) {
return;
@@ -778,6 +781,7 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
fsp_str_dbg(fsp),
fsp_fnum_dbg(fsp)));
+ SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(smb2req->profile);
return;
}
diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c
index 7b92927..573635b 100644
--- a/source3/smbd/smb2_notify.c
+++ b/source3/smbd/smb2_notify.c
@@ -321,6 +321,7 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx,
/* allow this request to be canceled */
tevent_req_set_cancel_fn(req, smbd_smb2_notify_cancel);
+ SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(state->smb2req->profile);
return req;
}
@@ -337,6 +338,8 @@ static void smbd_smb2_notify_reply(struct smb_request *smbreq,
return;
}
+ SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(state->smb2req->profile);
+
state->status = error_code;
if (!NT_STATUS_IS_OK(error_code)) {
/* nothing */
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 689bfd7..c801746 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2191,157 +2191,127 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
SMB_ASSERT(call->need_tcon);
}
+#define _INBYTES(_r) \
+ iov_buflen(SMBD_SMB2_IN_HDR_IOV(_r), SMBD_SMB2_NUM_IOV_PER_REQ-1)
+
switch (opcode) {
case SMB2_OP_NEGPROT:
- {
- START_PROFILE(smb2_negprot);
- return_value = smbd_smb2_request_process_negprot(req);
- END_PROFILE(smb2_negprot);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_negprot, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_negprot(req);
break;
case SMB2_OP_SESSSETUP:
- {
- START_PROFILE(smb2_sesssetup);
- return_value = smbd_smb2_request_process_sesssetup(req);
- END_PROFILE(smb2_sesssetup);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_sesssetup, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_sesssetup(req);
break;
case SMB2_OP_LOGOFF:
- {
- START_PROFILE(smb2_logoff);
- return_value = smbd_smb2_request_process_logoff(req);
- END_PROFILE(smb2_logoff);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_logoff, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_logoff(req);
break;
case SMB2_OP_TCON:
- {
- START_PROFILE(smb2_tcon);
- return_value = smbd_smb2_request_process_tcon(req);
- END_PROFILE(smb2_tcon);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_tcon, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_tcon(req);
break;
case SMB2_OP_TDIS:
- {
- START_PROFILE(smb2_tdis);
- return_value = smbd_smb2_request_process_tdis(req);
- END_PROFILE(smb2_tdis);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_tdis, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_tdis(req);
break;
case SMB2_OP_CREATE:
- {
- START_PROFILE(smb2_create);
- return_value = smbd_smb2_request_process_create(req);
- END_PROFILE(smb2_create);
+ if (req->subreq == NULL) {
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_create, profile_p,
+ req->profile, _INBYTES(req));
+ } else {
+ SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(req->profile);
}
+ return_value = smbd_smb2_request_process_create(req);
break;
case SMB2_OP_CLOSE:
- {
- START_PROFILE(smb2_close);
- return_value = smbd_smb2_request_process_close(req);
- END_PROFILE(smb2_close);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_close, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_close(req);
break;
case SMB2_OP_FLUSH:
- {
- START_PROFILE(smb2_flush);
- return_value = smbd_smb2_request_process_flush(req);
- END_PROFILE(smb2_flush);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_flush, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_flush(req);
break;
case SMB2_OP_READ:
- {
- START_PROFILE(smb2_read);
- return_value = smbd_smb2_request_process_read(req);
- END_PROFILE(smb2_read);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_read, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_read(req);
break;
case SMB2_OP_WRITE:
- {
- START_PROFILE(smb2_write);
- return_value = smbd_smb2_request_process_write(req);
- END_PROFILE(smb2_write);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_write, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_write(req);
break;
case SMB2_OP_LOCK:
- {
- START_PROFILE(smb2_lock);
- return_value = smbd_smb2_request_process_lock(req);
- END_PROFILE(smb2_lock);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_lock, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_lock(req);
break;
case SMB2_OP_IOCTL:
- {
- START_PROFILE(smb2_ioctl);
- return_value = smbd_smb2_request_process_ioctl(req);
- END_PROFILE(smb2_ioctl);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_ioctl, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_ioctl(req);
break;
case SMB2_OP_CANCEL:
- {
- START_PROFILE(smb2_cancel);
- return_value = smbd_smb2_request_process_cancel(req);
- END_PROFILE(smb2_cancel);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_cancel, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_cancel(req);
+ SMBPROFILE_IOBYTES_ASYNC_END(req->profile, 0);
break;
case SMB2_OP_KEEPALIVE:
- {
- START_PROFILE(smb2_keepalive);
- return_value = smbd_smb2_request_process_keepalive(req);
- END_PROFILE(smb2_keepalive);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_keepalive, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_keepalive(req);
break;
case SMB2_OP_FIND:
- {
- START_PROFILE(smb2_find);
- return_value = smbd_smb2_request_process_find(req);
- END_PROFILE(smb2_find);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_find, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_find(req);
break;
case SMB2_OP_NOTIFY:
- {
- START_PROFILE(smb2_notify);
- return_value = smbd_smb2_request_process_notify(req);
- END_PROFILE(smb2_notify);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_notify, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_notify(req);
break;
case SMB2_OP_GETINFO:
- {
- START_PROFILE(smb2_getinfo);
- return_value = smbd_smb2_request_process_getinfo(req);
- END_PROFILE(smb2_getinfo);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_getinfo, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_getinfo(req);
break;
case SMB2_OP_SETINFO:
- {
- START_PROFILE(smb2_setinfo);
- return_value = smbd_smb2_request_process_setinfo(req);
- END_PROFILE(smb2_setinfo);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_setinfo, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_setinfo(req);
break;
case SMB2_OP_BREAK:
- {
- START_PROFILE(smb2_break);
- return_value = smbd_smb2_request_process_break(req);
- END_PROFILE(smb2_break);
- }
+ SMBPROFILE_IOBYTES_ASYNC_START(smb2_break, profile_p,
+ req->profile, _INBYTES(req));
+ return_value = smbd_smb2_request_process_break(req);
break;
default:
@@ -2440,6 +2410,9 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req)
data_blob_clear_free(&req->last_key);
}
+ SMBPROFILE_IOBYTES_ASYNC_END(req->profile,
+ iov_buflen(outhdr, SMBD_SMB2_NUM_IOV_PER_REQ-1));
+
req->current_idx += SMBD_SMB2_NUM_IOV_PER_REQ;
if (req->current_idx < req->out.vector_count) {
--
1.9.1
From f5f93ef1dc1ea1241642dcad4b0441e6ba03164c Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 14 Nov 2014 12:42:51 +0100
Subject: [PATCH 13/18] s3:smbprofile: count all SMB1 and SMB2 requests as
'request_count'
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 2 +-
source3/smbd/process.c | 2 +-
source3/smbd/smb2_server.c | 11 +++++++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index c60f9d9..344133c 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -27,7 +27,7 @@
SMBPROFILE_STATS_START \
\
SMBPROFILE_STATS_SECTION_START("SMBD loop") \
- SMBPROFILE_STATS_COUNT(smb_count) \
+ SMBPROFILE_STATS_COUNT(request) \
SMBPROFILE_STATS_COUNT(uid_changes) \
SMBPROFILE_STATS_BASIC(smbd_idle) \
SMBPROFILE_STATS_SECTION_END \
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 8370155..9d19829 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1871,7 +1871,7 @@ static void process_smb(struct smbXsrv_connection *xconn,
struct smbd_server_connection *sconn = xconn->client->sconn;
int msg_type = CVAL(inbuf,0);
- DO_PROFILE_INC(smb_count);
+ DO_PROFILE_INC(request);
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
smb_len(inbuf) ) );
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index c801746..138765e 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1945,6 +1945,8 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
inhdr = SMBD_SMB2_IN_HDR_PTR(req);
+ DO_PROFILE_INC(request);
+
/* TODO: verify more things */
flags = IVAL(inhdr, SMB2_HDR_FLAGS);
@@ -3025,6 +3027,15 @@ void smbd_smb2_first_negprot(struct smbXsrv_connection *xconn,
return;
}
+#ifdef WITH_PROFILE
+ /*
+ * this was already counted at the SMB1 layer =>
+ * smbd_smb2_request_dispatch() should not count it twice.
+ */
+ if (profile_p->request_stats.count > 0) {
+ profile_p->request_stats.count--;
+ }
+#endif
status = smbd_smb2_request_dispatch(req);
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn, nt_errstr(status));
--
1.9.1
From 87bfd8c333aacfcef4fd083d1dc6b0a988efe7f6 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 17 Nov 2014 12:52:35 +0100
Subject: [PATCH 14/18] s3:smbprofile: improve profiling for the security
context switching.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 5 ++++-
source3/smbd/sec_ctx.c | 24 +++++++++++++++++++++---
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 344133c..ba7a0b3 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -28,7 +28,10 @@
\
SMBPROFILE_STATS_SECTION_START("SMBD loop") \
SMBPROFILE_STATS_COUNT(request) \
- SMBPROFILE_STATS_COUNT(uid_changes) \
+ SMBPROFILE_STATS_BASIC(push_sec_ctx) \
+ SMBPROFILE_STATS_BASIC(set_sec_ctx) \
+ SMBPROFILE_STATS_BASIC(set_root_sec_ctx) \
+ SMBPROFILE_STATS_BASIC(pop_sec_ctx) \
SMBPROFILE_STATS_BASIC(smbd_idle) \
SMBPROFILE_STATS_SECTION_END \
\
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index 5dda07e..33d987f 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -66,7 +66,6 @@ static bool become_uid(uid_t uid)
set_effective_uid(uid);
- DO_PROFILE_INC(uid_changes);
return True;
}
@@ -196,6 +195,8 @@ bool push_sec_ctx(void)
{
struct sec_ctx *ctx_p;
+ START_PROFILE(push_sec_ctx);
+
/* Check we don't overflow our stack */
if (sec_ctx_stack_ndx == MAX_SEC_CTX_DEPTH) {
@@ -232,6 +233,8 @@ bool push_sec_ctx(void)
ctx_p->ut.groups = NULL;
}
+ END_PROFILE(push_sec_ctx);
+
return True;
}
@@ -306,7 +309,9 @@ static void set_unix_security_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *grou
Set the current security context to a given user.
****************************************************************************/
-void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct security_token *token)
+static void set_sec_ctx_internal(uid_t uid, gid_t gid,
+ int ngroups, gid_t *groups,
+ const struct security_token *token)
{
struct sec_ctx *ctx_p = &sec_ctx_stack[sec_ctx_stack_ndx];
@@ -358,6 +363,13 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct
current_user.nt_user_token = ctx_p->token;
}
+void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, const struct security_token *token)
+{
+ START_PROFILE(set_sec_ctx);
+ set_sec_ctx_internal(uid, gid, ngroups, groups, token);
+ END_PROFILE(set_sec_ctx);
+}
+
/****************************************************************************
Become root context.
****************************************************************************/
@@ -366,7 +378,9 @@ void set_root_sec_ctx(void)
{
/* May need to worry about supplementary groups at some stage */
- set_sec_ctx(0, 0, 0, NULL, NULL);
+ START_PROFILE(set_root_sec_ctx);
+ set_sec_ctx_internal(0, 0, 0, NULL, NULL);
+ END_PROFILE(set_root_sec_ctx);
}
/****************************************************************************
@@ -378,6 +392,8 @@ bool pop_sec_ctx(void)
struct sec_ctx *ctx_p;
struct sec_ctx *prev_ctx_p;
+ START_PROFILE(pop_sec_ctx);
+
/* Check for stack underflow */
if (sec_ctx_stack_ndx == 0) {
@@ -417,6 +433,8 @@ bool pop_sec_ctx(void)
current_user.ut.groups = prev_ctx_p->ut.groups;
current_user.nt_user_token = prev_ctx_p->token;
+ END_PROFILE(pop_sec_ctx);
+
DEBUG(4, ("pop_sec_ctx (%u, %u) - sec_ctx_stack_ndx = %d\n",
(unsigned int)geteuid(), (unsigned int)getegid(), sec_ctx_stack_ndx));
--
1.9.1
From 0f6069c5543f1d35b2774b55d769cb826986d2ca Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 17 Nov 2014 12:58:25 +0100
Subject: [PATCH 15/18] s3:smbprofile: report idle state of 'idle_count' and
'idle_time'
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 2 +-
source3/smbd/process.c | 11 +++--------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index ba7a0b3..bafd693 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -27,12 +27,12 @@
SMBPROFILE_STATS_START \
\
SMBPROFILE_STATS_SECTION_START("SMBD loop") \
+ SMBPROFILE_STATS_BASIC(idle) \
SMBPROFILE_STATS_COUNT(request) \
SMBPROFILE_STATS_BASIC(push_sec_ctx) \
SMBPROFILE_STATS_BASIC(set_sec_ctx) \
SMBPROFILE_STATS_BASIC(set_root_sec_ctx) \
SMBPROFILE_STATS_BASIC(pop_sec_ctx) \
- SMBPROFILE_STATS_BASIC(smbd_idle) \
SMBPROFILE_STATS_SECTION_END \
\
SMBPROFILE_STATS_SECTION_START("System Calls") \
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 9d19829..2e611e2 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3500,7 +3500,7 @@ NTSTATUS smbXsrv_connection_init_tables(struct smbXsrv_connection *conn,
struct smbd_tevent_trace_state {
TALLOC_CTX *frame;
- uint64_t smbd_idle_profstamp;
+ SMBPROFILE_BASIC_ASYNC_STATE(profile_idle);
};
static void smbd_tevent_trace_callback(enum tevent_trace_point point,
@@ -3511,15 +3511,10 @@ static void smbd_tevent_trace_callback(enum tevent_trace_point point,
switch (point) {
case TEVENT_TRACE_BEFORE_WAIT:
- /*
- * This just removes compiler warning
- * without profile support
- */
- state->smbd_idle_profstamp = 0;
- START_PROFILE_STAMP(smbd_idle, state->smbd_idle_profstamp);
+ SMBPROFILE_BASIC_ASYNC_START(idle, profile_p, state->profile_idle);
break;
case TEVENT_TRACE_AFTER_WAIT:
- END_PROFILE_STAMP(smbd_idle, state->smbd_idle_profstamp);
+ SMBPROFILE_BASIC_ASYNC_END(state->profile_idle);
break;
case TEVENT_TRACE_BEFORE_LOOP_ONCE:
TALLOC_FREE(state->frame);
--
1.9.1
From 4cea02a210dffaf57b9a875346f499bf1ea7a5a2 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 17 Nov 2014 20:05:09 +0100
Subject: [PATCH 16/18] s3:smbprofile: remove unused
{START,END}_PROFILE_STAMP()
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index bafd693..67ffa77 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -482,12 +482,6 @@ static inline uint64_t profile_timestamp(void)
#define DO_PROFILE_INC(x) \
_SMBPROFILE_COUNT_INCREMENT(x##_stats, profile_p, 1); \
-#define START_PROFILE_STAMP(x, _stamp) do { \
- struct smbprofile_stats_basic_async __profasync_##x = {}; \
- _SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x); \
- _stamp = __profasync_##x.start; \
-} while(0)
-
#define START_PROFILE(x) \
struct smbprofile_stats_basic_async __profasync_##x = {}; \
_SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x);
@@ -496,17 +490,6 @@ static inline uint64_t profile_timestamp(void)
struct smbprofile_stats_bytes_async __profasync_##x = {}; \
_SMBPROFILE_BYTES_ASYNC_START(x##_stats, profile_p, __profasync_##x, n);
-#define END_PROFILE_STAMP(x, _stamp) do { \
- struct smbprofile_stats_basic_async __profasync_##x = {}; \
- if (do_profile_flag && do_profile_times) { \
- __profasync_##x = (struct smbprofile_stats_basic_async) { \
- .start = (_stamp), \
- .stats = &(profile_p->x##_stats), \
- }; \
- } \
- SMBPROFILE_BASIC_ASYNC_END(__profasync_##x); \
-} while(0)
-
#define END_PROFILE(x) \
SMBPROFILE_BASIC_ASYNC_END(__profasync_##x)
@@ -538,10 +521,8 @@ static inline uint64_t profile_timestamp(void)
#define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes)
#define DO_PROFILE_INC(x)
-#define START_PROFILE_STAMP(x, _stamp)
#define START_PROFILE(x)
#define START_PROFILE_BYTES(x,n)
-#define END_PROFILE_STAMP(x, _stamp)
#define END_PROFILE(x)
#define END_PROFILE_BYTES(x)
--
1.9.1
From f704ac5ac51d732629d25746082603c9edcd19cf Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 14 Nov 2014 12:47:01 +0100
Subject: [PATCH 17/18] s3:smbprofile: track connect_count and disconnect_count
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 2 ++
source3/smbd/process.c | 2 ++
source3/smbd/server_exit.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 67ffa77..acf80e6 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -27,6 +27,8 @@
SMBPROFILE_STATS_START \
\
SMBPROFILE_STATS_SECTION_START("SMBD loop") \
+ SMBPROFILE_STATS_COUNT(connect) \
+ SMBPROFILE_STATS_COUNT(disconnect) \
SMBPROFILE_STATS_BASIC(idle) \
SMBPROFILE_STATS_COUNT(request) \
SMBPROFILE_STATS_BASIC(push_sec_ctx) \
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 2e611e2..c7f0e9a 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3573,6 +3573,8 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd,
*_xconn = NULL;
+ DO_PROFILE_INC(connect);
+
xconn = talloc_zero(client, struct smbXsrv_connection);
if (xconn == NULL) {
DEBUG(0,("talloc_zero(struct smbXsrv_connection)\n"));
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 6a51c24..e5d32b8 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -224,6 +224,7 @@ static void exit_server_common(enum server_exit_reason how,
next = xconn->next;
DLIST_REMOVE(client->connections, xconn);
talloc_free(xconn);
+ DO_PROFILE_INC(disconnect);
}
TALLOC_FREE(client->sconn);
}
--
1.9.1
From c44b0c086d59ac65b6c5842d52349b8fb32868a9 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 15 Nov 2014 23:58:15 +0100
Subject: [PATCH 18/18] s3:smbprofile: profile async pread/pwrite/fsync
syscalls
Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
source3/include/smbprofile.h | 3 +++
source3/modules/vfs_default.c | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index acf80e6..ea24165 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -52,14 +52,17 @@
SMBPROFILE_STATS_BASIC(syscall_close) \
SMBPROFILE_STATS_BYTES(syscall_read) \
SMBPROFILE_STATS_BYTES(syscall_pread) \
+ SMBPROFILE_STATS_BYTES(syscall_asys_pread) \
SMBPROFILE_STATS_BYTES(syscall_write) \
SMBPROFILE_STATS_BYTES(syscall_pwrite) \
+ SMBPROFILE_STATS_BYTES(syscall_asys_pwrite) \
SMBPROFILE_STATS_BASIC(syscall_lseek) \
SMBPROFILE_STATS_BYTES(syscall_sendfile) \
SMBPROFILE_STATS_BYTES(syscall_recvfile) \
SMBPROFILE_STATS_BASIC(syscall_rename) \
SMBPROFILE_STATS_BASIC(syscall_rename_at) \
SMBPROFILE_STATS_BASIC(syscall_fsync) \
+ SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \
SMBPROFILE_STATS_BASIC(syscall_stat) \
SMBPROFILE_STATS_BASIC(syscall_fstat) \
SMBPROFILE_STATS_BASIC(syscall_lstat) \
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5fb3b1c..2ac7100 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -687,6 +687,8 @@ struct vfswrap_asys_state {
struct tevent_req *req;
ssize_t ret;
int err;
+ SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
+ SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
};
static int vfswrap_asys_state_destructor(struct vfswrap_asys_state *s)
@@ -717,6 +719,8 @@ static struct tevent_req *vfswrap_pread_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
+ SMBPROFILE_BYTES_ASYNC_START(syscall_asys_pread, profile_p,
+ state->profile_bytes, n);
ret = asys_pread(state->asys_ctx, fsp->fh->fd, data, n, offset, req);
if (ret != 0) {
tevent_req_error(req, ret);
@@ -749,6 +753,8 @@ static struct tevent_req *vfswrap_pwrite_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
+ SMBPROFILE_BYTES_ASYNC_START(syscall_asys_pwrite, profile_p,
+ state->profile_bytes, n);
ret = asys_pwrite(state->asys_ctx, fsp->fh->fd, data, n, offset, req);
if (ret != 0) {
tevent_req_error(req, ret);
@@ -779,6 +785,8 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
state->asys_ctx = handle->conn->sconn->asys_ctx;
state->req = req;
+ SMBPROFILE_BASIC_ASYNC_START(syscall_asys_fsync, profile_p,
+ state->profile_basic);
ret = asys_fsync(state->asys_ctx, fsp->fh->fd, req);
if (ret != 0) {
tevent_req_error(req, ret);
@@ -822,6 +830,8 @@ static void vfswrap_asys_finished(struct tevent_context *ev,
talloc_set_destructor(state, NULL);
+ SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
+ SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
state->ret = result->ret;
state->err = result->err;
tevent_req_defer_callback(req, ev);
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141117/44c0dd46/attachment-0001.pgp>
More information about the samba-technical
mailing list