The branch, master has been updated
via 5496270 profiling: Make WITH_PROFILE span more in smbprofile.h
via f74ac71 profiling: Remove a big DEBUG statement
via 5254a7e profiling: Remove some #ifdefs
via c7c300f profiling: Only compile profile/profile.c if profiling is
enabled
via 17c7f45 profiling: Only compile utils/status_profile.c if profiling
is enabled
via a33b445 profiling: Fix a typo
via 0e1b60e profiling: Move some #defines to profile.c
via d523e0b profiling: Fix a typo
via 7c1f6c7 profiling: Make "struct profile_header" static
via 902086d winbind3: Fix pwent variable substitution
from 1c5ef28 Reduce the no-op build times by 30%
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5496270d0f615aa39de0a083ec74fb40a988f64b
Author: Volker Lendecke <[email protected]>
Date: Thu Oct 2 13:45:01 2014 +0000
profiling: Make WITH_PROFILE span more in smbprofile.h
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Fri Oct 3 22:17:46 CEST 2014 on sn-devel-104
commit f74ac712aea8d354b70966ffd3f617c65a17d8d0
Author: Volker Lendecke <[email protected]>
Date: Thu Oct 2 13:40:35 2014 +0000
profiling: Remove a big DEBUG statement
I would like to have the freedom to play with the profiling implementation.
This is kindof in the way.
This code is from pre-SVN days:
> commit 7914e9351abb5271ebb4990c3b1fe495d15a4eda
> Author: Jeremy Allison <[email protected]>
> AuthorDate: Thu Oct 5 18:50:18 2000 +0000
> Commit: Jeremy Allison <[email protected]>
> CommitDate: Thu Oct 5 18:50:18 2000 +0000
>
> Herb's fixes for profiling & compiler warnings.
> Jeremy.
Herb, please speak up quickly if you still need this :-)
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 5254a7e1e5ab216a679bfbf3584bb8a16f502a2b
Author: Volker Lendecke <[email protected]>
Date: Thu Oct 2 13:36:22 2014 +0000
profiling: Remove some #ifdefs
The DO_PROFILE_INC thingies already #define to nothing without
WITH_PROFILE, and any sane compiler will just not compile the if-condition
if there is no body to be executed.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit c7c300f9710f1f207b9fa0274648ba2dc11c1ffd
Author: Volker Lendecke <[email protected]>
Date: Tue Sep 30 15:08:20 2014 +0000
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 <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 17c7f454813be526876ac750ceb6fd1422577495
Author: Volker Lendecke <[email protected]>
Date: Tue Sep 30 15:08:20 2014 +0000
profiling: Only compile utils/status_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 <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit a33b445a7d7567b27f5247cb6060edbbeecf4d52
Author: Volker Lendecke <[email protected]>
Date: Thu Oct 2 13:05:07 2014 +0000
profiling: Fix a typo
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 0e1b60e8c3325a1e5ea77f420326b254d5404389
Author: Volker Lendecke <[email protected]>
Date: Thu Oct 2 12:52:05 2014 +0000
profiling: Move some #defines to profile.c
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit d523e0b7ed67d1697a1b8ab5f58902afd2a496b3
Author: Volker Lendecke <[email protected]>
Date: Tue Sep 30 13:06:02 2014 +0000
profiling: Fix a typo
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 7c1f6c7f61f27ec8e115cdce1e2ac15addd8fb84
Author: Volker Lendecke <[email protected]>
Date: Mon Sep 29 15:06:37 2014 +0000
profiling: Make "struct profile_header" static
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 902086d0d4c688236ad4a8248a50de8639e1e524
Author: Justin Maggard <[email protected]>
Date: Thu Oct 2 17:21:06 2014 -0700
winbind3: Fix pwent variable substitution
Commit 0ce46318 (winbind3: Simplify fillup_pw_field) broke variable
substitution by copying from the wrong (unsubstituted) buffer. Fix it.
Signed-off-by: Justin Maggard <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
Reviewed-by: Richard Sharpe <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
source3/include/smbprofile.h | 20 +++---------
source3/profile/profile.c | 29 +++++++-----------
.../profile/profile_dummy.c | 19 +++++++-----
source3/smbd/fileio.c | 31 --------------------
source3/smbd/server.c | 2 -
source3/utils/status_profile.c | 21 -------------
.../utils/status_profile_dummy.c | 23 +++++++++------
source3/winbindd/wb_fill_pwent.c | 2 +-
source3/wscript_build | 22 ++++++++++----
9 files changed, 59 insertions(+), 110 deletions(-)
copy lib/util/close_low_fd.h => source3/profile/profile_dummy.c (69%)
copy lib/util/close_low_fd.h => source3/utils/status_profile_dummy.c (66%)
Changeset truncated at 500 lines:
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 8ecbc30..a37ac4f 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -21,13 +21,11 @@
*/
+#ifdef WITH_PROFILE
+
/* 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 13
-
/* time values in the following structure are in microseconds */
#define __profile_stats_value(which, domain) domain[which]
@@ -835,7 +833,7 @@ enum profile_stats_values
#define smb2_break_count __profile_stats_value(PR_VALUE_SMB2_BREAK, count)
#define smb2_break_time __profile_stats_value(PR_VALUE_SMB2_BREAK, time)
- /* This mist remain the last value. */
+ /* This must remain the last value. */
PR_VALUE_MAX
}; /* enum profile_stats_values */
@@ -876,22 +874,13 @@ struct profile_stats {
unsigned writecache_allocated_write_caches;
};
-struct profile_header {
- int prof_shm_magic;
- int prof_shm_version;
- struct profile_stats stats;
-};
-
-extern struct profile_header *profile_h;
extern struct profile_stats *profile_p;
extern bool do_profile_flag;
extern bool do_profile_times;
-#ifdef WITH_PROFILE
-
/* 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
+ * below which test for the profile flags first
*/
#define INC_PROFILE_COUNT(x) profile_p->x++
#define DEC_PROFILE_COUNT(x) profile_p->x--
@@ -975,6 +964,7 @@ static inline uint64_t profile_timestamp(void)
#define START_PROFILE_BYTES(x,n)
#define END_PROFILE_STAMP(x, _stamp)
#define END_PROFILE(x)
+
#endif /* WITH_PROFILE */
/* The following definitions come from profile/profile.c */
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 5f9433f..9367ff4 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -25,16 +25,22 @@
#include "messages.h"
#include "smbprofile.h"
-#ifdef WITH_PROFILE
+#define PROF_SHMEM_KEY ((key_t)0x07021999)
+#define PROF_SHM_MAGIC 0x6349985
+#define PROF_SHM_VERSION 13
+
#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 *profile_h;
+struct profile_header {
+ int prof_shm_magic;
+ int prof_shm_version;
+ struct profile_stats stats;
+};
+
+static struct profile_header *profile_h;
struct profile_stats *profile_p;
bool do_profile_flag = False;
@@ -45,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;
@@ -71,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
****************************************************************************/
@@ -109,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,
@@ -403,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/lib/util/close_low_fd.h b/source3/profile/profile_dummy.c
similarity index 69%
copy from lib/util/close_low_fd.h
copy to source3/profile/profile_dummy.c
index 954d1d2..1f820ec 100644
--- a/lib/util/close_low_fd.h
+++ b/source3/profile/profile_dummy.c
@@ -1,6 +1,6 @@
/*
* Unix SMB/CIFS implementation.
- * Samba utility functions
+ * 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
@@ -17,12 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _CLOSE_LOW_FD_H
-#define _CLOSE_LOW_FD_H
+#include "includes.h"
+#include "smbprofile.h"
-/*
- * Redirect "fd" to /dev/null
- */
-int close_low_fd(int fd);
+bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
+{
+ return true;
+}
-#endif
+void set_profile_level(int level, struct server_id src)
+{
+ DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
+}
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index b0da7a2..37c3f66 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -345,12 +345,10 @@ ssize_t write_file(struct smb_request *req,
mark_file_modified(fsp);
-#ifdef WITH_PROFILE
DO_PROFILE_INC(writecache_total_writes);
if (!fsp->oplock_type) {
DO_PROFILE_INC(writecache_non_oplock_writes);
}
-#endif
/*
* If this file is level II oplocked then we need
@@ -364,31 +362,6 @@ ssize_t write_file(struct smb_request *req,
contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WRITE);
contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WRITE);
-#ifdef WITH_PROFILE
- if (profile_p && profile_p->writecache_total_writes % 500 == 0) {
- DEBUG(3,("WRITECACHE: initwrites=%u abutted=%u total=%u \
-nonop=%u allocated=%u active=%u direct=%u perfect=%u readhits=%u\n",
- profile_p->writecache_init_writes,
- profile_p->writecache_abutted_writes,
- profile_p->writecache_total_writes,
- profile_p->writecache_non_oplock_writes,
- profile_p->writecache_allocated_write_caches,
- profile_p->writecache_num_write_caches,
- profile_p->writecache_direct_writes,
- profile_p->writecache_num_perfect_writes,
- profile_p->writecache_read_hits ));
-
- DEBUG(3,("WRITECACHE: Flushes SEEK=%d, READ=%d, WRITE=%d,
READRAW=%d, OPLOCK=%d, CLOSE=%d, SYNC=%d\n",
- profile_p->writecache_flushed_writes[SAMBA_SEEK_FLUSH],
- profile_p->writecache_flushed_writes[SAMBA_READ_FLUSH],
- profile_p->writecache_flushed_writes[SAMBA_WRITE_FLUSH],
-
profile_p->writecache_flushed_writes[SAMBA_READRAW_FLUSH],
-
profile_p->writecache_flushed_writes[SAMBA_OPLOCK_RELEASE_FLUSH],
- profile_p->writecache_flushed_writes[SAMBA_CLOSE_FLUSH],
- profile_p->writecache_flushed_writes[SAMBA_SYNC_FLUSH]
));
- }
-#endif
-
if (wcp && req->unread_bytes) {
/* If we're using receivefile don't
* deal with a write cache.
@@ -826,13 +799,11 @@ n = %u, wcp->offset=%.0f, wcp->data_size=%u\n",
*/
if (n) {
-#ifdef WITH_PROFILE
if (wcp->data_size) {
DO_PROFILE_INC(writecache_abutted_writes);
} else {
DO_PROFILE_INC(writecache_init_writes);
}
-#endif
if ((wcp->data_size == 0)
&& (pos > wcp->file_size)
@@ -997,11 +968,9 @@ ssize_t flush_write_cache(files_struct *fsp, enum
flush_reason_enum reason)
DEBUG(9,("flushing write cache: fd = %d, off=%.0f, size=%u\n",
fsp->fh->fd, (double)wcp->offset, (unsigned int)data_size));
-#ifdef WITH_PROFILE
if(data_size == wcp->alloc_size) {
DO_PROFILE_INC(writecache_num_perfect_writes);
}
-#endif
ret = real_write_file(NULL, fsp, wcp->data, wcp->offset, data_size);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 658f268..8b9a1c1 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1304,7 +1304,6 @@ extern void build_options(bool screen);
init_structs();
-#ifdef WITH_PROFILE
if (!profile_setup(msg_ctx, False)) {
DEBUG(0,("ERROR: failed to setup profiling\n"));
return -1;
@@ -1317,7 +1316,6 @@ extern void build_options(bool screen);
src.pid = getpid();
set_profile_level(pl, src);
}
-#endif
if (!is_daemon && !is_a_socket(0)) {
if (!interactive) {
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index 0923bae..153fba6 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -24,7 +24,6 @@
bool status_profile_dump(bool be_verbose);
bool status_profile_rates(bool be_verbose);
-#ifdef WITH_PROFILE
static void profile_separator(const char * title)
{
char line[79 + 1];
@@ -39,14 +38,12 @@ static void profile_separator(const char * title)
line[sizeof(line) - 1] = '\0';
d_printf("%s\n", line);
}
-#endif
/*******************************************************************
dump the elements of the profile structure
******************************************************************/
bool status_profile_dump(bool verbose)
{
-#ifdef WITH_PROFILE
if (!profile_setup(NULL, True)) {
fprintf(stderr,"Failed to initialise profile memory\n");
return False;
@@ -437,16 +434,9 @@ bool status_profile_dump(bool verbose)
d_printf("smb2_break_count: %u\n",
profile_p->smb2_break_count);
d_printf("smb2_break_time: %u\n",
profile_p->smb2_break_time);
-#else /* WITH_PROFILE */
-
- fprintf(stderr, "Profile data unavailable\n");
-#endif /* WITH_PROFILE */
-
return True;
}
-#ifdef WITH_PROFILE
-
/* Convert microseconds to milliseconds. */
#define usec_to_msec(s) ((s) / 1000)
/* Convert microseconds to seconds. */
@@ -566,14 +556,3 @@ bool status_profile_rates(bool verbose)
return True;
}
-
-#else /* WITH_PROFILE */
-
-bool status_profile_rates(bool verbose)
-{
- fprintf(stderr, "Profile data unavailable\n");
- return False;
-}
-
-#endif /* WITH_PROFILE */
-
diff --git a/lib/util/close_low_fd.h b/source3/utils/status_profile_dummy.c
similarity index 66%
copy from lib/util/close_low_fd.h
copy to source3/utils/status_profile_dummy.c
index 954d1d2..c58f696 100644
--- a/lib/util/close_low_fd.h
+++ b/source3/utils/status_profile_dummy.c
@@ -1,7 +1,7 @@
/*
* Unix SMB/CIFS implementation.
- * Samba utility functions
- * Copyright (C) Volker Lendecke 2014
+ * Samba internal messaging functions
+ * Copyright (C) 2013 by Volker Lendecke
*
* 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
@@ -17,12 +17,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _CLOSE_LOW_FD_H
-#define _CLOSE_LOW_FD_H
+#include "includes.h"
+#include "smbprofile.h"
-/*
- * Redirect "fd" to /dev/null
- */
-int close_low_fd(int fd);
+bool status_profile_dump(bool be_verbose)
+{
+ fprintf(stderr, "Profile data unavailable\n");
+ return true;
+}
-#endif
+bool status_profile_rates(bool be_verbose)
+{
+ fprintf(stderr, "Profile data unavailable\n");
+ return true;
+}
diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index 206827c..1135ef3 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -240,7 +240,7 @@ static bool fillup_pw_field(const char *lp_template,
return False;
}
- fstrcpy(out, templ);
+ fstrcpy(out, result);
TALLOC_FREE(result);
return True;
diff --git a/source3/wscript_build b/source3/wscript_build
index 7394a57..54ba3a7 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -638,9 +638,14 @@ bld.SAMBA3_SUBSYSTEM('LOCKING',
NDR_OPEN_FILES
FNAME_UTIL''')
-bld.SAMBA3_SUBSYSTEM('PROFILE',
- source='profile/profile.c',
- deps='samba-util')
+if bld.CONFIG_GET("WITH_PROFILE"):
+ bld.SAMBA3_SUBSYSTEM('PROFILE',
+ source='profile/profile.c',
+ deps='samba-util')
+else:
+ bld.SAMBA3_SUBSYSTEM('PROFILE',
+ source='profile/profile_dummy.c',
+ deps='')
bld.SAMBA3_SUBSYSTEM('PRINTBASE',
source='''printing/notify.c printing/printing_db.c''',
@@ -1164,10 +1169,15 @@ bld.SAMBA3_BINARY('smbta-util',
secrets3
param''')
+smbstatus_source = 'utils/status.c smbd/notify_internal.c'
+
+if bld.CONFIG_GET("WITH_PROFILE"):
+ smbstatus_source += ' utils/status_profile.c'
+else:
+ smbstatus_source += ' utils/status_profile_dummy.c'
+
bld.SAMBA3_BINARY('smbstatus',
- source='''utils/status.c
- utils/status_profile.c
- smbd/notify_internal.c''',
+ source=smbstatus_source,
deps='''
talloc
param
--
Samba Shared Repository