source: branches/samba-3.2.x/source/include/smbprofile.h@ 198

Last change on this file since 198 was 133, checked in by Paul Smedley, 17 years ago

Update trunk to 3.2.0pre3

File size: 35.7 KB
Line 
1#ifndef _PROFILE_H_
2#define _PROFILE_H_
3/*
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
8
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.
13
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.
18
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/>.
21
22*/
23
24/* this file defines the profile structure in the profile shared
25 memory area */
26
27#define PROF_SHMEM_KEY ((key_t)0x07021999)
28#define PROF_SHM_MAGIC 0x6349985
29#define PROF_SHM_VERSION 11
30
31/* time values in the following structure are in microseconds */
32
33#define __profile_stats_value(which, domain) domain[which]
34
35enum profile_stats_values
36{
37 PR_VALUE_SMBD_IDLE = 0,
38#define smbd_idle_count __profile_stats_value(PR_VALUE_SMBD_IDLE, count)
39#define smbd_idle_time __profile_stats_value(PR_VALUE_SMBD_IDLE, time)
40
41/* system call counters */
42 PR_VALUE_SYSCALL_OPENDIR,
43#define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count)
44#define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
45
46 PR_VALUE_SYSCALL_READDIR,
47#define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
48#define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time)
49
50 PR_VALUE_SYSCALL_SEEKDIR,
51#define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count)
52#define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time)
53
54 PR_VALUE_SYSCALL_TELLDIR,
55#define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count)
56#define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time)
57
58 PR_VALUE_SYSCALL_REWINDDIR,
59#define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count)
60#define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time)
61
62 PR_VALUE_SYSCALL_MKDIR,
63#define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count)
64#define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time)
65
66 PR_VALUE_SYSCALL_RMDIR,
67#define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count)
68#define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time)
69
70 PR_VALUE_SYSCALL_CLOSEDIR,
71#define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count)
72#define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time)
73
74 PR_VALUE_SYSCALL_OPEN,
75#define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
76#define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
77
78 PR_VALUE_SYSCALL_CLOSE,
79#define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
80#define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
81
82 PR_VALUE_SYSCALL_READ,
83#define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count)
84#define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time)
85
86 PR_VALUE_SYSCALL_PREAD,
87#define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count)
88#define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time)
89
90 PR_VALUE_SYSCALL_WRITE,
91#define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count)
92#define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time)
93
94 PR_VALUE_SYSCALL_PWRITE,
95#define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count)
96#define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time)
97
98 PR_VALUE_SYSCALL_LSEEK,
99#define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count)
100#define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time)
101
102 PR_VALUE_SYSCALL_SENDFILE,
103#define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count)
104#define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time)
105
106 PR_VALUE_SYSCALL_RECVFILE,
107#define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count)
108#define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time)
109
110 PR_VALUE_SYSCALL_RENAME,
111#define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
112#define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
113
114 PR_VALUE_SYSCALL_FSYNC,
115#define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
116#define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
117
118 PR_VALUE_SYSCALL_STAT,
119#define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count)
120#define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time)
121
122 PR_VALUE_SYSCALL_FSTAT,
123#define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count)
124#define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time)
125
126 PR_VALUE_SYSCALL_LSTAT,
127#define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count)
128#define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time)
129
130 PR_VALUE_SYSCALL_UNLINK,
131#define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count)
132#define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time)
133
134 PR_VALUE_SYSCALL_CHMOD,
135#define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count)
136#define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time)
137
138 PR_VALUE_SYSCALL_FCHMOD,
139#define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count)
140#define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time)
141
142 PR_VALUE_SYSCALL_CHOWN,
143#define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count)
144#define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time)
145
146 PR_VALUE_SYSCALL_FCHOWN,
147#define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count)
148#define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time)
149
150 PR_VALUE_SYSCALL_LCHOWN,
151#define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count)
152#define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time)
153
154 PR_VALUE_SYSCALL_CHDIR,
155#define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count)
156#define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time)
157
158 PR_VALUE_SYSCALL_GETWD,
159#define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count)
160#define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time)
161
162 PR_VALUE_SYSCALL_NTIMES,
163#define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count)
164#define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time)
165
166 PR_VALUE_SYSCALL_FTRUNCATE,
167#define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count)
168#define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time)
169
170 PR_VALUE_SYSCALL_FCNTL_LOCK,
171#define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count)
172#define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time)
173
174 PR_VALUE_SYSCALL_KERNEL_FLOCK,
175#define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count)
176#define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time)
177
178 PR_VALUE_SYSCALL_LINUX_SETLEASE,
179#define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count)
180#define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time)
181
182 PR_VALUE_SYSCALL_FCNTL_GETLOCK,
183#define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count)
184#define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time)
185
186 PR_VALUE_SYSCALL_READLINK,
187#define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count)
188#define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time)
189
190 PR_VALUE_SYSCALL_SYMLINK,
191#define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count)
192#define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time)
193
194 PR_VALUE_SYSCALL_LINK,
195#define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count)
196#define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time)
197
198 PR_VALUE_SYSCALL_MKNOD,
199#define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count)
200#define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time)
201
202 PR_VALUE_SYSCALL_REALPATH,
203#define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count)
204#define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time)
205
206 PR_VALUE_SYSCALL_GET_QUOTA,
207#define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count)
208#define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time)
209
210 PR_VALUE_SYSCALL_SET_QUOTA,
211#define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
212#define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
213
214/* counters for individual SMB types */
215 PR_VALUE_SMBMKDIR,
216#define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)
217#define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time)
218
219 PR_VALUE_SMBRMDIR,
220#define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count)
221#define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time)
222
223 PR_VALUE_SMBOPEN,
224#define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count)
225#define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time)
226
227 PR_VALUE_SMBCREATE,
228#define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count)
229#define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time)
230
231 PR_VALUE_SMBCLOSE,
232#define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count)
233#define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time)
234
235 PR_VALUE_SMBFLUSH,
236#define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count)
237#define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time)
238
239 PR_VALUE_SMBUNLINK,
240#define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count)
241#define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time)
242
243 PR_VALUE_SMBMV,
244#define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count)
245#define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time)
246
247 PR_VALUE_SMBGETATR,
248#define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count)
249#define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time)
250
251 PR_VALUE_SMBSETATR,
252#define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count)
253#define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time)
254
255 PR_VALUE_SMBREAD,
256#define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count)
257#define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time)
258
259 PR_VALUE_SMBWRITE,
260#define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count)
261#define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time)
262
263 PR_VALUE_SMBLOCK,
264#define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count)
265#define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time)
266
267 PR_VALUE_SMBUNLOCK,
268#define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count)
269#define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time)
270
271 PR_VALUE_SMBCTEMP,
272#define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count)
273#define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time)
274
275 /* SMBmknew stats are currently combined with SMBcreate */
276 PR_VALUE_SMBMKNEW,
277#define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count)
278#define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time)
279
280 PR_VALUE_SMBCHECKPATH,
281#define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count)
282#define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time)
283
284 PR_VALUE_SMBEXIT,
285#define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count)
286#define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time)
287
288 PR_VALUE_SMBLSEEK,
289#define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count)
290#define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time)
291
292 PR_VALUE_SMBLOCKREAD,
293#define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count)
294#define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time)
295
296 PR_VALUE_SMBWRITEUNLOCK,
297#define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count)
298#define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time)
299
300 PR_VALUE_SMBREADBRAW,
301#define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count)
302#define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time)
303
304 PR_VALUE_SMBREADBMPX,
305#define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count)
306#define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time)
307
308 PR_VALUE_SMBREADBS,
309#define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count)
310#define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time)
311
312 PR_VALUE_SMBWRITEBRAW,
313#define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count)
314#define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time)
315
316 PR_VALUE_SMBWRITEBMPX,
317#define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count)
318#define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time)
319
320 PR_VALUE_SMBWRITEBS,
321#define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count)
322#define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time)
323
324 PR_VALUE_SMBWRITEC,
325#define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count)
326#define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time)
327
328 PR_VALUE_SMBSETATTRE,
329#define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count)
330#define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time)
331
332 PR_VALUE_SMBGETATTRE,
333#define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count)
334#define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time)
335
336 PR_VALUE_SMBLOCKINGX,
337#define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count)
338#define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time)
339
340 PR_VALUE_SMBTRANS,
341#define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count)
342#define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time)
343
344 PR_VALUE_SMBTRANSS,
345#define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count)
346#define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time)
347
348 PR_VALUE_SMBIOCTL,
349#define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count)
350#define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time)
351
352 PR_VALUE_SMBIOCTLS,
353#define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count)
354#define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time)
355
356 PR_VALUE_SMBCOPY,
357#define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count)
358#define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time)
359
360 PR_VALUE_SMBMOVE,
361#define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count)
362#define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time)
363
364 PR_VALUE_SMBECHO,
365#define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count)
366#define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time)
367
368 PR_VALUE_SMBWRITECLOSE,
369#define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count)
370#define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time)
371
372 PR_VALUE_SMBOPENX,
373#define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count)
374#define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time)
375
376 PR_VALUE_SMBREADX,
377#define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count)
378#define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time)
379
380 PR_VALUE_SMBWRITEX,
381#define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count)
382#define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time)
383
384 PR_VALUE_SMBTRANS2,
385#define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count)
386#define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time)
387
388 PR_VALUE_SMBTRANSS2,
389#define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count)
390#define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time)
391
392 PR_VALUE_SMBFINDCLOSE,
393#define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count)
394#define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time)
395
396 PR_VALUE_SMBFINDNCLOSE,
397#define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count)
398#define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time)
399
400 PR_VALUE_SMBTCON,
401#define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count)
402#define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time)
403
404 PR_VALUE_SMBTDIS,
405#define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count)
406#define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time)
407
408 PR_VALUE_SMBNEGPROT,
409#define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count)
410#define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time)
411
412 PR_VALUE_SMBSESSSETUPX,
413#define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count)
414#define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time)
415
416 PR_VALUE_SMBULOGOFFX,
417#define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count)
418#define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time)
419
420 PR_VALUE_SMBTCONX,
421#define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count)
422#define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time)
423
424 PR_VALUE_SMBDSKATTR,
425#define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count)
426#define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time)
427
428 PR_VALUE_SMBSEARCH,
429#define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count)
430#define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time)
431
432 /* SBMffirst stats combined with SMBsearch */
433 PR_VALUE_SMBFFIRST,
434#define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count)
435#define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time)
436
437 /* SBMfunique stats combined with SMBsearch */
438 PR_VALUE_SMBFUNIQUE,
439#define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count)
440#define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time)
441
442 PR_VALUE_SMBFCLOSE,
443#define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count)
444#define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time)
445
446 PR_VALUE_SMBNTTRANS,
447#define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count)
448#define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time)
449
450 PR_VALUE_SMBNTTRANSS,
451#define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count)
452#define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time)
453
454 PR_VALUE_SMBNTCREATEX,
455#define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count)
456#define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time)
457
458 PR_VALUE_SMBNTCANCEL,
459#define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count)
460#define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time)
461
462 PR_VALUE_SMBNTRENAME,
463#define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count)
464#define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time)
465
466 PR_VALUE_SMBSPLOPEN,
467#define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count)
468#define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time)
469
470 PR_VALUE_SMBSPLWR,
471#define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count)
472#define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time)
473
474 PR_VALUE_SMBSPLCLOSE,
475#define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count)
476#define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time)
477
478 PR_VALUE_SMBSPLRETQ,
479#define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count)
480#define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time)
481
482 PR_VALUE_SMBSENDS,
483#define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count)
484#define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time)
485
486 PR_VALUE_SMBSENDB,
487#define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count)
488#define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time)
489
490 PR_VALUE_SMBFWDNAME,
491#define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count)
492#define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time)
493
494 PR_VALUE_SMBCANCELF,
495#define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count)
496#define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time)
497
498 PR_VALUE_SMBGETMAC,
499#define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count)
500#define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time)
501
502 PR_VALUE_SMBSENDSTRT,
503#define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count)
504#define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time)
505
506 PR_VALUE_SMBSENDEND,
507#define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count)
508#define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time)
509
510 PR_VALUE_SMBSENDTXT,
511#define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count)
512#define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time)
513
514 PR_VALUE_SMBINVALID,
515#define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count)
516#define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time)
517
518/* Pathworks setdir command */
519 PR_VALUE_PATHWORKS_SETDIR,
520#define pathworks_setdir_count __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, count)
521#define pathworks_setdir_time __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, time)
522
523/* These are the TRANS2 sub commands */
524 PR_VALUE_TRANS2_OPEN,
525#define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count)
526#define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time)
527
528 PR_VALUE_TRANS2_FINDFIRST,
529#define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count)
530#define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time)
531
532 PR_VALUE_TRANS2_FINDNEXT,
533#define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count)
534#define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time)
535
536 PR_VALUE_TRANS2_QFSINFO,
537#define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count)
538#define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time)
539
540 PR_VALUE_TRANS2_SETFSINFO,
541#define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count)
542#define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time)
543
544 PR_VALUE_TRANS2_QPATHINFO,
545#define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count)
546#define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time)
547
548 PR_VALUE_TRANS2_SETPATHINFO,
549#define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count)
550#define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time)
551
552 PR_VALUE_TRANS2_QFILEINFO,
553#define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count)
554#define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time)
555
556 PR_VALUE_TRANS2_SETFILEINFO,
557#define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count)
558#define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time)
559
560 PR_VALUE_TRANS2_FSCTL,
561#define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count)
562#define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time)
563
564 PR_VALUE_TRANS2_IOCTL,
565#define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count)
566#define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time)
567
568 PR_VALUE_TRANS2_FINDNOTIFYFIRST,
569#define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count)
570#define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time)
571
572 PR_VALUE_TRANS2_FINDNOTIFYNEXT,
573#define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count)
574#define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time)
575
576 PR_VALUE_TRANS2_MKDIR,
577#define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count)
578#define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time)
579
580 PR_VALUE_TRANS2_SESSION_SETUP,
581#define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count)
582#define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time)
583
584 PR_VALUE_TRANS2_GET_DFS_REFERRAL,
585#define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count)
586#define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time)
587
588 PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY,
589#define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count)
590#define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time)
591
592/* These are the NT transact sub commands. */
593 PR_VALUE_NT_TRANSACT_CREATE,
594#define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count)
595#define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time)
596
597 PR_VALUE_NT_TRANSACT_IOCTL,
598#define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count)
599#define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time)
600
601 PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC,
602#define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count)
603#define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time)
604
605 PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE,
606#define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count)
607#define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time)
608
609 PR_VALUE_NT_TRANSACT_RENAME,
610#define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count)
611#define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time)
612
613 PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC,
614#define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count)
615#define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time)
616
617 PR_VALUE_NT_TRANSACT_GET_USER_QUOTA,
618#define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count)
619#define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time)
620
621 PR_VALUE_NT_TRANSACT_SET_USER_QUOTA,
622#define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count)
623#define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time)
624
625/* These are ACL manipulation calls */
626 PR_VALUE_GET_NT_ACL,
627#define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count)
628#define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time)
629
630 PR_VALUE_FGET_NT_ACL,
631#define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count)
632#define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time)
633
634 PR_VALUE_SET_NT_ACL,
635#define set_nt_acl_count __profile_stats_value(PR_VALUE_SET_NT_ACL, count)
636#define set_nt_acl_time __profile_stats_value(PR_VALUE_SET_NT_ACL, time)
637
638 PR_VALUE_FSET_NT_ACL,
639#define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count)
640#define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time)
641
642 PR_VALUE_CHMOD_ACL,
643#define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count)
644#define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time)
645
646 PR_VALUE_FCHMOD_ACL,
647#define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count)
648#define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time)
649
650/* These are nmbd stats */
651 PR_VALUE_NAME_RELEASE,
652#define name_release_count __profile_stats_value(PR_VALUE_NAME_RELEASE, count)
653#define name_release_time __profile_stats_value(PR_VALUE_NAME_RELEASE, time)
654
655 PR_VALUE_NAME_REFRESH,
656#define name_refresh_count __profile_stats_value(PR_VALUE_NAME_REFRESH, count)
657#define name_refresh_time __profile_stats_value(PR_VALUE_NAME_REFRESH, time)
658
659 PR_VALUE_NAME_REGISTRATION,
660#define name_registration_count __profile_stats_value(PR_VALUE_NAME_REGISTRATION, count)
661#define name_registration_time __profile_stats_value(PR_VALUE_NAME_REGISTRATION, time)
662
663 PR_VALUE_NODE_STATUS,
664#define node_status_count __profile_stats_value(PR_VALUE_NODE_STATUS, count)
665#define node_status_time __profile_stats_value(PR_VALUE_NODE_STATUS, time)
666
667 PR_VALUE_NAME_QUERY,
668#define name_query_count __profile_stats_value(PR_VALUE_NAME_QUERY, count)
669#define name_query_time __profile_stats_value(PR_VALUE_NAME_QUERY, time)
670
671 PR_VALUE_HOST_ANNOUNCE,
672#define host_announce_count __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, count)
673#define host_announce_time __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, time)
674
675 PR_VALUE_WORKGROUP_ANNOUNCE,
676#define workgroup_announce_count __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, count)
677#define workgroup_announce_time __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, time)
678
679 PR_VALUE_LOCAL_MASTER_ANNOUNCE,
680#define local_master_announce_count __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, count)
681#define local_master_announce_time __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, time)
682
683 PR_VALUE_MASTER_BROWSER_ANNOUNCE,
684#define master_browser_announce_count __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, count)
685#define master_browser_announce_time __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, time)
686
687 PR_VALUE_LM_HOST_ANNOUNCE,
688#define lm_host_announce_count __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, count)
689#define lm_host_announce_time __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, time)
690
691 PR_VALUE_GET_BACKUP_LIST,
692#define get_backup_list_count __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, count)
693#define get_backup_list_time __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, time)
694
695 PR_VALUE_RESET_BROWSER,
696#define reset_browser_count __profile_stats_value(PR_VALUE_RESET_BROWSER, count)
697#define reset_browser_time __profile_stats_value(PR_VALUE_RESET_BROWSER, time)
698
699 PR_VALUE_ANNOUNCE_REQUEST,
700#define announce_request_count __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, count)
701#define announce_request_time __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, time)
702
703 PR_VALUE_LM_ANNOUNCE_REQUEST,
704#define lm_announce_request_count __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, count)
705#define lm_announce_request_time __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, time)
706
707 PR_VALUE_DOMAIN_LOGON,
708#define domain_logon_count __profile_stats_value(PR_VALUE_DOMAIN_LOGON, count)
709#define domain_logon_time __profile_stats_value(PR_VALUE_DOMAIN_LOGON, time)
710
711 PR_VALUE_SYNC_BROWSE_LISTS,
712#define sync_browse_lists_count __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, count)
713#define sync_browse_lists_time __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, time)
714
715 PR_VALUE_RUN_ELECTIONS,
716#define run_elections_count __profile_stats_value(PR_VALUE_RUN_ELECTIONS, count)
717#define run_elections_time __profile_stats_value(PR_VALUE_RUN_ELECTIONS, time)
718
719 PR_VALUE_ELECTION,
720#define election_count __profile_stats_value(PR_VALUE_ELECTION, count)
721#define election_time __profile_stats_value(PR_VALUE_ELECTION, time)
722
723 /* This mist remain the last value. */
724 PR_VALUE_MAX
725}; /* enum profile_stats_values */
726
727const char * profile_value_name(enum profile_stats_values val);
728
729struct profile_stats {
730/* general counters */
731 unsigned smb_count; /* how many SMB packets we have processed */
732 unsigned uid_changes; /* how many times we change our effective uid */
733
734/* system call and protocol operation counters and cumulative times */
735 unsigned count[PR_VALUE_MAX];
736 unsigned time[PR_VALUE_MAX];
737
738/* cumulative byte counts */
739 unsigned syscall_pread_bytes;
740 unsigned syscall_pwrite_bytes;
741 unsigned syscall_read_bytes;
742 unsigned syscall_write_bytes;
743 unsigned syscall_sendfile_bytes;
744 unsigned syscall_recvfile_bytes;
745
746/* stat cache counters */
747 unsigned statcache_lookups;
748 unsigned statcache_misses;
749 unsigned statcache_hits;
750
751/* write cache counters */
752 unsigned writecache_read_hits;
753 unsigned writecache_abutted_writes;
754 unsigned writecache_total_writes;
755 unsigned writecache_non_oplock_writes;
756 unsigned writecache_direct_writes;
757 unsigned writecache_init_writes;
758 unsigned writecache_flushed_writes[NUM_FLUSH_REASONS];
759 unsigned writecache_num_perfect_writes;
760 unsigned writecache_num_write_caches;
761 unsigned writecache_allocated_write_caches;
762};
763
764struct profile_header {
765 int prof_shm_magic;
766 int prof_shm_version;
767 struct profile_stats stats;
768};
769
770extern struct profile_header *profile_h;
771extern struct profile_stats *profile_p;
772extern bool do_profile_flag;
773extern bool do_profile_times;
774
775#ifdef WITH_PROFILE
776
777/* these are helper macros - do not call them directly in the code
778 * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones
779 * below which test for the profile flage first
780 */
781#define INC_PROFILE_COUNT(x) profile_p->x++
782#define DEC_PROFILE_COUNT(x) profile_p->x--
783#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
784
785#if defined(HAVE_CLOCK_GETTIME)
786
787extern clockid_t __profile_clock;
788
789static inline SMB_BIG_UINT profile_timestamp(void)
790{
791 struct timespec ts;
792
793 /* FIXME: On a single-CPU system, or a system where we have bound
794 * daemon threads to single CPUs (eg. using cpusets or processor
795 * affinity), it might be preferable to use CLOCK_PROCESS_CPUTIME_ID.
796 */
797
798 clock_gettime(__profile_clock, &ts);
799 return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
800}
801
802#else
803
804static inline SMB_BIG_UINT profile_timestamp(void)
805{
806 struct timeval tv;
807 GetTimeOfDay(&tv);
808 return (tv.tv_sec * 1000000) + tv.tv_usec;
809}
810
811#endif
812
813/* end of helper macros */
814
815#define DO_PROFILE_INC(x) \
816 if (do_profile_flag) { \
817 INC_PROFILE_COUNT(x); \
818 }
819
820#define DO_PROFILE_DEC(x) \
821 if (do_profile_flag) { \
822 DEC_PROFILE_COUNT(x); \
823 }
824
825#define DO_PROFILE_DEC_INC(x,y) \
826 if (do_profile_flag) { \
827 DEC_PROFILE_COUNT(x); \
828 INC_PROFILE_COUNT(y); \
829 }
830
831#define DO_PROFILE_ADD(x,n) \
832 if (do_profile_flag) { \
833 ADD_PROFILE_COUNT(x,n); \
834 }
835
836#define START_PROFILE(x) \
837 SMB_BIG_UINT __profstamp_##x = 0; \
838 if (do_profile_flag) { \
839 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
840 INC_PROFILE_COUNT(x##_count); \
841 }
842
843#define START_PROFILE_BYTES(x,n) \
844 SMB_BIG_UINT __profstamp_##x = 0; \
845 if (do_profile_flag) { \
846 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
847 INC_PROFILE_COUNT(x##_count); \
848 ADD_PROFILE_COUNT(x##_bytes, n); \
849 }
850
851#define END_PROFILE(x) \
852 if (do_profile_times) { \
853 ADD_PROFILE_COUNT(x##_time, \
854 profile_timestamp() - __profstamp_##x); \
855 }
856
857
858#else /* WITH_PROFILE */
859
860#define DO_PROFILE_INC(x)
861#define DO_PROFILE_DEC(x)
862#define DO_PROFILE_DEC_INC(x,y)
863#define DO_PROFILE_ADD(x,n)
864#define START_PROFILE(x)
865#define START_PROFILE_BYTES(x,n)
866#define END_PROFILE(x)
867
868#endif /* WITH_PROFILE */
869
870#endif
Note: See TracBrowser for help on using the repository browser.