diff options
author | Volker Lendecke <vl@samba.org> | 2014-09-30 15:08:20 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-10-03 19:55:09 +0200 |
commit | c7c300f9710f1f207b9fa0274648ba2dc11c1ffd (patch) | |
tree | dc26dcb5d0331fd2cec85d00edd605133109024d /source3/profile | |
parent | 17c7f454813be526876ac750ceb6fd1422577495 (diff) | |
download | samba-c7c300f9710f1f207b9fa0274648ba2dc11c1ffd.tar.gz |
profiling: Only compile profile/profile.c if profiling is enabled
This conditional compile avoids some #ifdef WITH_PROFILE, which makes the code
more readable
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/profile')
-rw-r--r-- | source3/profile/profile.c | 17 | ||||
-rw-r--r-- | source3/profile/profile_dummy.c | 31 |
2 files changed, 32 insertions, 16 deletions
diff --git a/source3/profile/profile.c b/source3/profile/profile.c index 9ef2c69ff6e..9367ff45fa9 100644 --- a/source3/profile/profile.c +++ b/source3/profile/profile.c @@ -29,14 +29,10 @@ #define PROF_SHM_MAGIC 0x6349985 #define PROF_SHM_VERSION 13 -#ifdef WITH_PROFILE #define IPC_PERMS ((S_IRUSR | S_IWUSR) | S_IRGRP | S_IROTH) -#endif /* WITH_PROFILE */ -#ifdef WITH_PROFILE static int shm_id; static bool read_only; -#endif struct profile_header { int prof_shm_magic; @@ -55,7 +51,6 @@ Set a profiling level. ****************************************************************************/ void set_profile_level(int level, struct server_id src) { -#ifdef WITH_PROFILE switch (level) { case 0: /* turn off profiling */ do_profile_flag = False; @@ -81,13 +76,8 @@ void set_profile_level(int level, struct server_id src) (int)procid_to_pid(&src))); break; } -#else /* WITH_PROFILE */ - DEBUG(1,("INFO: Profiling support unavailable in this build.\n")); -#endif /* WITH_PROFILE */ } -#ifdef WITH_PROFILE - /**************************************************************************** receive a set profile level message ****************************************************************************/ @@ -119,11 +109,8 @@ static void reqprofile_message(struct messaging_context *msg_ctx, { int level; -#ifdef WITH_PROFILE level = 1 + (do_profile_flag?2:0) + (do_profile_times?4:0); -#else - level = 0; -#endif + DEBUG(1,("INFO: Received REQ_PROFILELEVEL message from PID %u\n", (unsigned int)procid_to_pid(&src))); messaging_send_buf(msg_ctx, src, MSG_PROFILELEVEL, @@ -413,5 +400,3 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) SMB_ASSERT(val < PR_VALUE_MAX); return valnames[val]; } - -#endif /* WITH_PROFILE */ diff --git a/source3/profile/profile_dummy.c b/source3/profile/profile_dummy.c new file mode 100644 index 00000000000..1f820ec14b9 --- /dev/null +++ b/source3/profile/profile_dummy.c @@ -0,0 +1,31 @@ +/* + * Unix SMB/CIFS implementation. + * profile.c implementation if profiles are not enabled + * 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/>. + */ + +#include "includes.h" +#include "smbprofile.h" + +bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) +{ + return true; +} + +void set_profile_level(int level, struct server_id src) +{ + DEBUG(1,("INFO: Profiling support unavailable in this build.\n")); +} |