Changeset 988 for vendor/current/source3/include/smbprofile.h
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/include/smbprofile.h
r740 r988 1 1 #ifndef _PROFILE_H_ 2 2 #define _PROFILE_H_ 3 /* 3 /* 4 4 Unix SMB/CIFS implementation. 5 5 store smbd profiling information in shared memory … … 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 22 22 */ 23 23 24 struct tevent_context; 25 26 #ifdef WITH_PROFILE 27 28 #define SMBPROFILE_STATS_ALL_SECTIONS \ 29 SMBPROFILE_STATS_START \ 30 \ 31 SMBPROFILE_STATS_SECTION_START(global, "SMBD loop") \ 32 SMBPROFILE_STATS_COUNT(connect) \ 33 SMBPROFILE_STATS_COUNT(disconnect) \ 34 SMBPROFILE_STATS_BASIC(idle) \ 35 SMBPROFILE_STATS_TIME(cpu_user) \ 36 SMBPROFILE_STATS_TIME(cpu_system) \ 37 SMBPROFILE_STATS_COUNT(request) \ 38 SMBPROFILE_STATS_BASIC(push_sec_ctx) \ 39 SMBPROFILE_STATS_BASIC(set_sec_ctx) \ 40 SMBPROFILE_STATS_BASIC(set_root_sec_ctx) \ 41 SMBPROFILE_STATS_BASIC(pop_sec_ctx) \ 42 SMBPROFILE_STATS_SECTION_END \ 43 \ 44 SMBPROFILE_STATS_SECTION_START(syscall, "System Calls") \ 45 SMBPROFILE_STATS_BASIC(syscall_opendir) \ 46 SMBPROFILE_STATS_BASIC(syscall_fdopendir) \ 47 SMBPROFILE_STATS_BASIC(syscall_readdir) \ 48 SMBPROFILE_STATS_BASIC(syscall_seekdir) \ 49 SMBPROFILE_STATS_BASIC(syscall_telldir) \ 50 SMBPROFILE_STATS_BASIC(syscall_rewinddir) \ 51 SMBPROFILE_STATS_BASIC(syscall_mkdir) \ 52 SMBPROFILE_STATS_BASIC(syscall_rmdir) \ 53 SMBPROFILE_STATS_BASIC(syscall_closedir) \ 54 SMBPROFILE_STATS_BASIC(syscall_open) \ 55 SMBPROFILE_STATS_BASIC(syscall_createfile) \ 56 SMBPROFILE_STATS_BASIC(syscall_close) \ 57 SMBPROFILE_STATS_BYTES(syscall_read) \ 58 SMBPROFILE_STATS_BYTES(syscall_pread) \ 59 SMBPROFILE_STATS_BYTES(syscall_asys_pread) \ 60 SMBPROFILE_STATS_BYTES(syscall_write) \ 61 SMBPROFILE_STATS_BYTES(syscall_pwrite) \ 62 SMBPROFILE_STATS_BYTES(syscall_asys_pwrite) \ 63 SMBPROFILE_STATS_BASIC(syscall_lseek) \ 64 SMBPROFILE_STATS_BYTES(syscall_sendfile) \ 65 SMBPROFILE_STATS_BYTES(syscall_recvfile) \ 66 SMBPROFILE_STATS_BASIC(syscall_rename) \ 67 SMBPROFILE_STATS_BASIC(syscall_rename_at) \ 68 SMBPROFILE_STATS_BASIC(syscall_fsync) \ 69 SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \ 70 SMBPROFILE_STATS_BASIC(syscall_stat) \ 71 SMBPROFILE_STATS_BASIC(syscall_fstat) \ 72 SMBPROFILE_STATS_BASIC(syscall_lstat) \ 73 SMBPROFILE_STATS_BASIC(syscall_get_alloc_size) \ 74 SMBPROFILE_STATS_BASIC(syscall_unlink) \ 75 SMBPROFILE_STATS_BASIC(syscall_chmod) \ 76 SMBPROFILE_STATS_BASIC(syscall_fchmod) \ 77 SMBPROFILE_STATS_BASIC(syscall_chown) \ 78 SMBPROFILE_STATS_BASIC(syscall_fchown) \ 79 SMBPROFILE_STATS_BASIC(syscall_lchown) \ 80 SMBPROFILE_STATS_BASIC(syscall_chdir) \ 81 SMBPROFILE_STATS_BASIC(syscall_getwd) \ 82 SMBPROFILE_STATS_BASIC(syscall_ntimes) \ 83 SMBPROFILE_STATS_BASIC(syscall_ftruncate) \ 84 SMBPROFILE_STATS_BASIC(syscall_fallocate) \ 85 SMBPROFILE_STATS_BASIC(syscall_fcntl_lock) \ 86 SMBPROFILE_STATS_BASIC(syscall_kernel_flock) \ 87 SMBPROFILE_STATS_BASIC(syscall_linux_setlease) \ 88 SMBPROFILE_STATS_BASIC(syscall_fcntl_getlock) \ 89 SMBPROFILE_STATS_BASIC(syscall_readlink) \ 90 SMBPROFILE_STATS_BASIC(syscall_symlink) \ 91 SMBPROFILE_STATS_BASIC(syscall_link) \ 92 SMBPROFILE_STATS_BASIC(syscall_mknod) \ 93 SMBPROFILE_STATS_BASIC(syscall_realpath) \ 94 SMBPROFILE_STATS_BASIC(syscall_get_quota) \ 95 SMBPROFILE_STATS_BASIC(syscall_set_quota) \ 96 SMBPROFILE_STATS_BASIC(syscall_get_sd) \ 97 SMBPROFILE_STATS_BASIC(syscall_set_sd) \ 98 SMBPROFILE_STATS_BASIC(syscall_brl_lock) \ 99 SMBPROFILE_STATS_BASIC(syscall_brl_unlock) \ 100 SMBPROFILE_STATS_BASIC(syscall_brl_cancel) \ 101 SMBPROFILE_STATS_SECTION_END \ 102 \ 103 SMBPROFILE_STATS_SECTION_START(acl, "ACL Calls") \ 104 SMBPROFILE_STATS_BASIC(get_nt_acl) \ 105 SMBPROFILE_STATS_BASIC(fget_nt_acl) \ 106 SMBPROFILE_STATS_BASIC(fset_nt_acl) \ 107 SMBPROFILE_STATS_BASIC(chmod_acl) \ 108 SMBPROFILE_STATS_BASIC(fchmod_acl) \ 109 SMBPROFILE_STATS_SECTION_END \ 110 \ 111 SMBPROFILE_STATS_SECTION_START(statcache, "Stat Cache") \ 112 SMBPROFILE_STATS_COUNT(statcache_lookups) \ 113 SMBPROFILE_STATS_COUNT(statcache_misses) \ 114 SMBPROFILE_STATS_COUNT(statcache_hits) \ 115 SMBPROFILE_STATS_SECTION_END \ 116 \ 117 SMBPROFILE_STATS_SECTION_START(writecache, "Write Cache") \ 118 SMBPROFILE_STATS_COUNT(writecache_allocations) \ 119 SMBPROFILE_STATS_COUNT(writecache_deallocations) \ 120 SMBPROFILE_STATS_COUNT(writecache_cached_reads) \ 121 SMBPROFILE_STATS_COUNT(writecache_total_writes) \ 122 SMBPROFILE_STATS_COUNT(writecache_init_writes) \ 123 SMBPROFILE_STATS_COUNT(writecache_abutted_writes) \ 124 SMBPROFILE_STATS_COUNT(writecache_non_oplock_writes) \ 125 SMBPROFILE_STATS_COUNT(writecache_direct_writes) \ 126 SMBPROFILE_STATS_COUNT(writecache_cached_writes) \ 127 SMBPROFILE_STATS_COUNT(writecache_perfect_writes) \ 128 SMBPROFILE_STATS_COUNT(writecache_flush_reason_seek) \ 129 SMBPROFILE_STATS_COUNT(writecache_flush_reason_read) \ 130 SMBPROFILE_STATS_COUNT(writecache_flush_reason_readraw) \ 131 SMBPROFILE_STATS_COUNT(writecache_flush_reason_write) \ 132 SMBPROFILE_STATS_COUNT(writecache_flush_reason_oplock) \ 133 SMBPROFILE_STATS_COUNT(writecache_flush_reason_close) \ 134 SMBPROFILE_STATS_COUNT(writecache_flush_reason_sync) \ 135 SMBPROFILE_STATS_COUNT(writecache_flush_reason_sizechange) \ 136 SMBPROFILE_STATS_SECTION_END \ 137 \ 138 SMBPROFILE_STATS_SECTION_START(SMB, "SMB Calls") \ 139 SMBPROFILE_STATS_BASIC(SMBmkdir) \ 140 SMBPROFILE_STATS_BASIC(SMBrmdir) \ 141 SMBPROFILE_STATS_BASIC(SMBopen) \ 142 SMBPROFILE_STATS_BASIC(SMBcreate) \ 143 SMBPROFILE_STATS_BASIC(SMBclose) \ 144 SMBPROFILE_STATS_BASIC(SMBflush) \ 145 SMBPROFILE_STATS_BASIC(SMBunlink) \ 146 SMBPROFILE_STATS_BASIC(SMBmv) \ 147 SMBPROFILE_STATS_BASIC(SMBgetatr) \ 148 SMBPROFILE_STATS_BASIC(SMBsetatr) \ 149 SMBPROFILE_STATS_BASIC(SMBread) \ 150 SMBPROFILE_STATS_BASIC(SMBwrite) \ 151 SMBPROFILE_STATS_BASIC(SMBlock) \ 152 SMBPROFILE_STATS_BASIC(SMBunlock) \ 153 SMBPROFILE_STATS_BASIC(SMBctemp) \ 154 SMBPROFILE_STATS_BASIC(SMBmknew) \ 155 SMBPROFILE_STATS_BASIC(SMBcheckpath) \ 156 SMBPROFILE_STATS_BASIC(SMBexit) \ 157 SMBPROFILE_STATS_BASIC(SMBlseek) \ 158 SMBPROFILE_STATS_BASIC(SMBlockread) \ 159 SMBPROFILE_STATS_BASIC(SMBwriteunlock) \ 160 SMBPROFILE_STATS_BASIC(SMBreadbraw) \ 161 SMBPROFILE_STATS_BASIC(SMBreadBmpx) \ 162 SMBPROFILE_STATS_BASIC(SMBreadBs) \ 163 SMBPROFILE_STATS_BASIC(SMBwritebraw) \ 164 SMBPROFILE_STATS_BASIC(SMBwriteBmpx) \ 165 SMBPROFILE_STATS_BASIC(SMBwriteBs) \ 166 SMBPROFILE_STATS_BASIC(SMBwritec) \ 167 SMBPROFILE_STATS_BASIC(SMBsetattrE) \ 168 SMBPROFILE_STATS_BASIC(SMBgetattrE) \ 169 SMBPROFILE_STATS_BASIC(SMBlockingX) \ 170 SMBPROFILE_STATS_BASIC(SMBtrans) \ 171 SMBPROFILE_STATS_BASIC(SMBtranss) \ 172 SMBPROFILE_STATS_BASIC(SMBioctl) \ 173 SMBPROFILE_STATS_BASIC(SMBioctls) \ 174 SMBPROFILE_STATS_BASIC(SMBcopy) \ 175 SMBPROFILE_STATS_BASIC(SMBmove) \ 176 SMBPROFILE_STATS_BASIC(SMBecho) \ 177 SMBPROFILE_STATS_BASIC(SMBwriteclose) \ 178 SMBPROFILE_STATS_BASIC(SMBopenX) \ 179 SMBPROFILE_STATS_BASIC(SMBreadX) \ 180 SMBPROFILE_STATS_BASIC(SMBwriteX) \ 181 SMBPROFILE_STATS_BASIC(SMBtrans2) \ 182 SMBPROFILE_STATS_BASIC(SMBtranss2) \ 183 SMBPROFILE_STATS_BASIC(SMBfindclose) \ 184 SMBPROFILE_STATS_BASIC(SMBfindnclose) \ 185 SMBPROFILE_STATS_BASIC(SMBtcon) \ 186 SMBPROFILE_STATS_BASIC(SMBtdis) \ 187 SMBPROFILE_STATS_BASIC(SMBnegprot) \ 188 SMBPROFILE_STATS_BASIC(SMBsesssetupX) \ 189 SMBPROFILE_STATS_BASIC(SMBulogoffX) \ 190 SMBPROFILE_STATS_BASIC(SMBtconX) \ 191 SMBPROFILE_STATS_BASIC(SMBdskattr) \ 192 SMBPROFILE_STATS_BASIC(SMBsearch) \ 193 SMBPROFILE_STATS_BASIC(SMBffirst) \ 194 SMBPROFILE_STATS_BASIC(SMBfunique) \ 195 SMBPROFILE_STATS_BASIC(SMBfclose) \ 196 SMBPROFILE_STATS_BASIC(SMBnttrans) \ 197 SMBPROFILE_STATS_BASIC(SMBnttranss) \ 198 SMBPROFILE_STATS_BASIC(SMBntcreateX) \ 199 SMBPROFILE_STATS_BASIC(SMBntcancel) \ 200 SMBPROFILE_STATS_BASIC(SMBntrename) \ 201 SMBPROFILE_STATS_BASIC(SMBsplopen) \ 202 SMBPROFILE_STATS_BASIC(SMBsplwr) \ 203 SMBPROFILE_STATS_BASIC(SMBsplclose) \ 204 SMBPROFILE_STATS_BASIC(SMBsplretq) \ 205 SMBPROFILE_STATS_BASIC(SMBsends) \ 206 SMBPROFILE_STATS_BASIC(SMBsendb) \ 207 SMBPROFILE_STATS_BASIC(SMBfwdname) \ 208 SMBPROFILE_STATS_BASIC(SMBcancelf) \ 209 SMBPROFILE_STATS_BASIC(SMBgetmac) \ 210 SMBPROFILE_STATS_BASIC(SMBsendstrt) \ 211 SMBPROFILE_STATS_BASIC(SMBsendend) \ 212 SMBPROFILE_STATS_BASIC(SMBsendtxt) \ 213 SMBPROFILE_STATS_BASIC(SMBinvalid) \ 214 SMBPROFILE_STATS_SECTION_END \ 215 \ 216 SMBPROFILE_STATS_SECTION_START(Trans2, "Trans2 Calls") \ 217 SMBPROFILE_STATS_BASIC(Trans2_open) \ 218 SMBPROFILE_STATS_BASIC(Trans2_findfirst) \ 219 SMBPROFILE_STATS_BASIC(Trans2_findnext) \ 220 SMBPROFILE_STATS_BASIC(Trans2_qfsinfo) \ 221 SMBPROFILE_STATS_BASIC(Trans2_setfsinfo) \ 222 SMBPROFILE_STATS_BASIC(Trans2_qpathinfo) \ 223 SMBPROFILE_STATS_BASIC(Trans2_setpathinfo) \ 224 SMBPROFILE_STATS_BASIC(Trans2_qfileinfo) \ 225 SMBPROFILE_STATS_BASIC(Trans2_setfileinfo) \ 226 SMBPROFILE_STATS_BASIC(Trans2_fsctl) \ 227 SMBPROFILE_STATS_BASIC(Trans2_ioctl) \ 228 SMBPROFILE_STATS_BASIC(Trans2_findnotifyfirst) \ 229 SMBPROFILE_STATS_BASIC(Trans2_findnotifynext) \ 230 SMBPROFILE_STATS_BASIC(Trans2_mkdir) \ 231 SMBPROFILE_STATS_BASIC(Trans2_session_setup) \ 232 SMBPROFILE_STATS_BASIC(Trans2_get_dfs_referral) \ 233 SMBPROFILE_STATS_BASIC(Trans2_report_dfs_inconsistancy) \ 234 SMBPROFILE_STATS_SECTION_END \ 235 \ 236 SMBPROFILE_STATS_SECTION_START(NT_transact, "NT Transact Calls") \ 237 SMBPROFILE_STATS_BASIC(NT_transact_create) \ 238 SMBPROFILE_STATS_BASIC(NT_transact_ioctl) \ 239 SMBPROFILE_STATS_BASIC(NT_transact_set_security_desc) \ 240 SMBPROFILE_STATS_BASIC(NT_transact_notify_change) \ 241 SMBPROFILE_STATS_BASIC(NT_transact_rename) \ 242 SMBPROFILE_STATS_BASIC(NT_transact_query_security_desc) \ 243 SMBPROFILE_STATS_BASIC(NT_transact_get_user_quota) \ 244 SMBPROFILE_STATS_BASIC(NT_transact_set_user_quota) \ 245 SMBPROFILE_STATS_SECTION_END \ 246 \ 247 SMBPROFILE_STATS_SECTION_START(smb2, "SMB2 Calls") \ 248 SMBPROFILE_STATS_IOBYTES(smb2_negprot) \ 249 SMBPROFILE_STATS_IOBYTES(smb2_sesssetup) \ 250 SMBPROFILE_STATS_IOBYTES(smb2_logoff) \ 251 SMBPROFILE_STATS_IOBYTES(smb2_tcon) \ 252 SMBPROFILE_STATS_IOBYTES(smb2_tdis) \ 253 SMBPROFILE_STATS_IOBYTES(smb2_create) \ 254 SMBPROFILE_STATS_IOBYTES(smb2_close) \ 255 SMBPROFILE_STATS_IOBYTES(smb2_flush) \ 256 SMBPROFILE_STATS_IOBYTES(smb2_read) \ 257 SMBPROFILE_STATS_IOBYTES(smb2_write) \ 258 SMBPROFILE_STATS_IOBYTES(smb2_lock) \ 259 SMBPROFILE_STATS_IOBYTES(smb2_ioctl) \ 260 SMBPROFILE_STATS_IOBYTES(smb2_cancel) \ 261 SMBPROFILE_STATS_IOBYTES(smb2_keepalive) \ 262 SMBPROFILE_STATS_IOBYTES(smb2_find) \ 263 SMBPROFILE_STATS_IOBYTES(smb2_notify) \ 264 SMBPROFILE_STATS_IOBYTES(smb2_getinfo) \ 265 SMBPROFILE_STATS_IOBYTES(smb2_setinfo) \ 266 SMBPROFILE_STATS_IOBYTES(smb2_break) \ 267 SMBPROFILE_STATS_SECTION_END \ 268 \ 269 SMBPROFILE_STATS_END 270 24 271 /* this file defines the profile structure in the profile shared 25 272 memory area */ 26 273 27 #define PROF_SHMEM_KEY ((key_t)0x07021999)28 #define PROF_SHM_MAGIC 0x634998529 #define PROF_SHM_VERSION 1230 31 274 /* time values in the following structure are in microseconds */ 32 275 33 #define __profile_stats_value(which, domain) domain[which] 34 35 enum profile_stats_values 276 struct smbprofile_stats_count { 277 uint64_t count; /* number of events */ 278 }; 279 280 struct smbprofile_stats_time { 281 uint64_t time; /* microseconds */ 282 }; 283 284 struct smbprofile_stats_time_async { 285 uint64_t start; 286 struct smbprofile_stats_time *stats; 287 }; 288 289 struct smbprofile_stats_basic { 290 uint64_t count; /* number of events */ 291 uint64_t time; /* microseconds */ 292 }; 293 294 struct smbprofile_stats_basic_async { 295 uint64_t start; 296 struct smbprofile_stats_basic *stats; 297 }; 298 299 struct smbprofile_stats_bytes { 300 uint64_t count; /* number of events */ 301 uint64_t time; /* microseconds */ 302 uint64_t idle; /* idle time compared to 'time' microseconds */ 303 uint64_t bytes; /* bytes */ 304 }; 305 306 struct smbprofile_stats_bytes_async { 307 uint64_t start; 308 uint64_t idle_start; 309 uint64_t idle_time; 310 struct smbprofile_stats_bytes *stats; 311 }; 312 313 struct smbprofile_stats_iobytes { 314 uint64_t count; /* number of events */ 315 uint64_t time; /* microseconds */ 316 uint64_t idle; /* idle time compared to 'time' microseconds */ 317 uint64_t inbytes; /* bytes read */ 318 uint64_t outbytes; /* bytes written */ 319 }; 320 321 struct smbprofile_stats_iobytes_async { 322 uint64_t start; 323 uint64_t idle_start; 324 uint64_t idle_time; 325 struct smbprofile_stats_iobytes *stats; 326 }; 327 328 struct profile_stats { 329 uint64_t magic; 330 struct { 331 #define SMBPROFILE_STATS_START 332 #define SMBPROFILE_STATS_SECTION_START(name, display) 333 #define SMBPROFILE_STATS_COUNT(name) \ 334 struct smbprofile_stats_count name##_stats; 335 #define SMBPROFILE_STATS_TIME(name) \ 336 struct smbprofile_stats_time name##_stats; 337 #define SMBPROFILE_STATS_BASIC(name) \ 338 struct smbprofile_stats_basic name##_stats; 339 #define SMBPROFILE_STATS_BYTES(name) \ 340 struct smbprofile_stats_bytes name##_stats; 341 #define SMBPROFILE_STATS_IOBYTES(name) \ 342 struct smbprofile_stats_iobytes name##_stats; 343 #define SMBPROFILE_STATS_SECTION_END 344 #define SMBPROFILE_STATS_END 345 SMBPROFILE_STATS_ALL_SECTIONS 346 #undef SMBPROFILE_STATS_START 347 #undef SMBPROFILE_STATS_SECTION_START 348 #undef SMBPROFILE_STATS_COUNT 349 #undef SMBPROFILE_STATS_TIME 350 #undef SMBPROFILE_STATS_BASIC 351 #undef SMBPROFILE_STATS_BYTES 352 #undef SMBPROFILE_STATS_IOBYTES 353 #undef SMBPROFILE_STATS_SECTION_END 354 #undef SMBPROFILE_STATS_END 355 } values; 356 }; 357 358 #define _SMBPROFILE_COUNT_INCREMENT(_stats, _area, _v) do { \ 359 if (smbprofile_state.config.do_count) { \ 360 (_area)->values._stats.count += (_v); \ 361 smbprofile_dump_schedule(); \ 362 } \ 363 } while(0) 364 #define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v) \ 365 _SMBPROFILE_COUNT_INCREMENT(_name##_stats, _area, _v) 366 367 #define SMBPROFILE_TIME_ASYNC_STATE(_async_name) \ 368 struct smbprofile_stats_time_async _async_name; 369 #define _SMBPROFILE_TIME_ASYNC_START(_stats, _area, _async) do { \ 370 (_async) = (struct smbprofile_stats_time_async) {}; \ 371 if (smbprofile_state.config.do_times) { \ 372 (_async).stats = &((_area)->values._stats), \ 373 (_async).start = profile_timestamp(); \ 374 } \ 375 } while(0) 376 #define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async) \ 377 _SMBPROFILE_TIME_ASYNC_START(_name##_stats, _area, _async) 378 #define SMBPROFILE_TIME_ASYNC_END(_async) do { \ 379 if ((_async).start != 0) { \ 380 (_async).stats->time += profile_timestamp() - (_async).start; \ 381 (_async) = (struct smbprofile_stats_basic_async) {}; \ 382 smbprofile_dump_schedule(); \ 383 } \ 384 } while(0) 385 386 #define SMBPROFILE_BASIC_ASYNC_STATE(_async_name) \ 387 struct smbprofile_stats_basic_async _async_name; 388 #define _SMBPROFILE_BASIC_ASYNC_START(_stats, _area, _async) do { \ 389 (_async) = (struct smbprofile_stats_basic_async) {}; \ 390 if (smbprofile_state.config.do_count) { \ 391 if (smbprofile_state.config.do_times) { \ 392 (_async).start = profile_timestamp(); \ 393 (_async).stats = &((_area)->values._stats); \ 394 } \ 395 (_area)->values._stats.count += 1; \ 396 smbprofile_dump_schedule(); \ 397 } \ 398 } while(0) 399 #define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async) \ 400 _SMBPROFILE_BASIC_ASYNC_START(_name##_stats, _area, _async) 401 #define SMBPROFILE_BASIC_ASYNC_END(_async) do { \ 402 if ((_async).start != 0) { \ 403 (_async).stats->time += profile_timestamp() - (_async).start; \ 404 (_async) = (struct smbprofile_stats_basic_async) {}; \ 405 smbprofile_dump_schedule(); \ 406 } \ 407 } while(0) 408 409 #define _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async) do { \ 410 (_async).stats = &((_area)->values._stats); \ 411 if (smbprofile_state.config.do_times) { \ 412 (_async).start = profile_timestamp(); \ 413 } \ 414 } while(0) 415 #define _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async) do { \ 416 if ((_async).start != 0) { \ 417 if ((_async).idle_start == 0) { \ 418 (_async).idle_start = profile_timestamp(); \ 419 } \ 420 } \ 421 } while(0) 422 #define _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async) do { \ 423 if ((_async).idle_start != 0) { \ 424 (_async).idle_time += \ 425 profile_timestamp() - (_async).idle_start; \ 426 (_async).idle_start = 0; \ 427 } \ 428 } while(0) 429 #define _SMBPROFILE_TIMER_ASYNC_END(_async) do { \ 430 if ((_async).start != 0) { \ 431 _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async); \ 432 (_async).stats->time += profile_timestamp() - (_async).start; \ 433 (_async).stats->idle += (_async).idle_time; \ 434 } \ 435 } while(0) 436 437 #define SMBPROFILE_BYTES_ASYNC_STATE(_async_name) \ 438 struct smbprofile_stats_bytes_async _async_name; 439 #define _SMBPROFILE_BYTES_ASYNC_START(_stats, _area, _async, _bytes) do { \ 440 (_async) = (struct smbprofile_stats_bytes_async) {}; \ 441 if (smbprofile_state.config.do_count) { \ 442 _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \ 443 (_area)->values._stats.count += 1; \ 444 (_area)->values._stats.bytes += (_bytes); \ 445 smbprofile_dump_schedule(); \ 446 } \ 447 } while(0) 448 #define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _bytes) \ 449 _SMBPROFILE_BYTES_ASYNC_START(_name##_stats, _area, _async, _bytes) 450 #define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async) \ 451 _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async) 452 #define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async) \ 453 _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async) 454 #define SMBPROFILE_BYTES_ASYNC_END(_async) do { \ 455 if ((_async).stats != NULL) { \ 456 _SMBPROFILE_TIMER_ASYNC_END(_async); \ 457 (_async) = (struct smbprofile_stats_bytes_async) {}; \ 458 smbprofile_dump_schedule(); \ 459 } \ 460 } while(0) 461 462 #define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name) \ 463 struct smbprofile_stats_iobytes_async _async_name; 464 #define _SMBPROFILE_IOBYTES_ASYNC_START(_stats, _area, _async, _inbytes) do { \ 465 (_async) = (struct smbprofile_stats_iobytes_async) {}; \ 466 if (smbprofile_state.config.do_count) { \ 467 _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \ 468 (_area)->values._stats.count += 1; \ 469 (_area)->values._stats.inbytes += (_inbytes); \ 470 smbprofile_dump_schedule(); \ 471 } \ 472 } while(0) 473 #define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes) \ 474 _SMBPROFILE_IOBYTES_ASYNC_START(_name##_stats, _area, _async, _inbytes) 475 #define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async) \ 476 _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async) 477 #define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async) \ 478 _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async) 479 #define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes) do { \ 480 if ((_async).stats != NULL) { \ 481 (_async).stats->outbytes += (_outbytes); \ 482 _SMBPROFILE_TIMER_ASYNC_END(_async); \ 483 (_async) = (struct smbprofile_stats_iobytes_async) {}; \ 484 smbprofile_dump_schedule(); \ 485 } \ 486 } while(0) 487 488 extern struct profile_stats *profile_p; 489 490 struct smbprofile_global_state { 491 struct { 492 struct tdb_wrap *db; 493 struct tevent_context *ev; 494 struct tevent_timer *te; 495 } internal; 496 497 struct { 498 bool do_count; 499 bool do_times; 500 } config; 501 502 struct { 503 struct profile_stats global; 504 } stats; 505 }; 506 507 extern struct smbprofile_global_state smbprofile_state; 508 509 void smbprofile_dump_schedule_timer(void); 510 void smbprofile_dump_setup(struct tevent_context *ev); 511 512 static inline void smbprofile_dump_schedule(void) 36 513 { 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_FDOPENDIR, 47 #define syscall_fdopendir_count __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, count) 48 #define syscall_fdopendir_time __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, time) 49 50 PR_VALUE_SYSCALL_READDIR, 51 #define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count) 52 #define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time) 53 54 PR_VALUE_SYSCALL_SEEKDIR, 55 #define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count) 56 #define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time) 57 58 PR_VALUE_SYSCALL_TELLDIR, 59 #define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count) 60 #define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time) 61 62 PR_VALUE_SYSCALL_REWINDDIR, 63 #define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count) 64 #define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time) 65 66 PR_VALUE_SYSCALL_MKDIR, 67 #define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count) 68 #define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time) 69 70 PR_VALUE_SYSCALL_RMDIR, 71 #define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count) 72 #define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time) 73 74 PR_VALUE_SYSCALL_CLOSEDIR, 75 #define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count) 76 #define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time) 77 78 PR_VALUE_SYSCALL_OPEN, 79 #define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count) 80 #define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time) 81 82 PR_VALUE_SYSCALL_CREATEFILE, 83 #define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count) 84 #define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time) 85 86 PR_VALUE_SYSCALL_CLOSE, 87 #define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count) 88 #define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time) 89 90 PR_VALUE_SYSCALL_READ, 91 #define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count) 92 #define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time) 93 94 PR_VALUE_SYSCALL_PREAD, 95 #define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count) 96 #define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time) 97 98 PR_VALUE_SYSCALL_WRITE, 99 #define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count) 100 #define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time) 101 102 PR_VALUE_SYSCALL_PWRITE, 103 #define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count) 104 #define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time) 105 106 PR_VALUE_SYSCALL_LSEEK, 107 #define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count) 108 #define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time) 109 110 PR_VALUE_SYSCALL_SENDFILE, 111 #define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count) 112 #define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time) 113 114 PR_VALUE_SYSCALL_RECVFILE, 115 #define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count) 116 #define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time) 117 118 PR_VALUE_SYSCALL_RENAME, 119 #define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count) 120 #define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time) 121 122 PR_VALUE_SYSCALL_RENAME_AT, 123 #define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count) 124 #define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time) 125 126 PR_VALUE_SYSCALL_FSYNC, 127 #define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count) 128 #define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time) 129 130 PR_VALUE_SYSCALL_STAT, 131 #define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count) 132 #define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time) 133 134 PR_VALUE_SYSCALL_FSTAT, 135 #define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count) 136 #define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time) 137 138 PR_VALUE_SYSCALL_LSTAT, 139 #define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count) 140 #define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time) 141 142 PR_VALUE_SYSCALL_GET_ALLOC_SIZE, 143 #define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count) 144 #define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time) 145 146 PR_VALUE_SYSCALL_UNLINK, 147 #define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count) 148 #define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time) 149 150 PR_VALUE_SYSCALL_CHMOD, 151 #define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count) 152 #define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time) 153 154 PR_VALUE_SYSCALL_FCHMOD, 155 #define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count) 156 #define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time) 157 158 PR_VALUE_SYSCALL_CHOWN, 159 #define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count) 160 #define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time) 161 162 PR_VALUE_SYSCALL_FCHOWN, 163 #define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count) 164 #define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time) 165 166 PR_VALUE_SYSCALL_LCHOWN, 167 #define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count) 168 #define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time) 169 170 PR_VALUE_SYSCALL_CHDIR, 171 #define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count) 172 #define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time) 173 174 PR_VALUE_SYSCALL_GETWD, 175 #define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count) 176 #define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time) 177 178 PR_VALUE_SYSCALL_NTIMES, 179 #define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count) 180 #define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time) 181 182 PR_VALUE_SYSCALL_FTRUNCATE, 183 #define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count) 184 #define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time) 185 186 PR_VALUE_SYSCALL_FALLOCATE, 187 #define syscall_fallocate_count __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, count) 188 #define syscall_fallocate_time __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, time) 189 190 PR_VALUE_SYSCALL_FCNTL_LOCK, 191 #define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count) 192 #define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time) 193 194 PR_VALUE_SYSCALL_KERNEL_FLOCK, 195 #define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count) 196 #define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time) 197 198 PR_VALUE_SYSCALL_LINUX_SETLEASE, 199 #define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count) 200 #define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time) 201 202 PR_VALUE_SYSCALL_FCNTL_GETLOCK, 203 #define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count) 204 #define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time) 205 206 PR_VALUE_SYSCALL_READLINK, 207 #define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count) 208 #define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time) 209 210 PR_VALUE_SYSCALL_SYMLINK, 211 #define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count) 212 #define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time) 213 214 PR_VALUE_SYSCALL_LINK, 215 #define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count) 216 #define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time) 217 218 PR_VALUE_SYSCALL_MKNOD, 219 #define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count) 220 #define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time) 221 222 PR_VALUE_SYSCALL_REALPATH, 223 #define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count) 224 #define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time) 225 226 PR_VALUE_SYSCALL_GET_QUOTA, 227 #define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count) 228 #define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time) 229 230 PR_VALUE_SYSCALL_SET_QUOTA, 231 #define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count) 232 #define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time) 233 234 PR_VALUE_SYSCALL_GET_SD, 235 #define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count) 236 #define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time) 237 238 PR_VALUE_SYSCALL_SET_SD, 239 #define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count) 240 #define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time) 241 242 PR_VALUE_SYSCALL_BRL_LOCK, 243 #define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count) 244 #define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time) 245 246 PR_VALUE_SYSCALL_BRL_UNLOCK, 247 #define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count) 248 #define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time) 249 250 PR_VALUE_SYSCALL_BRL_CANCEL, 251 #define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count) 252 #define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time) 253 254 PR_VALUE_SYSCALL_STRICT_LOCK, 255 #define syscall_strict_lock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, count) 256 #define syscall_strict_lock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, time) 257 258 PR_VALUE_SYSCALL_STRICT_UNLOCK, 259 #define syscall_strict_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, count) 260 #define syscall_strict_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, time) 261 262 /* counters for individual SMB types */ 263 PR_VALUE_SMBMKDIR, 264 #define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count) 265 #define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time) 266 267 PR_VALUE_SMBRMDIR, 268 #define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count) 269 #define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time) 270 271 PR_VALUE_SMBOPEN, 272 #define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count) 273 #define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time) 274 275 PR_VALUE_SMBCREATE, 276 #define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count) 277 #define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time) 278 279 PR_VALUE_SMBCLOSE, 280 #define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count) 281 #define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time) 282 283 PR_VALUE_SMBFLUSH, 284 #define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count) 285 #define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time) 286 287 PR_VALUE_SMBUNLINK, 288 #define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count) 289 #define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time) 290 291 PR_VALUE_SMBMV, 292 #define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count) 293 #define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time) 294 295 PR_VALUE_SMBGETATR, 296 #define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count) 297 #define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time) 298 299 PR_VALUE_SMBSETATR, 300 #define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count) 301 #define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time) 302 303 PR_VALUE_SMBREAD, 304 #define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count) 305 #define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time) 306 307 PR_VALUE_SMBWRITE, 308 #define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count) 309 #define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time) 310 311 PR_VALUE_SMBLOCK, 312 #define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count) 313 #define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time) 314 315 PR_VALUE_SMBUNLOCK, 316 #define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count) 317 #define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time) 318 319 PR_VALUE_SMBCTEMP, 320 #define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count) 321 #define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time) 322 323 /* SMBmknew stats are currently combined with SMBcreate */ 324 PR_VALUE_SMBMKNEW, 325 #define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count) 326 #define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time) 327 328 PR_VALUE_SMBCHECKPATH, 329 #define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count) 330 #define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time) 331 332 PR_VALUE_SMBEXIT, 333 #define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count) 334 #define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time) 335 336 PR_VALUE_SMBLSEEK, 337 #define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count) 338 #define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time) 339 340 PR_VALUE_SMBLOCKREAD, 341 #define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count) 342 #define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time) 343 344 PR_VALUE_SMBWRITEUNLOCK, 345 #define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count) 346 #define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time) 347 348 PR_VALUE_SMBREADBRAW, 349 #define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count) 350 #define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time) 351 352 PR_VALUE_SMBREADBMPX, 353 #define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count) 354 #define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time) 355 356 PR_VALUE_SMBREADBS, 357 #define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count) 358 #define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time) 359 360 PR_VALUE_SMBWRITEBRAW, 361 #define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count) 362 #define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time) 363 364 PR_VALUE_SMBWRITEBMPX, 365 #define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count) 366 #define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time) 367 368 PR_VALUE_SMBWRITEBS, 369 #define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count) 370 #define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time) 371 372 PR_VALUE_SMBWRITEC, 373 #define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count) 374 #define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time) 375 376 PR_VALUE_SMBSETATTRE, 377 #define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count) 378 #define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time) 379 380 PR_VALUE_SMBGETATTRE, 381 #define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count) 382 #define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time) 383 384 PR_VALUE_SMBLOCKINGX, 385 #define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count) 386 #define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time) 387 388 PR_VALUE_SMBTRANS, 389 #define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count) 390 #define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time) 391 392 PR_VALUE_SMBTRANSS, 393 #define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count) 394 #define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time) 395 396 PR_VALUE_SMBIOCTL, 397 #define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count) 398 #define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time) 399 400 PR_VALUE_SMBIOCTLS, 401 #define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count) 402 #define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time) 403 404 PR_VALUE_SMBCOPY, 405 #define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count) 406 #define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time) 407 408 PR_VALUE_SMBMOVE, 409 #define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count) 410 #define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time) 411 412 PR_VALUE_SMBECHO, 413 #define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count) 414 #define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time) 415 416 PR_VALUE_SMBWRITECLOSE, 417 #define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count) 418 #define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time) 419 420 PR_VALUE_SMBOPENX, 421 #define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count) 422 #define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time) 423 424 PR_VALUE_SMBREADX, 425 #define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count) 426 #define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time) 427 428 PR_VALUE_SMBWRITEX, 429 #define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count) 430 #define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time) 431 432 PR_VALUE_SMBTRANS2, 433 #define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count) 434 #define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time) 435 436 PR_VALUE_SMBTRANSS2, 437 #define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count) 438 #define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time) 439 440 PR_VALUE_SMBFINDCLOSE, 441 #define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count) 442 #define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time) 443 444 PR_VALUE_SMBFINDNCLOSE, 445 #define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count) 446 #define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time) 447 448 PR_VALUE_SMBTCON, 449 #define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count) 450 #define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time) 451 452 PR_VALUE_SMBTDIS, 453 #define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count) 454 #define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time) 455 456 PR_VALUE_SMBNEGPROT, 457 #define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count) 458 #define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time) 459 460 PR_VALUE_SMBSESSSETUPX, 461 #define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count) 462 #define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time) 463 464 PR_VALUE_SMBULOGOFFX, 465 #define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count) 466 #define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time) 467 468 PR_VALUE_SMBTCONX, 469 #define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count) 470 #define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time) 471 472 PR_VALUE_SMBDSKATTR, 473 #define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count) 474 #define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time) 475 476 PR_VALUE_SMBSEARCH, 477 #define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count) 478 #define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time) 479 480 /* SBMffirst stats combined with SMBsearch */ 481 PR_VALUE_SMBFFIRST, 482 #define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count) 483 #define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time) 484 485 /* SBMfunique stats combined with SMBsearch */ 486 PR_VALUE_SMBFUNIQUE, 487 #define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count) 488 #define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time) 489 490 PR_VALUE_SMBFCLOSE, 491 #define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count) 492 #define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time) 493 494 PR_VALUE_SMBNTTRANS, 495 #define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count) 496 #define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time) 497 498 PR_VALUE_SMBNTTRANSS, 499 #define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count) 500 #define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time) 501 502 PR_VALUE_SMBNTCREATEX, 503 #define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count) 504 #define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time) 505 506 PR_VALUE_SMBNTCANCEL, 507 #define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count) 508 #define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time) 509 510 PR_VALUE_SMBNTRENAME, 511 #define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count) 512 #define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time) 513 514 PR_VALUE_SMBSPLOPEN, 515 #define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count) 516 #define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time) 517 518 PR_VALUE_SMBSPLWR, 519 #define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count) 520 #define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time) 521 522 PR_VALUE_SMBSPLCLOSE, 523 #define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count) 524 #define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time) 525 526 PR_VALUE_SMBSPLRETQ, 527 #define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count) 528 #define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time) 529 530 PR_VALUE_SMBSENDS, 531 #define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count) 532 #define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time) 533 534 PR_VALUE_SMBSENDB, 535 #define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count) 536 #define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time) 537 538 PR_VALUE_SMBFWDNAME, 539 #define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count) 540 #define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time) 541 542 PR_VALUE_SMBCANCELF, 543 #define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count) 544 #define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time) 545 546 PR_VALUE_SMBGETMAC, 547 #define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count) 548 #define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time) 549 550 PR_VALUE_SMBSENDSTRT, 551 #define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count) 552 #define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time) 553 554 PR_VALUE_SMBSENDEND, 555 #define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count) 556 #define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time) 557 558 PR_VALUE_SMBSENDTXT, 559 #define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count) 560 #define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time) 561 562 PR_VALUE_SMBINVALID, 563 #define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count) 564 #define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time) 565 566 /* Pathworks setdir command */ 567 PR_VALUE_PATHWORKS_SETDIR, 568 #define pathworks_setdir_count __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, count) 569 #define pathworks_setdir_time __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, time) 570 571 /* These are the TRANS2 sub commands */ 572 PR_VALUE_TRANS2_OPEN, 573 #define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count) 574 #define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time) 575 576 PR_VALUE_TRANS2_FINDFIRST, 577 #define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count) 578 #define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time) 579 580 PR_VALUE_TRANS2_FINDNEXT, 581 #define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count) 582 #define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time) 583 584 PR_VALUE_TRANS2_QFSINFO, 585 #define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count) 586 #define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time) 587 588 PR_VALUE_TRANS2_SETFSINFO, 589 #define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count) 590 #define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time) 591 592 PR_VALUE_TRANS2_QPATHINFO, 593 #define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count) 594 #define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time) 595 596 PR_VALUE_TRANS2_SETPATHINFO, 597 #define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count) 598 #define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time) 599 600 PR_VALUE_TRANS2_QFILEINFO, 601 #define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count) 602 #define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time) 603 604 PR_VALUE_TRANS2_SETFILEINFO, 605 #define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count) 606 #define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time) 607 608 PR_VALUE_TRANS2_FSCTL, 609 #define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count) 610 #define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time) 611 612 PR_VALUE_TRANS2_IOCTL, 613 #define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count) 614 #define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time) 615 616 PR_VALUE_TRANS2_FINDNOTIFYFIRST, 617 #define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count) 618 #define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time) 619 620 PR_VALUE_TRANS2_FINDNOTIFYNEXT, 621 #define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count) 622 #define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time) 623 624 PR_VALUE_TRANS2_MKDIR, 625 #define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count) 626 #define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time) 627 628 PR_VALUE_TRANS2_SESSION_SETUP, 629 #define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count) 630 #define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time) 631 632 PR_VALUE_TRANS2_GET_DFS_REFERRAL, 633 #define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count) 634 #define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time) 635 636 PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, 637 #define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count) 638 #define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time) 639 640 /* These are the NT transact sub commands. */ 641 PR_VALUE_NT_TRANSACT_CREATE, 642 #define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count) 643 #define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time) 644 645 PR_VALUE_NT_TRANSACT_IOCTL, 646 #define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count) 647 #define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time) 648 649 PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, 650 #define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count) 651 #define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time) 652 653 PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, 654 #define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count) 655 #define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time) 656 657 PR_VALUE_NT_TRANSACT_RENAME, 658 #define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count) 659 #define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time) 660 661 PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, 662 #define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count) 663 #define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time) 664 665 PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, 666 #define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count) 667 #define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time) 668 669 PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, 670 #define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count) 671 #define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time) 672 673 /* These are ACL manipulation calls */ 674 PR_VALUE_GET_NT_ACL, 675 #define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count) 676 #define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time) 677 678 PR_VALUE_FGET_NT_ACL, 679 #define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count) 680 #define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time) 681 682 PR_VALUE_FSET_NT_ACL, 683 #define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count) 684 #define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time) 685 686 PR_VALUE_CHMOD_ACL, 687 #define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count) 688 #define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time) 689 690 PR_VALUE_FCHMOD_ACL, 691 #define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count) 692 #define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time) 693 694 /* These are nmbd stats */ 695 PR_VALUE_NAME_RELEASE, 696 #define name_release_count __profile_stats_value(PR_VALUE_NAME_RELEASE, count) 697 #define name_release_time __profile_stats_value(PR_VALUE_NAME_RELEASE, time) 698 699 PR_VALUE_NAME_REFRESH, 700 #define name_refresh_count __profile_stats_value(PR_VALUE_NAME_REFRESH, count) 701 #define name_refresh_time __profile_stats_value(PR_VALUE_NAME_REFRESH, time) 702 703 PR_VALUE_NAME_REGISTRATION, 704 #define name_registration_count __profile_stats_value(PR_VALUE_NAME_REGISTRATION, count) 705 #define name_registration_time __profile_stats_value(PR_VALUE_NAME_REGISTRATION, time) 706 707 PR_VALUE_NODE_STATUS, 708 #define node_status_count __profile_stats_value(PR_VALUE_NODE_STATUS, count) 709 #define node_status_time __profile_stats_value(PR_VALUE_NODE_STATUS, time) 710 711 PR_VALUE_NAME_QUERY, 712 #define name_query_count __profile_stats_value(PR_VALUE_NAME_QUERY, count) 713 #define name_query_time __profile_stats_value(PR_VALUE_NAME_QUERY, time) 714 715 PR_VALUE_HOST_ANNOUNCE, 716 #define host_announce_count __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, count) 717 #define host_announce_time __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, time) 718 719 PR_VALUE_WORKGROUP_ANNOUNCE, 720 #define workgroup_announce_count __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, count) 721 #define workgroup_announce_time __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, time) 722 723 PR_VALUE_LOCAL_MASTER_ANNOUNCE, 724 #define local_master_announce_count __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, count) 725 #define local_master_announce_time __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, time) 726 727 PR_VALUE_MASTER_BROWSER_ANNOUNCE, 728 #define master_browser_announce_count __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, count) 729 #define master_browser_announce_time __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, time) 730 731 PR_VALUE_LM_HOST_ANNOUNCE, 732 #define lm_host_announce_count __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, count) 733 #define lm_host_announce_time __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, time) 734 735 PR_VALUE_GET_BACKUP_LIST, 736 #define get_backup_list_count __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, count) 737 #define get_backup_list_time __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, time) 738 739 PR_VALUE_RESET_BROWSER, 740 #define reset_browser_count __profile_stats_value(PR_VALUE_RESET_BROWSER, count) 741 #define reset_browser_time __profile_stats_value(PR_VALUE_RESET_BROWSER, time) 742 743 PR_VALUE_ANNOUNCE_REQUEST, 744 #define announce_request_count __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, count) 745 #define announce_request_time __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, time) 746 747 PR_VALUE_LM_ANNOUNCE_REQUEST, 748 #define lm_announce_request_count __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, count) 749 #define lm_announce_request_time __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, time) 750 751 PR_VALUE_DOMAIN_LOGON, 752 #define domain_logon_count __profile_stats_value(PR_VALUE_DOMAIN_LOGON, count) 753 #define domain_logon_time __profile_stats_value(PR_VALUE_DOMAIN_LOGON, time) 754 755 PR_VALUE_SYNC_BROWSE_LISTS, 756 #define sync_browse_lists_count __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, count) 757 #define sync_browse_lists_time __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, time) 758 759 PR_VALUE_RUN_ELECTIONS, 760 #define run_elections_count __profile_stats_value(PR_VALUE_RUN_ELECTIONS, count) 761 #define run_elections_time __profile_stats_value(PR_VALUE_RUN_ELECTIONS, time) 762 763 PR_VALUE_ELECTION, 764 #define election_count __profile_stats_value(PR_VALUE_ELECTION, count) 765 #define election_time __profile_stats_value(PR_VALUE_ELECTION, time) 766 767 PR_VALUE_SMB2_NEGPROT, 768 #define smb2_negprot_count __profile_stats_value(PR_VALUE_SMB2_NEGPROT, count) 769 #define smb2_negprot_time __profile_stats_value(PR_VALUE_SMB2_NEGPROT, time) 770 771 PR_VALUE_SMB2_SESSSETUP, 772 #define smb2_sesssetup_count __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, count) 773 #define smb2_sesssetup_time __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, time) 774 775 PR_VALUE_SMB2_LOGOFF, 776 #define smb2_logoff_count __profile_stats_value(PR_VALUE_SMB2_LOGOFF, count) 777 #define smb2_logoff_time __profile_stats_value(PR_VALUE_SMB2_LOGOFF, time) 778 779 PR_VALUE_SMB2_TCON, 780 #define smb2_tcon_count __profile_stats_value(PR_VALUE_SMB2_TCON, count) 781 #define smb2_tcon_time __profile_stats_value(PR_VALUE_SMB2_TCON, time) 782 783 PR_VALUE_SMB2_TDIS, 784 #define smb2_tdis_count __profile_stats_value(PR_VALUE_SMB2_TDIS, count) 785 #define smb2_tdis_time __profile_stats_value(PR_VALUE_SMB2_TDIS, time) 786 787 PR_VALUE_SMB2_CREATE, 788 #define smb2_create_count __profile_stats_value(PR_VALUE_SMB2_CREATE, count) 789 #define smb2_create_time __profile_stats_value(PR_VALUE_SMB2_CREATE, time) 790 791 PR_VALUE_SMB2_CLOSE, 792 #define smb2_close_count __profile_stats_value(PR_VALUE_SMB2_CLOSE, count) 793 #define smb2_close_time __profile_stats_value(PR_VALUE_SMB2_CLOSE, time) 794 795 PR_VALUE_SMB2_FLUSH, 796 #define smb2_flush_count __profile_stats_value(PR_VALUE_SMB2_FLUSH, count) 797 #define smb2_flush_time __profile_stats_value(PR_VALUE_SMB2_FLUSH, time) 798 799 PR_VALUE_SMB2_READ, 800 #define smb2_read_count __profile_stats_value(PR_VALUE_SMB2_READ, count) 801 #define smb2_read_time __profile_stats_value(PR_VALUE_SMB2_READ, time) 802 803 PR_VALUE_SMB2_WRITE, 804 #define smb2_write_count __profile_stats_value(PR_VALUE_SMB2_WRITE, count) 805 #define smb2_write_time __profile_stats_value(PR_VALUE_SMB2_WRITE, time) 806 807 PR_VALUE_SMB2_LOCK, 808 #define smb2_lock_count __profile_stats_value(PR_VALUE_SMB2_LOCK, count) 809 #define smb2_lock_time __profile_stats_value(PR_VALUE_SMB2_LOCK, time) 810 811 PR_VALUE_SMB2_IOCTL, 812 #define smb2_ioctl_count __profile_stats_value(PR_VALUE_SMB2_IOCTL, count) 813 #define smb2_ioctl_time __profile_stats_value(PR_VALUE_SMB2_IOCTL, time) 814 815 PR_VALUE_SMB2_CANCEL, 816 #define smb2_cancel_count __profile_stats_value(PR_VALUE_SMB2_CANCEL, count) 817 #define smb2_cancel_time __profile_stats_value(PR_VALUE_SMB2_CANCEL, time) 818 819 PR_VALUE_SMB2_KEEPALIVE, 820 #define smb2_keepalive_count __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, count) 821 #define smb2_keepalive_time __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, time) 822 823 PR_VALUE_SMB2_FIND, 824 #define smb2_find_count __profile_stats_value(PR_VALUE_SMB2_FIND, count) 825 #define smb2_find_time __profile_stats_value(PR_VALUE_SMB2_FIND, time) 826 827 PR_VALUE_SMB2_NOTIFY, 828 #define smb2_notify_count __profile_stats_value(PR_VALUE_SMB2_NOTIFY, count) 829 #define smb2_notify_time __profile_stats_value(PR_VALUE_SMB2_NOTIFY, time) 830 831 PR_VALUE_SMB2_GETINFO, 832 #define smb2_getinfo_count __profile_stats_value(PR_VALUE_SMB2_GETINFO, count) 833 #define smb2_getinfo_time __profile_stats_value(PR_VALUE_SMB2_GETINFO, time) 834 835 PR_VALUE_SMB2_SETINFO, 836 #define smb2_setinfo_count __profile_stats_value(PR_VALUE_SMB2_SETINFO, count) 837 #define smb2_setinfo_time __profile_stats_value(PR_VALUE_SMB2_SETINFO, time) 838 839 PR_VALUE_SMB2_BREAK, 840 #define smb2_break_count __profile_stats_value(PR_VALUE_SMB2_BREAK, count) 841 #define smb2_break_time __profile_stats_value(PR_VALUE_SMB2_BREAK, time) 842 843 /* This mist remain the last value. */ 844 PR_VALUE_MAX 845 }; /* enum profile_stats_values */ 846 847 const char * profile_value_name(enum profile_stats_values val); 848 849 struct profile_stats { 850 /* general counters */ 851 unsigned smb_count; /* how many SMB packets we have processed */ 852 unsigned uid_changes; /* how many times we change our effective uid */ 853 854 /* system call and protocol operation counters and cumulative times */ 855 unsigned count[PR_VALUE_MAX]; 856 unsigned time[PR_VALUE_MAX]; 857 858 /* cumulative byte counts */ 859 unsigned syscall_pread_bytes; 860 unsigned syscall_pwrite_bytes; 861 unsigned syscall_read_bytes; 862 unsigned syscall_write_bytes; 863 unsigned syscall_sendfile_bytes; 864 unsigned syscall_recvfile_bytes; 865 866 /* stat cache counters */ 867 unsigned statcache_lookups; 868 unsigned statcache_misses; 869 unsigned statcache_hits; 870 871 /* write cache counters */ 872 unsigned writecache_read_hits; 873 unsigned writecache_abutted_writes; 874 unsigned writecache_total_writes; 875 unsigned writecache_non_oplock_writes; 876 unsigned writecache_direct_writes; 877 unsigned writecache_init_writes; 878 unsigned writecache_flushed_writes[NUM_FLUSH_REASONS]; 879 unsigned writecache_num_perfect_writes; 880 unsigned writecache_num_write_caches; 881 unsigned writecache_allocated_write_caches; 882 }; 883 884 struct profile_header { 885 int prof_shm_magic; 886 int prof_shm_version; 887 struct profile_stats stats; 888 }; 889 890 extern struct profile_header *profile_h; 891 extern struct profile_stats *profile_p; 892 extern bool do_profile_flag; 893 extern bool do_profile_times; 894 895 #ifdef WITH_PROFILE 896 897 /* these are helper macros - do not call them directly in the code 898 * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones 899 * below which test for the profile flage first 900 */ 901 #define INC_PROFILE_COUNT(x) profile_p->x++ 902 #define DEC_PROFILE_COUNT(x) profile_p->x-- 903 #define ADD_PROFILE_COUNT(x,y) profile_p->x += (y) 514 if (likely(smbprofile_state.internal.te != NULL)) { 515 return; 516 } 517 518 if (unlikely(smbprofile_state.internal.ev == NULL)) { 519 return; 520 } 521 522 smbprofile_dump_schedule_timer(); 523 } 524 525 static inline bool smbprofile_dump_pending(void) 526 { 527 if (smbprofile_state.internal.te == NULL) { 528 return false; 529 } 530 531 return true; 532 } 533 534 void smbprofile_dump(void); 535 536 void smbprofile_cleanup(pid_t pid, pid_t dst); 537 void smbprofile_stats_accumulate(struct profile_stats *acc, 538 const struct profile_stats *add); 539 void smbprofile_collect(struct profile_stats *stats); 904 540 905 541 static inline uint64_t profile_timestamp(void) … … 913 549 } 914 550 915 /* end of helper macros */916 917 551 #define DO_PROFILE_INC(x) \ 918 if (do_profile_flag) { \ 919 INC_PROFILE_COUNT(x); \ 920 } 921 922 #define DO_PROFILE_DEC(x) \ 923 if (do_profile_flag) { \ 924 DEC_PROFILE_COUNT(x); \ 925 } 926 927 #define DO_PROFILE_DEC_INC(x,y) \ 928 if (do_profile_flag) { \ 929 DEC_PROFILE_COUNT(x); \ 930 INC_PROFILE_COUNT(y); \ 931 } 932 933 #define DO_PROFILE_ADD(x,n) \ 934 if (do_profile_flag) { \ 935 ADD_PROFILE_COUNT(x,n); \ 936 } 552 _SMBPROFILE_COUNT_INCREMENT(x##_stats, profile_p, 1); \ 937 553 938 554 #define START_PROFILE(x) \ 939 uint64_t __profstamp_##x = 0; \ 940 if (do_profile_flag) { \ 941 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\ 942 INC_PROFILE_COUNT(x##_count); \ 943 } 555 struct smbprofile_stats_basic_async __profasync_##x = {}; \ 556 _SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x); 944 557 945 558 #define START_PROFILE_BYTES(x,n) \ 946 uint64_t __profstamp_##x = 0; \ 947 if (do_profile_flag) { \ 948 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\ 949 INC_PROFILE_COUNT(x##_count); \ 950 ADD_PROFILE_COUNT(x##_bytes, n); \ 951 } 559 struct smbprofile_stats_bytes_async __profasync_##x = {}; \ 560 _SMBPROFILE_BYTES_ASYNC_START(x##_stats, profile_p, __profasync_##x, n); 952 561 953 562 #define END_PROFILE(x) \ 954 if (do_profile_times) { \ 955 ADD_PROFILE_COUNT(x##_time, \ 956 profile_timestamp() - __profstamp_##x); \ 957 } 563 SMBPROFILE_BASIC_ASYNC_END(__profasync_##x) 564 565 #define END_PROFILE_BYTES(x) \ 566 SMBPROFILE_BYTES_ASYNC_END(__profasync_##x) 567 958 568 #else /* WITH_PROFILE */ 959 569 570 #define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v) 571 572 #define SMBPROFILE_TIME_ASYNC_STATE(_async_name) 573 #define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async) 574 #define SMBPROFILE_TIME_ASYNC_END(_async) 575 576 #define SMBPROFILE_BASIC_ASYNC_STATE(_async_name) 577 #define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async) 578 #define SMBPROFILE_BASIC_ASYNC_END(_async) 579 580 #define SMBPROFILE_BYTES_ASYNC_STATE(_async_name) 581 #define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _inbytes) 582 #define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async) 583 #define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async) 584 #define SMBPROFILE_BYTES_ASYNC_END(_async) 585 586 #define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name) 587 #define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes) 588 #define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async) 589 #define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async) 590 #define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes) 591 960 592 #define DO_PROFILE_INC(x) 961 #define DO_PROFILE_DEC(x)962 #define DO_PROFILE_DEC_INC(x,y)963 #define DO_PROFILE_ADD(x,n)964 593 #define START_PROFILE(x) 965 594 #define START_PROFILE_BYTES(x,n) 966 595 #define END_PROFILE(x) 596 #define END_PROFILE_BYTES(x) 597 598 static inline bool smbprofile_dump_pending(void) 599 { 600 return false; 601 } 602 603 static inline void smbprofile_dump_setup(struct tevent_context *ev) 604 { 605 return; 606 } 607 608 static inline void smbprofile_dump(void) 609 { 610 return; 611 } 612 613 static inline void smbprofile_cleanup(pid_t pid, pid_t dst) 614 { 615 return; 616 } 617 967 618 #endif /* WITH_PROFILE */ 968 619 … … 970 621 971 622 void set_profile_level(int level, struct server_id src); 623 624 struct messaging_context; 972 625 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly); 973 626
Note:
See TracChangeset
for help on using the changeset viewer.