diff options
author | Andrew Tridgell <tridge@samba.org> | 1999-04-01 05:22:58 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1999-04-01 05:22:58 +0000 |
commit | d330c907bdc5d8e3c242cea76dfafaae84041270 (patch) | |
tree | d5a1381ca1adbe412bdb25084632ffc6b053f2c1 /source3/utils | |
parent | a8aff598f42a7479a2c43cbd04064cbbcf150599 (diff) | |
download | samba-d330c907bdc5d8e3c242cea76dfafaae84041270.tar.gz samba-d330c907bdc5d8e3c242cea76dfafaae84041270.tar.bz2 samba-d330c907bdc5d8e3c242cea76dfafaae84041270.zip |
Ken McDonell from SGI was interested in adding some profiling
capabilities to Samba so that Samba could talk to the SGI PCP
(Performance Co-Pilot) apps.
This change adds a profiling shared memory area and uses it to count
two fairly trivial things, the number of uid switches and the number
of SMB packets processes. To add more just edit include/profile.h and
then increment it at the right place.
I've also added a -P switch to smbstatus to dump the profile area.
(This used to be commit ef3d61a80ad0b87c196a63ef2bd4fe8fc3863bd0)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/status.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c index 96df087858..e20af8444c 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -138,6 +138,27 @@ static void print_share_mode(share_mode_entry *e, char *fname) } +/******************************************************************* + dump the elements of the profile structure + ******************************************************************/ +static int profile_dump(void) +{ +#ifndef WITH_PROFILE + fprintf(stderr,"ERROR: not compiled with profile support\n"); + return -1; +#else + if (!profile_setup(True)) { + fprintf(stderr,"Failed to initialise profile memory\n"); + return -1; + } + + printf("smb_count:\t%u\n", profile_p->smb_count); + printf("uid_changes:\t%u\n", profile_p->uid_changes); + return 0; +#endif +} + + int main(int argc, char *argv[]) { @@ -150,7 +171,7 @@ static void print_share_mode(share_mode_entry *e, char *fname) BOOL processes_only=False; int last_pid=0; struct session_record *ptr; - + int profile_only = 0; TimeInit(); setup_logging(argv[0],True); @@ -165,7 +186,7 @@ static void print_share_mode(share_mode_entry *e, char *fname) return(1); } - while ((c = getopt(argc, argv, "pdLSs:u:b")) != EOF) { + while ((c = getopt(argc, argv, "pdLSs:u:bP")) != EOF) { switch (c) { case 'b': brief = 1; @@ -179,6 +200,9 @@ static void print_share_mode(share_mode_entry *e, char *fname) case 'p': processes_only = 1; break; + case 'P': + profile_only = 1; + break; case 'S': shares_only = 1; break; @@ -189,7 +213,7 @@ static void print_share_mode(share_mode_entry *e, char *fname) Ucrit_addUsername(optarg); /* added by OH */ break; default: - fprintf(stderr, "Usage: %s [-d] [-L] [-p] [-S] [-s configfile] [-u username]\n", *argv); /* changed by OH */ + fprintf(stderr, "Usage: %s [-P] [-d] [-L] [-p] [-S] [-s configfile] [-u username]\n", *argv); return (-1); } } @@ -206,6 +230,10 @@ static void print_share_mode(share_mode_entry *e, char *fname) printf("lockdir = %s\n", *lp_lockdir() ? lp_lockdir() : "NULL"); } + if (profile_only) { + return profile_dump(); + } + pstrcpy(fname,lp_lockdir()); standard_sub_basic(fname); trim_string(fname,"","/"); |