summaryrefslogtreecommitdiff
path: root/source3/profile
AgeCommit message (Collapse)AuthorFilesLines
2026-04-07s3:smbprofile: make smbprofile.tdb none readable for othersRalph Wuerthner1-1/+1
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com> Reviewed-by: Xavi Hernandez <xhernandez@redhat.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15profiling: Fix a commentVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02lib: Use talloc_realloc_zero() in a few obvious placesVolker Lendecke1-6/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-23profile: reset per-share countersShachar Sharon1-0/+23
Allow zero-reset dynamic per-share profile counters when sending 'smbcontrol smbd profile flush' to active smbd. Signed-off-by: Shachar Sharon <ssharon@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-23profile: collect per-share counters from TDBShachar Sharon2-0/+58
Helper functions to iterate over per-share profile counters from TDB file using callback function. Signed-off-by: Shachar Sharon <ssharon@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-06-23profile: dynamic per-share in-memory countersShachar Sharon1-0/+187
Mechanism to support per-share per-process run-time profiling counters. Use in-memory cache for storing run-time entries, using 'snum' as key. When storing in TDB file, uses unique key for each per-share profile entry. Signed-off-by: Shachar Sharon <ssharon@redhat.com> Signed-off-by: Avan Thakkar <athakkar@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-04-11smbprofile: Count failed requestsVolker Lendecke1-0/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-04-11profile: Add number of sessions, tcons and files to smbstatus -PVolker Lendecke1-2/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-04-11profile: Add sessions, tcons and files to profile dataVolker Lendecke1-0/+19
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-04-11profile: Pass dummy smbd_server_connection to smbprofile_dump()Volker Lendecke1-2/+2
It will need access to its fields soon. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-04-11profile: Return number of workers from smbprofile_collect_tdb()Volker Lendecke2-5/+27
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2025-04-11profile: Add time buckets to smbprofile_stats_iobytesVolker Lendecke1-0/+20
Enable a histogram of time taken for smb2 requests. This puts all smb2 requests into buckets of <1, <2, <4, ... <256 msecs duration and beyond. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2023-12-19profile: Fix rusage reportingVolker Lendecke1-10/+10
getrusage already gives accumulated values, so add them to the tdb record after smbprofile_stats_accumulate. Maybe we should not zero out our internal copy after writing the tdb, this would save a call to smbprofile_stats_accumulate() once a second. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2023-12-19profile: Fix a small memleakVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2023-11-20profile: issues info message with lower log levelBjörn Jacke1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15377 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-16profiling: Factor out functions to read smbprofile.tdbVolker Lendecke2-139/+207
We don't need all of Samba just to dump contents of this tdb, make exporting profile information cheaper. No direct use yet, but it's a good cleanup IMHO Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-07-25s3:profile: make use of tevent_cached_getpid() in performance critical codeStefan Metzmacher1-1/+3
This avoids wasting getpid() during profiling. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jul 25 18:32:18 UTC 2022 on sn-devel-184
2022-01-18profile3: remove an unused includeVolker Lendecke1-1/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-09s3:profile: Allow profile subsystem to use SHA1 in FIPS modeAndreas Schneider1-0/+7
This is non-cryptographic use. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jul 9 13:31:46 UTC 2019 on sn-devel-184
2019-07-09s3:profile: Use SHA1 for hashing in profiling functions.Andreas Schneider1-6/+5
This can use SHA NI instructions if the CPU supports it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-05-21s3:profile: Use GnuTLS MD5Andreas Schneider1-9/+23
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-01-16profiling: stop smbprofile from growing unnecessarilyDylan Stephano-Shachter1-0/+5
Signed-off-by: Dylan Stephano-Shachter <dshachter@nasuni.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jan 16 02:01:55 CET 2019 on sn-devel-144
2018-08-17lib: Pass mem_ctx to cache_path()Volker Lendecke1-1/+1
Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Aug 17 14:28:51 CEST 2018 on sn-devel-144
2016-03-28s3-profile: reduce dependencies of smbprofile.hUri Simchoni2-7/+7
Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-11-16smbprofile: Add dst pid to smbprofile_cleanupVolker Lendecke1-2/+2
The consolidation will soon be done by a separate process. We need to avoid the getpid() call in smbprofile_cleanup(). Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-05-14Convert all uint32/16/8 to _t in a grab-bag of remaining files.Richard Sharpe1-1/+1
I still need to fix the rpc stuff, but we are almost there. Signed-off-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 14 22:16:56 CEST 2015 on sn-devel-104
2015-03-06s3:smbprofile: profile the system and user space cpu timeStefan Metzmacher1-0/+22
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2015-03-06s3:smbprofile: Replace sysv shmem with tdbVolker Lendecke1-80/+301
What? This patch gets rid of the central shared memory segment referenced by "profile_p". Instead, every smbd gets a static profile_area where it collects profiling data. Once a second, every smbd writes this profiling data into a record of its own in a "smbprofile.tdb". smbstatus -P does a tdb_traverse on this database and sums up what it finds. Why? At least in my perception sysv IPC has not the best reputation on earth. The code before this patch uses shmat(). Samba ages ago has developed a good abstraction of shared memory: It's called tdb. The main reason why I started this is that I have a request to become more flexible with profiling data. Samba should be able to collect data per share or per user, something which is almost impossible to do with a fixed structure. My idea is to for example install a profile area per share and every second marshall this into one tdb record indexed by share name. smbstatus -P would then also collect the data and either aggregate them or put them into individual per-share statistics. This flexibility in the data model is not really possible with one fixed structure. But isn't it slow? Well, I don't think so. I can't really prove it, but I do believe that on large boxes atomically incrementing a shared memory value for every SMB does show up due to NUMA effects. With this patch the hot code path is completely process-local. Once a second every smbd writes into a central tdb, this of course does atomic operations. But it's once a second, not on every SMB2 read. There's two places where I would like to improve things: With the current code all smbds wake up once a second. With 10,000 potentially idle smbds this will become noticable. That's why the current only starts the timer when something has changed. The second place is the tdb traverse: Right now traverse is blocking in the sense that when it has to switch hash chains it will block. With mutexes, this means a syscall. I have a traverse light in mind that works as follows: It assumes a locked hash chain and then walks the complete chain in one run without unlocking in between. This way the caller can do nonblocking locks in the first round and only do blocking locks in a second round. Also, a lot of syscall overhead will vanish. This way smbstatus -P will have almost zero impact on normal operations. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2014-11-19s3:smbprofile: rewrite the internal macrosStefan Metzmacher1-188/+1
We now autogenerate a lot of code using SMBPROFILE_STATS_ALL_SECTIONS macro which expands to different SMBPROFILE_STATS_{COUNT,BASIC,BYTES,IOBYTES} macros. This also allows async profiling using: struct mystate { ... SMBPROFILE_BASIC_ASYNC_STATE(profile_state); ... }; ... SMBPROFILE_BASIC_ASYNC_START(SMB2_negotiate, profile_p, mystate->profile_state); ... SMBPROFILE_BYTES_ASYNC_SET_IDLE(mystate->profile_state); ... SMBPROFILE_BYTES_ASYNC_SET_BUSY(mystate->profile_state); ... SMBPROFILE_BASIC_ASYNC_END(mystate->profile_state); The current START_PROFILE*()/END_PROFILE*() are implemented as legacy wrappers. Signed-off-by: Stefan Metzmacher <metze@samba.org>
2014-11-19s3:smbprofile: remove unused nmbd related countersStefan Metzmacher1-19/+1
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-07smbd: Fix nonempty line endingsVolker Lendecke1-15/+14
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2014-10-03profiling: Only compile profile/profile.c if profiling is enabledVolker Lendecke2-16/+32
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>
2014-10-03profiling: Move some #defines to profile.cVolker Lendecke1-0/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-03profiling: Make "struct profile_header" staticVolker Lendecke1-1/+7
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-03-12s3: remove some dead code (for setdir command)Christian Ambach1-1/+0
set dir seems to have been a special SMB command used by Pathworks clients the supporting code for it was already removed in 2007, so just remove all remnants related to it (smb.conf parameter, documentation, ...) Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Mar 12 01:03:37 CET 2013 on sn-devel-104
2011-04-15s3-build: fix the --with-profiling-data build on mac os x.Günther Deschner1-0/+1
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Fri Apr 15 13:33:43 CEST 2011 on sn-devel-104
2011-04-14s3: only include smb profiling where needed.Günther Deschner1-0/+1
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Thu Apr 14 01:31:39 CEST 2011 on sn-devel-104
2011-04-14s3: fix the build of --with-profiling-data.Günther Deschner1-0/+1
Guenther
2011-03-30s3-messages: make ndr_messaging.h part of messages.h.Günther Deschner1-1/+0
Guenther
2011-03-30s3-messages: only include messages.h where needed.Günther Deschner1-0/+1
Guenther
2010-12-18Rename vfs operation posix_fallocate to just fallocate and add the ↵Jeremy Allison1-1/+1
vfs_fallocate_mode parameter. It turns out we need the fallocate operations to be able to both allocate and extend filesize, and to allocate and not extend filesize, and posix_fallocate can only do the former. So by defining the vfs op as posix_fallocate we lose the opportunity to use any underlying syscalls (like Linux fallocate) that can do the latter as well. We don't currently use the non-extending filesize call, but now I've changed the vfs op definition we can in the future. For the moment simply map the fallocate op onto posix_fallocate for the VFS_FALLOCATE_EXTEND_SIZE case and return ENOSYS for the VFS_FALLOCATE_KEEP_SIZE case. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Dec 18 08:59:27 CET 2010 on sn-devel-104
2010-12-02Move posix_fallocate into the VFS where it belongs.Jeremy Allison1-0/+1
Jeremy.
2010-09-14s3/profile: remove the magical clock initialization from the profile codeBjörn Jacke1-56/+0
there's no point in not profiling times if no monotonic clock is found - monotonic and realtime clock are equally fast. Just use clock_gettime_mono instead.
2010-09-14s3/profiling: don't use CLOCK_PROCESS_CPUTIME_IDBjörn Jacke1-18/+0
that clock is a CPU burnometer but we need a chronometer for profiling.
2010-08-31s3: we have clock_gettime everywhere, remove ifdefsBjörn Jacke1-7/+0
2010-07-07s3: Add SMB2 performance counters.Ira Cooper1-0/+19
A performance counter was added for every base type of SMB2 op.
2010-05-08s3: Fix the buildVolker Lendecke1-0/+1
2009-09-08s3:smbd: Fix bug 6690, wrong error checkAndrew Klosterman1-1/+1
2009-02-24S3: Add in profile counters for new vfs and syscall entries.todd stecher1-0/+7
2008-05-08Yay ! Remove a VFS entry. Removed the set_nt_acl() call,Jeremy Allison1-1/+0
this can only be done via fset_nt_acl() using an open file/directory handle. I'd like to do the same with get_nt_acl() but am concerned about efficiency problems with "hide unreadable/hide unwritable" when doing a directory listing (this would mean opening every file in the dir on list). Moving closer to rationalizing the ACL model and maybe moving the POSIX calls into a posix_acl VFS module rather than having them as first class citizens of the VFS. Jeremy. (This used to be commit f487f742cb903a06fbf2be006ddc9ce9063339ed)