summaryrefslogtreecommitdiffstats
path: root/source3/include/smbprofile.h
Commit message (Collapse)AuthorAgeFilesLines
* s3:smbprofile: profile the system and user space cpu timeStefan Metzmacher2015-03-061-0/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:smbprofile: Replace sysv shmem with tdbVolker Lendecke2015-03-061-17/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* s3:smbprofile: specify SMBPROFILE_STATS_SECTION_START() with name vs. ↵Stefan Metzmacher2015-03-061-10/+10
| | | | | | | | display[name] Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:smbprofile: profile async pread/pwrite/fsync syscallsStefan Metzmacher2014-11-191-0/+3
| | | | | | | | 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): Wed Nov 19 23:13:10 CET 2014 on sn-devel-104
* s3:smbprofile: track connect_count and disconnect_countStefan Metzmacher2014-11-191-0/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: remove unused {START,END}_PROFILE_STAMP()Stefan Metzmacher2014-11-191-19/+0
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: report idle state of 'idle_count' and 'idle_time'Stefan Metzmacher2014-11-191-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: improve profiling for the security context switching.Stefan Metzmacher2014-11-191-1/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: count all SMB1 and SMB2 requests as 'request_count'Stefan Metzmacher2014-11-191-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smb2_server: use async smbprofile macrosStefan Metzmacher2014-11-191-19/+19
| | | | | | | | This improves profiling and corrently counts the total and idle time for async requests. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: rewrite the internal macrosStefan Metzmacher2014-11-191-829/+467
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* s3:smbprofile: Make smbprofile.h includable on its ownVolker Lendecke2014-11-191-0/+2
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbd: improve writecache profilingStefan Metzmacher2014-11-191-7/+15
| | | | | | | | | | | | | | | | | In order to have useful profiling counters should never be decremented. We need a separate counter for deallocation events. The current value can be calculated by allocations - deallocations. We also use better names and avoid having an array for the flush reasons. This will simplify further profiling improvements a lot. The value writecache_num_write_caches (this was similar to writecache_allocations) is replaced by writecache_cached_writes, which counts the amount of writes which were completely handled by the cache. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: remove unused nmbd related countersStefan Metzmacher2014-11-191-73/+0
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:smbprofile: add END_PROFILE_BYTES() marcoStefan Metzmacher2014-11-191-0/+4
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* profiling: Make WITH_PROFILE span more in smbprofile.hVolker Lendecke2014-10-031-2/+3
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 3 22:17:46 CEST 2014 on sn-devel-104
* profiling: Fix a typoVolker Lendecke2014-10-031-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* profiling: Move some #defines to profile.cVolker Lendecke2014-10-031-4/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* profiling: Fix a typoVolker Lendecke2014-10-031-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* profiling: Make "struct profile_header" staticVolker Lendecke2014-10-031-7/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Rename the profile enums with a SAMBA_ prefix to avoid conflict with system ↵Jeremy Allison2013-11-221-1/+1
| | | | | | | | | files. WRITE_FLUSH is defined in fs.h in Linux. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* s3:include remove non-blank line endingsChristian Ambach2013-05-161-3/+3
| | | | | | Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s3:include bump profile memory area version numberChristian Ambach2013-03-201-1/+1
| | | | | | | forgot to bump this earlier when removing the counters for setdir Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: remove some dead code (for setdir command)Christian Ambach2013-03-121-5/+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
* s3:include: add START/END_PROFILE_STAMP()Stefan Metzmacher2012-06-201-7/+23
| | | | | | This is needed when the profiling spans multiple functions. metze
* s3: only include smb profiling where needed.Günther Deschner2011-04-141-0/+5
| | | | | | | Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Thu Apr 14 01:31:39 CEST 2011 on sn-devel-104
* Add fdopendir to the VFS. We will use this to reuse a directory fd already ↵Jeremy Allison2011-02-091-0/+4
| | | | | | | open by NtCreateX. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 9 00:55:22 CET 2011 on sn-devel-104
* Rename vfs operation posix_fallocate to just fallocate and add the ↵Jeremy Allison2010-12-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* Move posix_fallocate into the VFS where it belongs.Jeremy Allison2010-12-021-0/+4
| | | | Jeremy.
* s3/profile: remove the magical clock initialization from the profile codeBjörn Jacke2010-09-141-8/+3
| | | | | | 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.
* s3: we have clock_gettime everywhere, remove ifdefsBjörn Jacke2010-08-311-13/+0
|
* s3: Cleanup of the initial SMB2 counters patch.Ira Cooper2010-07-091-10/+0
| | | | | | | This reorganizes smbd_smb2_request_dispatch to have a central exit point, and use the normal profiling macros. Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Add SMB2 performance counters.Ira Cooper2010-07-071-2/+85
| | | | A performance counter was added for every base type of SMB2 op.
* s3: Add strict lock/unlock calls to the vfs layer to replace is_lockedDave Richards2009-03-131-0/+8
|
* S3: Add in profile counters for new vfs and syscall entries.todd stecher2009-02-241-0/+28
|
* s3: Add a new SMB_VFS_GET_ALLOC_SIZE vfs operationTim Prouty2009-01-291-0/+4
| | | | | This allows module implementors to customize what allocation size is returned to the client.
* Use {u,}int64_t instead of SMB_BIG_{U,}INT.Jelmer Vernooij2008-10-141-4/+4
|
* Yay ! Remove a VFS entry. Removed the set_nt_acl() call,Jeremy Allison2008-05-081-4/+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)
* Add missing recvfile_bytes element - noticed by Kukks.Jeremy Allison2007-11-011-0/+1
| | | | | Jeremy. (This used to be commit 5cf2811e8e1d9e6a1114bbdff89c333d5b374282)
* Add in the recvfile entry to the VFS layer with a defaultJeremy Allison2007-10-291-0/+4
| | | | | | implementation. Needed for the zero-copy write code. Jeremy. (This used to be commit bfbdb6324c5d13bfde8b742e9c5a0e0c9092bd86)
* RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison2007-10-181-2/+2
| | | | | | | | bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
* r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell2007-10-101-2/+1
| | | | (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
* r23779: Change from v2 or later to v3 or later.Jeremy Allison2007-10-101-1/+1
| | | | | Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
* r23105: Add lchown to the vfs layer. We need this in the POSIX code.Jeremy Allison2007-10-101-0/+4
| | | | | Jeremy. (This used to be commit 932523cbb508db869b726768e86bfa8e248f768b)
* r21714: Change the VFS interface to use struct timespecJeremy Allison2007-10-101-3/+3
| | | | | | | | | | | for utimes - change the call to ntimes. This preserves nsec timestamps we get from stat (if the system supports it) and only maps back down to usec or sec resolution on time set. Looks bigger than it is as I had to move lots of internal code from using time_t and struct utimebuf to struct timespec. Jeremy. (This used to be commit 8f3d530c5a748ea90f42ed8fbe68ae92178d4875)
* r21324: Add linux setlease to the vfs layer. Next round, as Volker points out,Jim McDonough2007-10-101-0/+4
| | | | | | | | | | it should be abstracted a little higher up so other os'es can have an entry, but it will take a bit more work. Thanks to Chetan Shringarpure and Mathias Dietz. I didn't increment the vfs number again because the kernel change notify stuff hasn't been released yet anyway. (This used to be commit 9463211bf3b46ee408b88dfbf42d498e3839d4cc)
* r21002: Get rid of unused macros - merge change from 3_0_24Herb Lewis2007-10-101-8/+0
| | | | (This used to be commit 9d23cf0cc4a8974bf0cf74b219a1138383083360)
* r20742: Rename chkpth -> checkpath for sanity's sake :-).Jeremy Allison2007-10-101-3/+3
| | | | | | | Start removing unneeded "BOOL ok" from this reply.c (this logic is old, old, old..... :-). Jeremy. (This used to be commit 3d52268095c605a80dfcd371769198a332baa0a5)
* r19647: Add some GPFS support in a vfs mod. Also adds the kernel flock op toJim McDonough2007-10-101-0/+4
| | | | | | the vfs layer, since gpfs supports it. Thanks to Volker, Christian, Mathias, Chetan, and Peter. (This used to be commit 0620658890fa9c68a9848538728023192319c81a)
* r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison2007-10-101-345/+696
| | | | | | | | to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)