1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-24 13:57:43 +03:00

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@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-10-23 18:06:15 +02:00 committed by Jeremy Allison
parent 9813f56178
commit cee1b4b053
3 changed files with 693 additions and 1735 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
#define PROF_SHMEM_KEY ((key_t)0x07021999) #define PROF_SHMEM_KEY ((key_t)0x07021999)
#define PROF_SHM_MAGIC 0x6349985 #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) #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; 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];
}

View File

@ -47,686 +47,49 @@ bool status_profile_dump(bool verbose)
return False; return False;
} }
d_printf("smb_count: %u\n", #define __PRINT_FIELD_LINE(name, _stats, field) do { \
profile_p->smb_count); d_printf("%-59s%20ju\n", \
d_printf("uid_changes: %u\n", name "_" #field ":", \
profile_p->uid_changes); (uintmax_t)profile_p->_stats.field); \
} while(0);
profile_separator("System Calls"); #define SMBPROFILE_STATS_START
d_printf("opendir_count: %u\n", #define SMBPROFILE_STATS_SECTION_START(name) profile_separator(#name);
profile_p->syscall_opendir_count); #define SMBPROFILE_STATS_COUNT(name) do { \
d_printf("opendir_time: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, count); \
profile_p->syscall_opendir_time); } while(0);
d_printf("fdopendir_count: %u\n", #define SMBPROFILE_STATS_TIME(name) do { \
profile_p->syscall_fdopendir_count); __PRINT_FIELD_LINE(#name, name##_stats, time); \
d_printf("fdopendir_time: %u\n", } while(0);
profile_p->syscall_fdopendir_time); #define SMBPROFILE_STATS_BASIC(name) do { \
d_printf("readdir_count: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, count); \
profile_p->syscall_readdir_count); __PRINT_FIELD_LINE(#name, name##_stats, time); \
d_printf("readdir_time: %u\n", } while(0);
profile_p->syscall_readdir_time); #define SMBPROFILE_STATS_BYTES(name) do { \
d_printf("mkdir_count: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, count); \
profile_p->syscall_mkdir_count); __PRINT_FIELD_LINE(#name, name##_stats, time); \
d_printf("mkdir_time: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, idle); \
profile_p->syscall_mkdir_time); __PRINT_FIELD_LINE(#name, name##_stats, bytes); \
d_printf("rmdir_count: %u\n", } while(0);
profile_p->syscall_rmdir_count); #define SMBPROFILE_STATS_IOBYTES(name) do { \
d_printf("rmdir_time: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, count); \
profile_p->syscall_rmdir_time); __PRINT_FIELD_LINE(#name, name##_stats, time); \
d_printf("closedir_count: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, idle); \
profile_p->syscall_closedir_count); __PRINT_FIELD_LINE(#name, name##_stats, inbytes); \
d_printf("closedir_time: %u\n", __PRINT_FIELD_LINE(#name, name##_stats, outbytes); \
profile_p->syscall_closedir_time); } while(0);
d_printf("open_count: %u\n", #define SMBPROFILE_STATS_SECTION_END
profile_p->syscall_open_count); #define SMBPROFILE_STATS_END
d_printf("open_time: %u\n", SMBPROFILE_STATS_ALL_SECTIONS
profile_p->syscall_open_time); #undef __PRINT_FIELD_LINE
d_printf("close_count: %u\n", #undef SMBPROFILE_STATS_START
profile_p->syscall_close_count); #undef SMBPROFILE_STATS_SECTION_START
d_printf("close_time: %u\n", #undef SMBPROFILE_STATS_COUNT
profile_p->syscall_close_time); #undef SMBPROFILE_STATS_TIME
d_printf("read_count: %u\n", #undef SMBPROFILE_STATS_BASIC
profile_p->syscall_read_count); #undef SMBPROFILE_STATS_BYTES
d_printf("read_time: %u\n", #undef SMBPROFILE_STATS_IOBYTES
profile_p->syscall_read_time); #undef SMBPROFILE_STATS_SECTION_END
d_printf("read_bytes: %u\n", #undef SMBPROFILE_STATS_END
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);
return True; return True;
} }
@ -742,47 +105,191 @@ bool status_profile_dump(bool verbose)
#define percent_time(used, period) ((double)(used) / (double)(period) * 100.0 ) #define percent_time(used, period) ((double)(used) / (double)(period) * 100.0 )
static int print_count_samples( 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)
{
uint64_t step = current->count - last->count;
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",
name, (uintmax_t)(step / delta_sec));
} else {
printf("%-40s %s %ju/sec\n",
buf, name, (uintmax_t)(step / delta_sec));
buf[0] = '\0';
}
}
return count;
}
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 != 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_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 current,
const struct profile_stats * const last, const struct profile_stats * const last,
uint64_t delta_usec) uint64_t delta_usec)
{ {
int i; uint64_t count = 0;
int count = 0; char buf[40] = { '\0', };
unsigned step;
uint64_t spent;
int delta_sec;
const char * name;
char buf[40];
if (delta_usec == 0) { if (delta_usec == 0) {
return 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, \
&current->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, \
&current->name##_stats, \
&last->name##_stats, \
delta_usec); \
} while(0);
#define SMBPROFILE_STATS_BYTES(name) do { \
count += print_bytes_count_samples(buf, sizeof(buf), \
#name, \
&current->name##_stats, \
&last->name##_stats, \
delta_usec); \
} while(0);
#define SMBPROFILE_STATS_IOBYTES(name) do { \
count += print_iobytes_count_samples(buf, sizeof(buf), \
#name, \
&current->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'; buf[0] = '\0';
delta_sec = usec_to_sec(delta_usec);
for (i = 0; i < PR_VALUE_MAX; ++i) {
step = current->count[i] - last->count[i];
spent = current->time[i] - last->time[i];
if (step) {
++count;
name = profile_value_name(i);
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';
}
}
} }
return count; return count;