summaryrefslogtreecommitdiff
path: root/source3/profile
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2000-10-11 05:31:39 +0000
committerHerb Lewis <herb@samba.org>2000-10-11 05:31:39 +0000
commit8719c27726d3412edd0781beb956f48f76a62fb6 (patch)
tree4946f7b6d6159eb566ff279d9ccba1f6d901e0e1 /source3/profile
parentc72f94dad9639bc241890aad338ae0bea8eed84d (diff)
downloadsamba-8719c27726d3412edd0781beb956f48f76a62fb6.tar.gz
samba-8719c27726d3412edd0781beb956f48f76a62fb6.tar.bz2
samba-8719c27726d3412edd0781beb956f48f76a62fb6.zip
changes to sync with 2.2. tree
.cvsignore remove config.h - not in this directory include/profile.h profile changes lib/messages.c added message to return debug level libsmb/clierror.c cast to get rid of compiler warning libsmb/smbencrypt.c cast to get rid of compiler warning profile/profile.c add flush profile stats changes for profile struct rpc_parse/parse_samr.c fix for compiler warning rpc_server/srv_samr.c cast to get rid of compiler warning smbd/ipc.c profile stats message.c profile stats smbd/negprot.c profile stats smbd/nttrans.c profile stats smbd/trans2.c profile stats utils/smbcontrol.c new flush stats command (This used to be commit bbb24daa25dca4e4b6b1f8942cd84ee3aa1bed8e)
Diffstat (limited to 'source3/profile')
-rw-r--r--source3/profile/profile.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 87f5e2c9b2..c639f17ce5 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -31,13 +31,16 @@ extern int DEBUGLEVEL;
static int shm_id;
static BOOL read_only;
-struct profile_struct *profile_p;
+struct profile_header *profile_h;
+struct profile_stats *profile_p;
BOOL do_profile_flag = False;
BOOL do_profile_times = False;
struct timeval profile_starttime;
struct timeval profile_endtime;
+struct timeval profile_starttime_nested;
+struct timeval profile_endtime_nested;
/****************************************************************************
receive a set profile level message
@@ -48,18 +51,21 @@ void profile_message(int msg_type, pid_t src, void *buf, size_t len)
memcpy(&level, buf, sizeof(int));
switch (level) {
- case 0:
+ case 0: /* turn off profiling */
do_profile_flag = False;
do_profile_times = False;
break;
- case 1:
+ case 1: /* turn on counter profiling only */
do_profile_flag = True;
do_profile_times = False;
break;
- case 2:
+ case 2: /* turn on complete profiling */
do_profile_flag = True;
do_profile_times = True;
break;
+ case 3: /* reset profile values */
+ memset((char *)profile_p, 0, sizeof(*profile_p));
+ break;
}
DEBUG(1,("Profile level set to %d from pid %d\n", level, (int)src));
}
@@ -81,7 +87,7 @@ BOOL profile_setup(BOOL rdonly)
if we are running from inetd. Bad luck. */
if (shm_id == -1) {
if (read_only) return False;
- shm_id = shmget(PROF_SHMEM_KEY, sizeof(*profile_p),
+ shm_id = shmget(PROF_SHMEM_KEY, sizeof(*profile_h),
IPC_CREAT | IPC_EXCL | IPC_PERMS);
}
@@ -92,7 +98,7 @@ BOOL profile_setup(BOOL rdonly)
}
- profile_p = (struct profile_struct *)shmat(shm_id, 0,
+ profile_h = (struct profile_header *)shmat(shm_id, 0,
read_only?SHM_RDONLY:0);
if ((long)profile_p == -1) {
DEBUG(0,("Can't attach to IPC area. Error was %s\n",
@@ -112,9 +118,9 @@ BOOL profile_setup(BOOL rdonly)
return False;
}
- if (shm_ds.shm_segsz != sizeof(*profile_p)) {
+ if (shm_ds.shm_segsz != sizeof(*profile_h)) {
DEBUG(0,("WARNING: profile size is %d (expected %d). Deleting\n",
- (int)shm_ds.shm_segsz, sizeof(*profile_p)));
+ (int)shm_ds.shm_segsz, sizeof(*profile_h)));
if (shmctl(shm_id, IPC_RMID, &shm_ds) == 0) {
goto again;
} else {
@@ -123,12 +129,13 @@ BOOL profile_setup(BOOL rdonly)
}
if (!read_only && (shm_ds.shm_nattch == 1)) {
- memset((char *)profile_p, 0, sizeof(*profile_p));
- profile_p->prof_shm_magic = PROF_SHM_MAGIC;
- profile_p->prof_shm_version = PROF_SHM_VERSION;
+ memset((char *)profile_h, 0, sizeof(*profile_h));
+ profile_h->prof_shm_magic = PROF_SHM_MAGIC;
+ profile_h->prof_shm_version = PROF_SHM_VERSION;
DEBUG(3,("Initialised profile area\n"));
}
+ profile_p = &profile_h->stats;
message_register(MSG_PROFILE, profile_message);
return True;
}