4 Unix SMB/CIFS implementation.
5 store smbd profiling information in shared memory
6 Copyright (C) Andrew Tridgell 1999
7 Copyright (C) James Peach 2006
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 /* this file defines the profile structure in the profile shared
29 /* time values in the following structure are in microseconds */
31 #define __profile_stats_value(which, domain) domain[which]
33 enum profile_stats_values
35 PR_VALUE_SMBD_IDLE
= 0,
36 #define smbd_idle_count __profile_stats_value(PR_VALUE_SMBD_IDLE, count)
37 #define smbd_idle_time __profile_stats_value(PR_VALUE_SMBD_IDLE, time)
39 /* system call counters */
40 PR_VALUE_SYSCALL_OPENDIR
,
41 #define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count)
42 #define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
44 PR_VALUE_SYSCALL_FDOPENDIR
,
45 #define syscall_fdopendir_count __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, count)
46 #define syscall_fdopendir_time __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, time)
48 PR_VALUE_SYSCALL_READDIR
,
49 #define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
50 #define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time)
52 PR_VALUE_SYSCALL_SEEKDIR
,
53 #define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count)
54 #define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time)
56 PR_VALUE_SYSCALL_TELLDIR
,
57 #define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count)
58 #define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time)
60 PR_VALUE_SYSCALL_REWINDDIR
,
61 #define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count)
62 #define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time)
64 PR_VALUE_SYSCALL_MKDIR
,
65 #define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count)
66 #define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time)
68 PR_VALUE_SYSCALL_RMDIR
,
69 #define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count)
70 #define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time)
72 PR_VALUE_SYSCALL_CLOSEDIR
,
73 #define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count)
74 #define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time)
76 PR_VALUE_SYSCALL_OPEN
,
77 #define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
78 #define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
80 PR_VALUE_SYSCALL_CREATEFILE
,
81 #define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count)
82 #define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time)
84 PR_VALUE_SYSCALL_CLOSE
,
85 #define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
86 #define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
88 PR_VALUE_SYSCALL_READ
,
89 #define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count)
90 #define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time)
92 PR_VALUE_SYSCALL_PREAD
,
93 #define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count)
94 #define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time)
96 PR_VALUE_SYSCALL_WRITE
,
97 #define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count)
98 #define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time)
100 PR_VALUE_SYSCALL_PWRITE
,
101 #define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count)
102 #define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time)
104 PR_VALUE_SYSCALL_LSEEK
,
105 #define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count)
106 #define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time)
108 PR_VALUE_SYSCALL_SENDFILE
,
109 #define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count)
110 #define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time)
112 PR_VALUE_SYSCALL_RECVFILE
,
113 #define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count)
114 #define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time)
116 PR_VALUE_SYSCALL_RENAME
,
117 #define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
118 #define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
120 PR_VALUE_SYSCALL_RENAME_AT
,
121 #define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count)
122 #define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time)
124 PR_VALUE_SYSCALL_FSYNC
,
125 #define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
126 #define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
128 PR_VALUE_SYSCALL_STAT
,
129 #define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count)
130 #define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time)
132 PR_VALUE_SYSCALL_FSTAT
,
133 #define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count)
134 #define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time)
136 PR_VALUE_SYSCALL_LSTAT
,
137 #define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count)
138 #define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time)
140 PR_VALUE_SYSCALL_GET_ALLOC_SIZE
,
141 #define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count)
142 #define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time)
144 PR_VALUE_SYSCALL_UNLINK
,
145 #define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count)
146 #define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time)
148 PR_VALUE_SYSCALL_CHMOD
,
149 #define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count)
150 #define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time)
152 PR_VALUE_SYSCALL_FCHMOD
,
153 #define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count)
154 #define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time)
156 PR_VALUE_SYSCALL_CHOWN
,
157 #define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count)
158 #define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time)
160 PR_VALUE_SYSCALL_FCHOWN
,
161 #define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count)
162 #define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time)
164 PR_VALUE_SYSCALL_LCHOWN
,
165 #define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count)
166 #define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time)
168 PR_VALUE_SYSCALL_CHDIR
,
169 #define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count)
170 #define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time)
172 PR_VALUE_SYSCALL_GETWD
,
173 #define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count)
174 #define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time)
176 PR_VALUE_SYSCALL_NTIMES
,
177 #define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count)
178 #define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time)
180 PR_VALUE_SYSCALL_FTRUNCATE
,
181 #define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count)
182 #define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time)
184 PR_VALUE_SYSCALL_FALLOCATE
,
185 #define syscall_fallocate_count __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, count)
186 #define syscall_fallocate_time __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, time)
188 PR_VALUE_SYSCALL_FCNTL_LOCK
,
189 #define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count)
190 #define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time)
192 PR_VALUE_SYSCALL_KERNEL_FLOCK
,
193 #define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count)
194 #define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time)
196 PR_VALUE_SYSCALL_LINUX_SETLEASE
,
197 #define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count)
198 #define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time)
200 PR_VALUE_SYSCALL_FCNTL_GETLOCK
,
201 #define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count)
202 #define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time)
204 PR_VALUE_SYSCALL_READLINK
,
205 #define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count)
206 #define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time)
208 PR_VALUE_SYSCALL_SYMLINK
,
209 #define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count)
210 #define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time)
212 PR_VALUE_SYSCALL_LINK
,
213 #define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count)
214 #define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time)
216 PR_VALUE_SYSCALL_MKNOD
,
217 #define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count)
218 #define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time)
220 PR_VALUE_SYSCALL_REALPATH
,
221 #define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count)
222 #define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time)
224 PR_VALUE_SYSCALL_GET_QUOTA
,
225 #define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count)
226 #define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time)
228 PR_VALUE_SYSCALL_SET_QUOTA
,
229 #define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
230 #define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
232 PR_VALUE_SYSCALL_GET_SD
,
233 #define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count)
234 #define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time)
236 PR_VALUE_SYSCALL_SET_SD
,
237 #define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count)
238 #define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time)
240 PR_VALUE_SYSCALL_BRL_LOCK
,
241 #define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count)
242 #define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time)
244 PR_VALUE_SYSCALL_BRL_UNLOCK
,
245 #define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count)
246 #define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time)
248 PR_VALUE_SYSCALL_BRL_CANCEL
,
249 #define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count)
250 #define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time)
252 PR_VALUE_SYSCALL_STRICT_LOCK
,
253 #define syscall_strict_lock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, count)
254 #define syscall_strict_lock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, time)
256 PR_VALUE_SYSCALL_STRICT_UNLOCK
,
257 #define syscall_strict_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, count)
258 #define syscall_strict_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, time)
260 /* counters for individual SMB types */
262 #define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)
263 #define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time)
266 #define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count)
267 #define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time)
270 #define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count)
271 #define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time)
274 #define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count)
275 #define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time)
278 #define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count)
279 #define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time)
282 #define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count)
283 #define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time)
286 #define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count)
287 #define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time)
290 #define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count)
291 #define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time)
294 #define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count)
295 #define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time)
298 #define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count)
299 #define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time)
302 #define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count)
303 #define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time)
306 #define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count)
307 #define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time)
310 #define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count)
311 #define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time)
314 #define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count)
315 #define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time)
318 #define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count)
319 #define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time)
321 /* SMBmknew stats are currently combined with SMBcreate */
323 #define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count)
324 #define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time)
326 PR_VALUE_SMBCHECKPATH
,
327 #define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count)
328 #define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time)
331 #define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count)
332 #define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time)
335 #define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count)
336 #define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time)
338 PR_VALUE_SMBLOCKREAD
,
339 #define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count)
340 #define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time)
342 PR_VALUE_SMBWRITEUNLOCK
,
343 #define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count)
344 #define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time)
346 PR_VALUE_SMBREADBRAW
,
347 #define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count)
348 #define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time)
350 PR_VALUE_SMBREADBMPX
,
351 #define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count)
352 #define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time)
355 #define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count)
356 #define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time)
358 PR_VALUE_SMBWRITEBRAW
,
359 #define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count)
360 #define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time)
362 PR_VALUE_SMBWRITEBMPX
,
363 #define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count)
364 #define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time)
367 #define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count)
368 #define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time)
371 #define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count)
372 #define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time)
374 PR_VALUE_SMBSETATTRE
,
375 #define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count)
376 #define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time)
378 PR_VALUE_SMBGETATTRE
,
379 #define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count)
380 #define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time)
382 PR_VALUE_SMBLOCKINGX
,
383 #define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count)
384 #define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time)
387 #define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count)
388 #define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time)
391 #define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count)
392 #define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time)
395 #define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count)
396 #define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time)
399 #define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count)
400 #define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time)
403 #define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count)
404 #define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time)
407 #define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count)
408 #define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time)
411 #define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count)
412 #define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time)
414 PR_VALUE_SMBWRITECLOSE
,
415 #define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count)
416 #define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time)
419 #define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count)
420 #define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time)
423 #define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count)
424 #define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time)
427 #define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count)
428 #define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time)
431 #define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count)
432 #define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time)
435 #define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count)
436 #define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time)
438 PR_VALUE_SMBFINDCLOSE
,
439 #define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count)
440 #define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time)
442 PR_VALUE_SMBFINDNCLOSE
,
443 #define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count)
444 #define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time)
447 #define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count)
448 #define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time)
451 #define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count)
452 #define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time)
455 #define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count)
456 #define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time)
458 PR_VALUE_SMBSESSSETUPX
,
459 #define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count)
460 #define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time)
462 PR_VALUE_SMBULOGOFFX
,
463 #define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count)
464 #define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time)
467 #define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count)
468 #define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time)
471 #define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count)
472 #define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time)
475 #define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count)
476 #define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time)
478 /* SBMffirst stats combined with SMBsearch */
480 #define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count)
481 #define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time)
483 /* SBMfunique stats combined with SMBsearch */
485 #define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count)
486 #define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time)
489 #define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count)
490 #define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time)
493 #define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count)
494 #define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time)
496 PR_VALUE_SMBNTTRANSS
,
497 #define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count)
498 #define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time)
500 PR_VALUE_SMBNTCREATEX
,
501 #define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count)
502 #define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time)
504 PR_VALUE_SMBNTCANCEL
,
505 #define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count)
506 #define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time)
508 PR_VALUE_SMBNTRENAME
,
509 #define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count)
510 #define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time)
513 #define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count)
514 #define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time)
517 #define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count)
518 #define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time)
520 PR_VALUE_SMBSPLCLOSE
,
521 #define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count)
522 #define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time)
525 #define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count)
526 #define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time)
529 #define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count)
530 #define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time)
533 #define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count)
534 #define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time)
537 #define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count)
538 #define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time)
541 #define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count)
542 #define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time)
545 #define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count)
546 #define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time)
548 PR_VALUE_SMBSENDSTRT
,
549 #define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count)
550 #define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time)
553 #define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count)
554 #define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time)
557 #define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count)
558 #define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time)
561 #define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count)
562 #define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time)
564 /* These are the TRANS2 sub commands */
565 PR_VALUE_TRANS2_OPEN
,
566 #define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count)
567 #define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time)
569 PR_VALUE_TRANS2_FINDFIRST
,
570 #define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count)
571 #define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time)
573 PR_VALUE_TRANS2_FINDNEXT
,
574 #define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count)
575 #define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time)
577 PR_VALUE_TRANS2_QFSINFO
,
578 #define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count)
579 #define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time)
581 PR_VALUE_TRANS2_SETFSINFO
,
582 #define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count)
583 #define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time)
585 PR_VALUE_TRANS2_QPATHINFO
,
586 #define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count)
587 #define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time)
589 PR_VALUE_TRANS2_SETPATHINFO
,
590 #define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count)
591 #define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time)
593 PR_VALUE_TRANS2_QFILEINFO
,
594 #define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count)
595 #define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time)
597 PR_VALUE_TRANS2_SETFILEINFO
,
598 #define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count)
599 #define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time)
601 PR_VALUE_TRANS2_FSCTL
,
602 #define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count)
603 #define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time)
605 PR_VALUE_TRANS2_IOCTL
,
606 #define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count)
607 #define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time)
609 PR_VALUE_TRANS2_FINDNOTIFYFIRST
,
610 #define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count)
611 #define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time)
613 PR_VALUE_TRANS2_FINDNOTIFYNEXT
,
614 #define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count)
615 #define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time)
617 PR_VALUE_TRANS2_MKDIR
,
618 #define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count)
619 #define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time)
621 PR_VALUE_TRANS2_SESSION_SETUP
,
622 #define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count)
623 #define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time)
625 PR_VALUE_TRANS2_GET_DFS_REFERRAL
,
626 #define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count)
627 #define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time)
629 PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY
,
630 #define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count)
631 #define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time)
633 /* These are the NT transact sub commands. */
634 PR_VALUE_NT_TRANSACT_CREATE
,
635 #define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count)
636 #define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time)
638 PR_VALUE_NT_TRANSACT_IOCTL
,
639 #define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count)
640 #define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time)
642 PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC
,
643 #define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count)
644 #define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time)
646 PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE
,
647 #define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count)
648 #define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time)
650 PR_VALUE_NT_TRANSACT_RENAME
,
651 #define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count)
652 #define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time)
654 PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC
,
655 #define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count)
656 #define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time)
658 PR_VALUE_NT_TRANSACT_GET_USER_QUOTA
,
659 #define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count)
660 #define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time)
662 PR_VALUE_NT_TRANSACT_SET_USER_QUOTA
,
663 #define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count)
664 #define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time)
666 /* These are ACL manipulation calls */
668 #define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count)
669 #define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time)
671 PR_VALUE_FGET_NT_ACL
,
672 #define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count)
673 #define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time)
675 PR_VALUE_FSET_NT_ACL
,
676 #define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count)
677 #define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time)
680 #define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count)
681 #define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time)
684 #define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count)
685 #define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time)
687 PR_VALUE_SMB2_NEGPROT
,
688 #define smb2_negprot_count __profile_stats_value(PR_VALUE_SMB2_NEGPROT, count)
689 #define smb2_negprot_time __profile_stats_value(PR_VALUE_SMB2_NEGPROT, time)
691 PR_VALUE_SMB2_SESSSETUP
,
692 #define smb2_sesssetup_count __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, count)
693 #define smb2_sesssetup_time __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, time)
695 PR_VALUE_SMB2_LOGOFF
,
696 #define smb2_logoff_count __profile_stats_value(PR_VALUE_SMB2_LOGOFF, count)
697 #define smb2_logoff_time __profile_stats_value(PR_VALUE_SMB2_LOGOFF, time)
700 #define smb2_tcon_count __profile_stats_value(PR_VALUE_SMB2_TCON, count)
701 #define smb2_tcon_time __profile_stats_value(PR_VALUE_SMB2_TCON, time)
704 #define smb2_tdis_count __profile_stats_value(PR_VALUE_SMB2_TDIS, count)
705 #define smb2_tdis_time __profile_stats_value(PR_VALUE_SMB2_TDIS, time)
707 PR_VALUE_SMB2_CREATE
,
708 #define smb2_create_count __profile_stats_value(PR_VALUE_SMB2_CREATE, count)
709 #define smb2_create_time __profile_stats_value(PR_VALUE_SMB2_CREATE, time)
712 #define smb2_close_count __profile_stats_value(PR_VALUE_SMB2_CLOSE, count)
713 #define smb2_close_time __profile_stats_value(PR_VALUE_SMB2_CLOSE, time)
716 #define smb2_flush_count __profile_stats_value(PR_VALUE_SMB2_FLUSH, count)
717 #define smb2_flush_time __profile_stats_value(PR_VALUE_SMB2_FLUSH, time)
720 #define smb2_read_count __profile_stats_value(PR_VALUE_SMB2_READ, count)
721 #define smb2_read_time __profile_stats_value(PR_VALUE_SMB2_READ, time)
724 #define smb2_write_count __profile_stats_value(PR_VALUE_SMB2_WRITE, count)
725 #define smb2_write_time __profile_stats_value(PR_VALUE_SMB2_WRITE, time)
728 #define smb2_lock_count __profile_stats_value(PR_VALUE_SMB2_LOCK, count)
729 #define smb2_lock_time __profile_stats_value(PR_VALUE_SMB2_LOCK, time)
732 #define smb2_ioctl_count __profile_stats_value(PR_VALUE_SMB2_IOCTL, count)
733 #define smb2_ioctl_time __profile_stats_value(PR_VALUE_SMB2_IOCTL, time)
735 PR_VALUE_SMB2_CANCEL
,
736 #define smb2_cancel_count __profile_stats_value(PR_VALUE_SMB2_CANCEL, count)
737 #define smb2_cancel_time __profile_stats_value(PR_VALUE_SMB2_CANCEL, time)
739 PR_VALUE_SMB2_KEEPALIVE
,
740 #define smb2_keepalive_count __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, count)
741 #define smb2_keepalive_time __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, time)
744 #define smb2_find_count __profile_stats_value(PR_VALUE_SMB2_FIND, count)
745 #define smb2_find_time __profile_stats_value(PR_VALUE_SMB2_FIND, time)
747 PR_VALUE_SMB2_NOTIFY
,
748 #define smb2_notify_count __profile_stats_value(PR_VALUE_SMB2_NOTIFY, count)
749 #define smb2_notify_time __profile_stats_value(PR_VALUE_SMB2_NOTIFY, time)
751 PR_VALUE_SMB2_GETINFO
,
752 #define smb2_getinfo_count __profile_stats_value(PR_VALUE_SMB2_GETINFO, count)
753 #define smb2_getinfo_time __profile_stats_value(PR_VALUE_SMB2_GETINFO, time)
755 PR_VALUE_SMB2_SETINFO
,
756 #define smb2_setinfo_count __profile_stats_value(PR_VALUE_SMB2_SETINFO, count)
757 #define smb2_setinfo_time __profile_stats_value(PR_VALUE_SMB2_SETINFO, time)
760 #define smb2_break_count __profile_stats_value(PR_VALUE_SMB2_BREAK, count)
761 #define smb2_break_time __profile_stats_value(PR_VALUE_SMB2_BREAK, time)
763 /* This must remain the last value. */
765 }; /* enum profile_stats_values */
767 const char * profile_value_name(enum profile_stats_values val
);
769 struct profile_stats
{
770 /* general counters */
771 unsigned smb_count
; /* how many SMB packets we have processed */
772 unsigned uid_changes
; /* how many times we change our effective uid */
774 /* system call and protocol operation counters and cumulative times */
775 unsigned count
[PR_VALUE_MAX
];
776 unsigned time
[PR_VALUE_MAX
];
778 /* cumulative byte counts */
779 unsigned syscall_pread_bytes
;
780 unsigned syscall_pwrite_bytes
;
781 unsigned syscall_read_bytes
;
782 unsigned syscall_write_bytes
;
783 unsigned syscall_sendfile_bytes
;
784 unsigned syscall_recvfile_bytes
;
786 /* stat cache counters */
787 unsigned statcache_lookups
;
788 unsigned statcache_misses
;
789 unsigned statcache_hits
;
791 /* write cache counters */
792 unsigned writecache_allocations
;
793 unsigned writecache_deallocations
;
794 unsigned writecache_cached_reads
;
795 unsigned writecache_total_writes
;
796 unsigned writecache_init_writes
;
797 unsigned writecache_abutted_writes
;
798 unsigned writecache_non_oplock_writes
;
799 unsigned writecache_direct_writes
;
800 unsigned writecache_cached_writes
;
801 unsigned writecache_perfect_writes
;
802 unsigned writecache_flush_reason_seek
;
803 unsigned writecache_flush_reason_read
;
804 unsigned writecache_flush_reason_readraw
;
805 unsigned writecache_flush_reason_write
;
806 unsigned writecache_flush_reason_oplock
;
807 unsigned writecache_flush_reason_close
;
808 unsigned writecache_flush_reason_sync
;
809 unsigned writecache_flush_reason_sizechange
;
812 extern struct profile_stats
*profile_p
;
813 extern bool do_profile_flag
;
814 extern bool do_profile_times
;
816 /* these are helper macros - do not call them directly in the code
817 * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones
818 * below which test for the profile flags first
820 #define INC_PROFILE_COUNT(x) profile_p->x++
821 #define DEC_PROFILE_COUNT(x) profile_p->x--
822 #define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
824 static inline uint64_t profile_timestamp(void)
828 /* we might prefer to use the _COARSE clock variant of CLOCK_MONOTONIC
829 that one is faster but cached and "just" tick-wise precise */
830 clock_gettime_mono(&ts
);
831 return (ts
.tv_sec
* 1000000) + (ts
.tv_nsec
/ 1000); /* usec */
834 /* end of helper macros */
836 #define DO_PROFILE_INC(x) \
837 if (do_profile_flag) { \
838 INC_PROFILE_COUNT(x); \
841 #define DO_PROFILE_DEC(x) \
842 if (do_profile_flag) { \
843 DEC_PROFILE_COUNT(x); \
846 #define DO_PROFILE_DEC_INC(x,y) \
847 if (do_profile_flag) { \
848 DEC_PROFILE_COUNT(x); \
849 INC_PROFILE_COUNT(y); \
852 #define DO_PROFILE_ADD(x,n) \
853 if (do_profile_flag) { \
854 ADD_PROFILE_COUNT(x,n); \
857 #define START_PROFILE_RAW(x, _stamp, _count) \
859 if (do_profile_flag) { \
860 _stamp = do_profile_times ? profile_timestamp() : 0;\
861 INC_PROFILE_COUNT(_count); \
864 #define START_PROFILE_STAMP(x, _stamp) \
865 START_PROFILE_RAW(x, _stamp, x##_count)
867 #define START_PROFILE(x) \
868 uint64_t __profstamp_##x = 0; \
869 START_PROFILE_RAW(x, __profstamp_##x, x##_count)
871 #define START_PROFILE_BYTES(x,n) \
872 uint64_t __profstamp_##x = 0; \
873 if (do_profile_flag) { \
874 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
875 INC_PROFILE_COUNT(x##_count); \
876 ADD_PROFILE_COUNT(x##_bytes, n); \
879 #define END_PROFILE_RAW(x, _stamp, _time) \
880 if (do_profile_times) { \
881 ADD_PROFILE_COUNT(_time, \
882 profile_timestamp() - _stamp); \
885 #define END_PROFILE_STAMP(x, _stamp) \
886 END_PROFILE_RAW(x, _stamp, x##_time)
888 #define END_PROFILE(x) \
889 END_PROFILE_RAW(x, __profstamp_##x, x##_time)
891 #define END_PROFILE_BYTES(x) \
892 END_PROFILE_RAW(x, __profstamp_##x, x##_time)
894 #else /* WITH_PROFILE */
896 #define DO_PROFILE_INC(x)
897 #define DO_PROFILE_DEC(x)
898 #define DO_PROFILE_DEC_INC(x,y)
899 #define DO_PROFILE_ADD(x,n)
900 #define START_PROFILE_STAMP(x, _stamp)
901 #define START_PROFILE(x)
902 #define START_PROFILE_BYTES(x,n)
903 #define END_PROFILE_STAMP(x, _stamp)
904 #define END_PROFILE(x)
905 #define END_PROFILE_BYTES(x)
907 #endif /* WITH_PROFILE */
909 /* The following definitions come from profile/profile.c */
911 void set_profile_level(int level
, struct server_id src
);
912 bool profile_setup(struct messaging_context
*msg_ctx
, bool rdonly
);