mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
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 <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
a33b445a7d
commit
17c7f45481
@ -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 */
|
||||
|
||||
|
33
source3/utils/status_profile_dummy.c
Normal file
33
source3/utils/status_profile_dummy.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* 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
|
||||
* 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 status_profile_dump(bool be_verbose)
|
||||
{
|
||||
fprintf(stderr, "Profile data unavailable\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool status_profile_rates(bool be_verbose)
|
||||
{
|
||||
fprintf(stderr, "Profile data unavailable\n");
|
||||
return true;
|
||||
}
|
@ -1164,10 +1164,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user