#ifndef _PROFILE_H_
#define _PROFILE_H_
-/*
+/*
Unix SMB/CIFS implementation.
store smbd profiling information in shared memory
Copyright (C) Andrew Tridgell 1999
-
+ Copyright (C) James Peach 2006
+
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 2 of the License, or
+ 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, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * Reasons for cache flush.
- */
+struct tevent_context;
-#define NUM_FLUSH_REASONS 8 /* Keep this in sync with the enum below. */
-enum flush_reason_enum { SEEK_FLUSH, READ_FLUSH, WRITE_FLUSH, READRAW_FLUSH,
- OPLOCK_RELEASE_FLUSH, CLOSE_FLUSH, SYNC_FLUSH, SIZECHANGE_FLUSH };
+#ifdef WITH_PROFILE
+
+#define SMBPROFILE_STATS_ALL_SECTIONS \
+ SMBPROFILE_STATS_START \
+ \
+ SMBPROFILE_STATS_SECTION_START(global, "SMBD loop") \
+ SMBPROFILE_STATS_COUNT(connect) \
+ SMBPROFILE_STATS_COUNT(disconnect) \
+ SMBPROFILE_STATS_BASIC(idle) \
+ SMBPROFILE_STATS_TIME(cpu_user) \
+ SMBPROFILE_STATS_TIME(cpu_system) \
+ 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_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START(syscall, "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_pread) \
+ SMBPROFILE_STATS_BYTES(syscall_asys_pread) \
+ 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_asys_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, "ACL Calls") \
+ SMBPROFILE_STATS_BASIC(get_nt_acl) \
+ SMBPROFILE_STATS_BASIC(fget_nt_acl) \
+ SMBPROFILE_STATS_BASIC(fset_nt_acl) \
+ SMBPROFILE_STATS_SECTION_END \
+ \
+ SMBPROFILE_STATS_SECTION_START(statcache, "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(writecache, "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, "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, "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, "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, "SMB2 Calls") \
+ 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
/* this file defines the profile structure in the profile shared
memory area */
-#define PROF_SHMEM_KEY ((key_t)0x07021999)
-#define PROF_SHM_MAGIC 0x6349985
-#define PROF_SHM_VERSION 7
-
/* time values in the following structure are in microseconds */
-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 counters */
- unsigned syscall_opendir_count;
- unsigned syscall_opendir_time;
- unsigned syscall_readdir_count;
- unsigned syscall_readdir_time;
- unsigned syscall_mkdir_count;
- unsigned syscall_mkdir_time;
- unsigned syscall_rmdir_count;
- unsigned syscall_rmdir_time;
- unsigned syscall_closedir_count;
- unsigned syscall_closedir_time;
- unsigned syscall_open_count;
- unsigned syscall_open_time;
- unsigned syscall_close_count;
- unsigned syscall_close_time;
- unsigned syscall_read_count;
- unsigned syscall_read_time;
- unsigned syscall_read_bytes; /* bytes read with read syscall */
- unsigned syscall_write_count;
- unsigned syscall_write_time;
- unsigned syscall_write_bytes; /* bytes written with write syscall */
- unsigned syscall_lseek_count;
- unsigned syscall_lseek_time;
- unsigned syscall_sendfile_count;
- unsigned syscall_sendfile_time;
- unsigned syscall_sendfile_bytes; /* bytes read with sendfile syscall */
- unsigned syscall_rename_count;
- unsigned syscall_rename_time;
- unsigned syscall_fsync_count;
- unsigned syscall_fsync_time;
- unsigned syscall_stat_count;
- unsigned syscall_stat_time;
- unsigned syscall_fstat_count;
- unsigned syscall_fstat_time;
- unsigned syscall_lstat_count;
- unsigned syscall_lstat_time;
- unsigned syscall_unlink_count;
- unsigned syscall_unlink_time;
- unsigned syscall_chmod_count;
- unsigned syscall_chmod_time;
- unsigned syscall_fchmod_count;
- unsigned syscall_fchmod_time;
- unsigned syscall_chown_count;
- unsigned syscall_chown_time;
- unsigned syscall_fchown_count;
- unsigned syscall_fchown_time;
- unsigned syscall_chdir_count;
- unsigned syscall_chdir_time;
- unsigned syscall_getwd_count;
- unsigned syscall_getwd_time;
- unsigned syscall_utime_count;
- unsigned syscall_utime_time;
- unsigned syscall_ftruncate_count;
- unsigned syscall_ftruncate_time;
- unsigned syscall_fcntl_lock_count;
- unsigned syscall_fcntl_lock_time;
- unsigned syscall_readlink_count;
- unsigned syscall_readlink_time;
- unsigned syscall_symlink_count;
- unsigned syscall_symlink_time;
- unsigned syscall_link_count;
- unsigned syscall_link_time;
- unsigned syscall_mknod_count;
- unsigned syscall_mknod_time;
- unsigned syscall_realpath_count;
- unsigned syscall_realpath_time;
-/* stat cache counters */
- unsigned statcache_lookups;
- unsigned statcache_misses;
- unsigned statcache_hits;
-/* write cache counters */
- unsigned writecache_read_hits;
- unsigned writecache_abutted_writes;
- unsigned writecache_total_writes;
- unsigned writecache_non_oplock_writes;
- unsigned writecache_direct_writes;
- unsigned writecache_init_writes;
- unsigned writecache_flushed_writes[NUM_FLUSH_REASONS];
- unsigned writecache_num_perfect_writes;
- unsigned writecache_num_write_caches;
- unsigned writecache_allocated_write_caches;
-/* counters for individual SMB types */
- unsigned SMBmkdir_count; /* create directory */
- unsigned SMBmkdir_time;
- unsigned SMBrmdir_count; /* delete directory */
- unsigned SMBrmdir_time;
- unsigned SMBopen_count; /* open file */
- unsigned SMBopen_time;
- unsigned SMBcreate_count; /* create file */
- unsigned SMBcreate_time;
- unsigned SMBclose_count; /* close file */
- unsigned SMBclose_time;
- unsigned SMBflush_count; /* flush file */
- unsigned SMBflush_time;
- unsigned SMBunlink_count; /* delete file */
- unsigned SMBunlink_time;
- unsigned SMBmv_count; /* rename file */
- unsigned SMBmv_time;
- unsigned SMBgetatr_count; /* get file attributes */
- unsigned SMBgetatr_time;
- unsigned SMBsetatr_count; /* set file attributes */
- unsigned SMBsetatr_time;
- unsigned SMBread_count; /* read from file */
- unsigned SMBread_time;
- unsigned SMBwrite_count; /* write to file */
- unsigned SMBwrite_time;
- unsigned SMBlock_count; /* lock byte range */
- unsigned SMBlock_time;
- unsigned SMBunlock_count; /* unlock byte range */
- unsigned SMBunlock_time;
- unsigned SMBctemp_count; /* create temporary file */
- unsigned SMBctemp_time;
- /* SMBmknew stats are currently combined with SMBcreate */
- unsigned SMBmknew_count; /* make new file */
- unsigned SMBmknew_time;
- unsigned SMBchkpth_count; /* check directory path */
- unsigned SMBchkpth_time;
- unsigned SMBexit_count; /* process exit */
- unsigned SMBexit_time;
- unsigned SMBlseek_count; /* seek */
- unsigned SMBlseek_time;
- unsigned SMBlockread_count; /* Lock a range and read */
- unsigned SMBlockread_time;
- unsigned SMBwriteunlock_count; /* Unlock a range then write */
- unsigned SMBwriteunlock_time;
- unsigned SMBreadbraw_count; /* read a block of data with no smb header */
- unsigned SMBreadbraw_time;
- unsigned SMBreadBmpx_count; /* read block multiplexed */
- unsigned SMBreadBmpx_time;
- unsigned SMBreadBs_count; /* read block (secondary response) */
- unsigned SMBreadBs_time;
- unsigned SMBwritebraw_count; /* write a block of data with no smb header */
- unsigned SMBwritebraw_time;
- unsigned SMBwriteBmpx_count; /* write block multiplexed */
- unsigned SMBwriteBmpx_time;
- unsigned SMBwriteBs_count; /* write block (secondary request) */
- unsigned SMBwriteBs_time;
- unsigned SMBwritec_count; /* secondary write request */
- unsigned SMBwritec_time;
- unsigned SMBsetattrE_count; /* set file attributes expanded */
- unsigned SMBsetattrE_time;
- unsigned SMBgetattrE_count; /* get file attributes expanded */
- unsigned SMBgetattrE_time;
- unsigned SMBlockingX_count; /* lock/unlock byte ranges and X */
- unsigned SMBlockingX_time;
- unsigned SMBtrans_count; /* transaction - name, bytes in/out */
- unsigned SMBtrans_time;
- unsigned SMBtranss_count; /* transaction (secondary request/response) */
- unsigned SMBtranss_time;
- unsigned SMBioctl_count; /* IOCTL */
- unsigned SMBioctl_time;
- unsigned SMBioctls_count; /* IOCTL (secondary request/response) */
- unsigned SMBioctls_time;
- unsigned SMBcopy_count; /* copy */
- unsigned SMBcopy_time;
- unsigned SMBmove_count; /* move */
- unsigned SMBmove_time;
- unsigned SMBecho_count; /* echo */
- unsigned SMBecho_time;
- unsigned SMBwriteclose_count; /* write a file then close it */
- unsigned SMBwriteclose_time;
- unsigned SMBopenX_count; /* open and X */
- unsigned SMBopenX_time;
- unsigned SMBreadX_count; /* read and X */
- unsigned SMBreadX_time;
- unsigned SMBwriteX_count; /* write and X */
- unsigned SMBwriteX_time;
- unsigned SMBtrans2_count; /* TRANS2 protocol set */
- unsigned SMBtrans2_time;
- unsigned SMBtranss2_count; /* TRANS2 protocol set, secondary command */
- unsigned SMBtranss2_time;
- unsigned SMBfindclose_count; /* Terminate a TRANSACT2_FINDFIRST */
- unsigned SMBfindclose_time;
- unsigned SMBfindnclose_count; /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
- unsigned SMBfindnclose_time;
- unsigned SMBtcon_count; /* tree connect */
- unsigned SMBtcon_time;
- unsigned SMBtdis_count; /* tree disconnect */
- unsigned SMBtdis_time;
- unsigned SMBnegprot_count; /* negotiate protocol */
- unsigned SMBnegprot_time;
- unsigned SMBsesssetupX_count; /* Session Set Up & X (including User Logon) */
- unsigned SMBsesssetupX_time;
- unsigned SMBulogoffX_count; /* user logoff */
- unsigned SMBulogoffX_time;
- unsigned SMBtconX_count; /* tree connect and X*/
- unsigned SMBtconX_time;
- unsigned SMBdskattr_count; /* get disk attributes */
- unsigned SMBdskattr_time;
- unsigned SMBsearch_count; /* search directory */
- unsigned SMBsearch_time;
- /* SBMffirst stats combined with SMBsearch */
- unsigned SMBffirst_count; /* find first */
- unsigned SMBffirst_time;
- /* SBMfunique stats combined with SMBsearch */
- unsigned SMBfunique_count; /* find unique */
- unsigned SMBfunique_time;
- unsigned SMBfclose_count; /* find close */
- unsigned SMBfclose_time;
- unsigned SMBnttrans_count; /* NT transact */
- unsigned SMBnttrans_time;
- unsigned SMBnttranss_count; /* NT transact secondary */
- unsigned SMBnttranss_time;
- unsigned SMBntcreateX_count; /* NT create and X */
- unsigned SMBntcreateX_time;
- unsigned SMBntcancel_count; /* NT cancel */
- unsigned SMBntcancel_time;
- unsigned SMBsplopen_count; /* open print spool file */
- unsigned SMBsplopen_time;
- unsigned SMBsplwr_count; /* write to print spool file */
- unsigned SMBsplwr_time;
- unsigned SMBsplclose_count; /* close print spool file */
- unsigned SMBsplclose_time;
- unsigned SMBsplretq_count; /* return print queue */
- unsigned SMBsplretq_time;
- unsigned SMBsends_count; /* send single block message */
- unsigned SMBsends_time;
- unsigned SMBsendb_count; /* send broadcast message */
- unsigned SMBsendb_time;
- unsigned SMBfwdname_count; /* forward user name */
- unsigned SMBfwdname_time;
- unsigned SMBcancelf_count; /* cancel forward */
- unsigned SMBcancelf_time;
- unsigned SMBgetmac_count; /* get machine name */
- unsigned SMBgetmac_time;
- unsigned SMBsendstrt_count; /* send start of multi-block message */
- unsigned SMBsendstrt_time;
- unsigned SMBsendend_count; /* send end of multi-block message */
- unsigned SMBsendend_time;
- unsigned SMBsendtxt_count; /* send text of multi-block message */
- unsigned SMBsendtxt_time;
- unsigned SMBinvalid_count; /* invalid command */
- unsigned SMBinvalid_time;
-/* Pathworks setdir command */
- unsigned pathworks_setdir_count;
- unsigned pathworks_setdir_time;
-/* These are the TRANS2 sub commands */
- unsigned Trans2_open_count;
- unsigned Trans2_open_time;
- unsigned Trans2_findfirst_count;
- unsigned Trans2_findfirst_time;
- unsigned Trans2_findnext_count;
- unsigned Trans2_findnext_time;
- unsigned Trans2_qfsinfo_count;
- unsigned Trans2_qfsinfo_time;
- unsigned Trans2_setfsinfo_count;
- unsigned Trans2_setfsinfo_time;
- unsigned Trans2_qpathinfo_count;
- unsigned Trans2_qpathinfo_time;
- unsigned Trans2_setpathinfo_count;
- unsigned Trans2_setpathinfo_time;
- unsigned Trans2_qfileinfo_count;
- unsigned Trans2_qfileinfo_time;
- unsigned Trans2_setfileinfo_count;
- unsigned Trans2_setfileinfo_time;
- unsigned Trans2_fsctl_count;
- unsigned Trans2_fsctl_time;
- unsigned Trans2_ioctl_count;
- unsigned Trans2_ioctl_time;
- unsigned Trans2_findnotifyfirst_count;
- unsigned Trans2_findnotifyfirst_time;
- unsigned Trans2_findnotifynext_count;
- unsigned Trans2_findnotifynext_time;
- unsigned Trans2_mkdir_count;
- unsigned Trans2_mkdir_time;
- unsigned Trans2_session_setup_count;
- unsigned Trans2_session_setup_time;
- unsigned Trans2_get_dfs_referral_count;
- unsigned Trans2_get_dfs_referral_time;
- unsigned Trans2_report_dfs_inconsistancy_count;
- unsigned Trans2_report_dfs_inconsistancy_time;
-/* These are the NT transact sub commands. */
- unsigned NT_transact_create_count;
- unsigned NT_transact_create_time;
- unsigned NT_transact_ioctl_count;
- unsigned NT_transact_ioctl_time;
- unsigned NT_transact_set_security_desc_count;
- unsigned NT_transact_set_security_desc_time;
- unsigned NT_transact_notify_change_count;
- unsigned NT_transact_notify_change_time;
- unsigned NT_transact_rename_count;
- unsigned NT_transact_rename_time;
- unsigned NT_transact_query_security_desc_count;
- unsigned NT_transact_query_security_desc_time;
-/* These are ACL manipulation calls */
- unsigned get_nt_acl_count;
- unsigned get_nt_acl_time;
- unsigned fget_nt_acl_count;
- unsigned fget_nt_acl_time;
- unsigned set_nt_acl_count;
- unsigned set_nt_acl_time;
- unsigned fset_nt_acl_count;
- unsigned fset_nt_acl_time;
- unsigned chmod_acl_count;
- unsigned chmod_acl_time;
- unsigned fchmod_acl_count;
- unsigned fchmod_acl_time;
-/* These are nmbd stats */
- unsigned name_release_count;
- unsigned name_release_time;
- unsigned name_refresh_count;
- unsigned name_refresh_time;
- unsigned name_registration_count;
- unsigned name_registration_time;
- unsigned node_status_count;
- unsigned node_status_time;
- unsigned name_query_count;
- unsigned name_query_time;
- unsigned host_announce_count;
- unsigned host_announce_time;
- unsigned workgroup_announce_count;
- unsigned workgroup_announce_time;
- unsigned local_master_announce_count;
- unsigned local_master_announce_time;
- unsigned master_browser_announce_count;
- unsigned master_browser_announce_time;
- unsigned lm_host_announce_count;
- unsigned lm_host_announce_time;
- unsigned get_backup_list_count;
- unsigned get_backup_list_time;
- unsigned reset_browser_count;
- unsigned reset_browser_time;
- unsigned announce_request_count;
- unsigned announce_request_time;
- unsigned lm_announce_request_count;
- unsigned lm_announce_request_time;
- unsigned domain_logon_count;
- unsigned domain_logon_time;
- unsigned sync_browse_lists_count;
- unsigned sync_browse_lists_time;
- unsigned run_elections_count;
- unsigned run_elections_time;
- unsigned election_count;
- unsigned election_time;
+struct smbprofile_stats_count {
+ uint64_t count; /* number of events */
+};
+
+struct smbprofile_stats_time {
+ uint64_t time; /* microseconds */
+};
+
+struct smbprofile_stats_time_async {
+ uint64_t start;
+ struct smbprofile_stats_time *stats;
+};
+
+struct smbprofile_stats_basic {
+ uint64_t count; /* number of events */
+ uint64_t time; /* microseconds */
};
-struct profile_header {
- int prof_shm_magic;
- int prof_shm_version;
- struct profile_stats stats;
+struct smbprofile_stats_basic_async {
+ uint64_t start;
+ struct smbprofile_stats_basic *stats;
};
-extern struct profile_header *profile_h;
+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 */
+};
+
+struct smbprofile_stats_bytes_async {
+ uint64_t start;
+ uint64_t idle_start;
+ uint64_t idle_time;
+ struct smbprofile_stats_bytes *stats;
+};
+
+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 */
+};
+
+struct smbprofile_stats_iobytes_async {
+ uint64_t start;
+ uint64_t idle_start;
+ uint64_t idle_time;
+ struct smbprofile_stats_iobytes *stats;
+};
+
+struct profile_stats {
+ uint64_t magic;
+ struct {
+#define SMBPROFILE_STATS_START
+#define SMBPROFILE_STATS_SECTION_START(name, display)
+#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
+ } values;
+};
+
+#define _SMBPROFILE_COUNT_INCREMENT(_stats, _area, _v) do { \
+ if (smbprofile_state.config.do_count) { \
+ (_area)->values._stats.count += (_v); \
+ smbprofile_dump_schedule(); \
+ } \
+} 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)->values._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) {}; \
+ smbprofile_dump_schedule(); \
+ } \
+} 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 (smbprofile_state.config.do_count) { \
+ if (smbprofile_state.config.do_times) { \
+ (_async).start = profile_timestamp(); \
+ (_async).stats = &((_area)->values._stats); \
+ } \
+ (_area)->values._stats.count += 1; \
+ smbprofile_dump_schedule(); \
+ } \
+} 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) {}; \
+ smbprofile_dump_schedule(); \
+ } \
+} while(0)
+
+#define _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async) do { \
+ (_async).stats = &((_area)->values._stats); \
+ if (smbprofile_state.config.do_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 (smbprofile_state.config.do_count) { \
+ _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
+ (_area)->values._stats.count += 1; \
+ (_area)->values._stats.bytes += (_bytes); \
+ smbprofile_dump_schedule(); \
+ } \
+} 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) {}; \
+ smbprofile_dump_schedule(); \
+ } \
+} 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 (smbprofile_state.config.do_count) { \
+ _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
+ (_area)->values._stats.count += 1; \
+ (_area)->values._stats.inbytes += (_inbytes); \
+ smbprofile_dump_schedule(); \
+ } \
+} 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) {}; \
+ smbprofile_dump_schedule(); \
+ } \
+} while(0)
+
extern struct profile_stats *profile_p;
-extern struct timeval profile_starttime;
-extern struct timeval profile_endtime;
-extern struct timeval profile_starttime_nested;
-extern struct timeval profile_endtime_nested;
-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 flage 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)
-#define PROFILE_TIME \
- ((profile_endtime.tv_sec - profile_starttime.tv_sec) *1000000 + \
- ((int)profile_endtime.tv_usec - (int)profile_starttime.tv_usec))
-#define PROFILE_TIME_NESTED \
- ((profile_endtime_nested.tv_sec - profile_starttime_nested.tv_sec) *1000000 + \
- ((int)profile_endtime_nested.tv_usec - (int)profile_starttime_nested.tv_usec))
-#ifdef WITH_PROFILE
-#define DO_PROFILE_INC(x) \
- if (do_profile_flag) { \
- INC_PROFILE_COUNT(x); \
- }
-#define DO_PROFILE_DEC(x) \
- if (do_profile_flag) { \
- DEC_PROFILE_COUNT(x); \
+struct smbprofile_global_state {
+ struct {
+ struct tdb_wrap *db;
+ struct tevent_context *ev;
+ struct tevent_timer *te;
+ } internal;
+
+ struct {
+ bool do_count;
+ bool do_times;
+ } config;
+
+ struct {
+ struct profile_stats global;
+ } stats;
+};
+
+extern struct smbprofile_global_state smbprofile_state;
+
+void smbprofile_dump_schedule_timer(void);
+void smbprofile_dump_setup(struct tevent_context *ev);
+
+static inline void smbprofile_dump_schedule(void)
+{
+ if (likely(smbprofile_state.internal.te != NULL)) {
+ return;
}
-#define DO_PROFILE_DEC_INC(x,y) \
- if (do_profile_flag) { \
- DEC_PROFILE_COUNT(x); \
- INC_PROFILE_COUNT(y); \
+
+ if (unlikely(smbprofile_state.internal.ev == NULL)) {
+ return;
}
-#define DO_PROFILE_ADD(x,n) \
- if (do_profile_flag) { \
- ADD_PROFILE_COUNT(x,n); \
+
+ smbprofile_dump_schedule_timer();
+}
+
+static inline bool smbprofile_dump_pending(void)
+{
+ if (smbprofile_state.internal.te == NULL) {
+ return false;
}
+
+ return true;
+}
+
+void smbprofile_dump(void);
+
+void smbprofile_cleanup(pid_t pid, pid_t dst);
+void smbprofile_stats_accumulate(struct profile_stats *acc,
+ const struct profile_stats *add);
+void smbprofile_collect(struct profile_stats *stats);
+
+static inline uint64_t profile_timestamp(void)
+{
+ struct timespec ts;
+
+ /* we might prefer to use the _COARSE clock variant of CLOCK_MONOTONIC
+ that one is faster but cached and "just" tick-wise precise */
+ clock_gettime_mono(&ts);
+ return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
+}
+
+#define DO_PROFILE_INC(x) \
+ _SMBPROFILE_COUNT_INCREMENT(x##_stats, profile_p, 1); \
+
#define START_PROFILE(x) \
- if (do_profile_flag) { \
- if (do_profile_times) \
- GetTimeOfDay(&profile_starttime); \
- INC_PROFILE_COUNT(x##_count); \
- }
-#define START_PROFILE_NESTED(x) \
- if (do_profile_flag) { \
- if (do_profile_times) \
- GetTimeOfDay(&profile_starttime_nested); \
- INC_PROFILE_COUNT(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) \
- if (do_profile_flag) { \
- if (do_profile_times) \
- GetTimeOfDay(&profile_starttime); \
- INC_PROFILE_COUNT(x##_count); \
- ADD_PROFILE_COUNT(x##_bytes,n); \
- }
+ struct smbprofile_stats_bytes_async __profasync_##x = {}; \
+ _SMBPROFILE_BYTES_ASYNC_START(x##_stats, profile_p, __profasync_##x, n);
+
#define END_PROFILE(x) \
- if (do_profile_times) { \
- GetTimeOfDay(&profile_endtime); \
- ADD_PROFILE_COUNT(x##_time,PROFILE_TIME); \
- }
-#define END_PROFILE_NESTED(x) \
- if (do_profile_times) { \
- GetTimeOfDay(&profile_endtime_nested); \
- ADD_PROFILE_COUNT(x##_time,PROFILE_TIME_NESTED); \
- }
-#else
+ SMBPROFILE_BASIC_ASYNC_END(__profasync_##x)
+
+#define END_PROFILE_BYTES(x) \
+ SMBPROFILE_BYTES_ASYNC_END(__profasync_##x)
+
+#define PROFILE_TIMESTAMP(x) clock_gettime_mono(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(x)
-#define START_PROFILE_NESTED(x)
#define START_PROFILE_BYTES(x,n)
#define END_PROFILE(x)
-#define END_PROFILE_NESTED(x)
-#endif
+#define END_PROFILE_BYTES(x)
+
+#define PROFILE_TIMESTAMP(x) (*(x)=(struct timespec){0})
+
+static inline bool smbprofile_dump_pending(void)
+{
+ return false;
+}
+
+static inline void smbprofile_dump_setup(struct tevent_context *ev)
+{
+ return;
+}
+
+static inline void smbprofile_dump(void)
+{
+ return;
+}
+
+static inline void smbprofile_cleanup(pid_t pid, pid_t dst)
+{
+ return;
+}
+
+#endif /* WITH_PROFILE */
+
+/* The following definitions come from profile/profile.c */
+struct server_id;
+
+void set_profile_level(int level, const struct server_id *src);
+
+struct messaging_context;
+bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
#endif