tsan_stat.h revision 26fe5d396c5c99ddcd89b3f8722cea1d4940b9e9
1//===-- tsan_stat.h ---------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of ThreadSanitizer (TSan), a race detector.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef TSAN_STAT_H
15#define TSAN_STAT_H
16
17namespace __tsan {
18
19enum StatType {
20  // Memory access processing related stuff.
21  StatMop,
22  StatMopRead,
23  StatMopWrite,
24  StatMop1,  // These must be consequtive.
25  StatMop2,
26  StatMop4,
27  StatMop8,
28  StatMopSame,
29  StatMopRange,
30  StatMopRodata,
31  StatMopRangeRodata,
32  StatShadowProcessed,
33  StatShadowZero,
34  StatShadowNonZero,  // Derived.
35  StatShadowSameSize,
36  StatShadowIntersect,
37  StatShadowNotIntersect,
38  StatShadowSameThread,
39  StatShadowAnotherThread,
40  StatShadowReplace,
41
42  // Func processing.
43  StatFuncEnter,
44  StatFuncExit,
45
46  // Trace processing.
47  StatEvents,
48
49  // Threads.
50  StatThreadCreate,
51  StatThreadFinish,
52  StatThreadReuse,
53  StatThreadMaxTid,
54  StatThreadMaxAlive,
55
56  // Mutexes.
57  StatMutexCreate,
58  StatMutexDestroy,
59  StatMutexLock,
60  StatMutexUnlock,
61  StatMutexRecLock,
62  StatMutexRecUnlock,
63  StatMutexReadLock,
64  StatMutexReadUnlock,
65
66  // Synchronization.
67  StatSyncCreated,
68  StatSyncDestroyed,
69  StatSyncAcquire,
70  StatSyncRelease,
71
72  // Atomics.
73  StatAtomic,
74  StatAtomicLoad,
75  StatAtomicStore,
76  StatAtomicExchange,
77  StatAtomicFetchAdd,
78  StatAtomicFetchSub,
79  StatAtomicFetchAnd,
80  StatAtomicFetchOr,
81  StatAtomicFetchXor,
82  StatAtomicFetchNand,
83  StatAtomicCAS,
84  StatAtomicFence,
85  StatAtomicRelaxed,
86  StatAtomicConsume,
87  StatAtomicAcquire,
88  StatAtomicRelease,
89  StatAtomicAcq_Rel,
90  StatAtomicSeq_Cst,
91  StatAtomic1,
92  StatAtomic2,
93  StatAtomic4,
94  StatAtomic8,
95  StatAtomic16,
96
97  // Interceptors.
98  StatInterceptor,
99  StatInt_longjmp,
100  StatInt_siglongjmp,
101  StatInt_malloc,
102  StatInt___libc_memalign,
103  StatInt_calloc,
104  StatInt_realloc,
105  StatInt_free,
106  StatInt_cfree,
107  StatInt_malloc_usable_size,
108  StatInt_mmap,
109  StatInt_mmap64,
110  StatInt_munmap,
111  StatInt_memalign,
112  StatInt_valloc,
113  StatInt_pvalloc,
114  StatInt_posix_memalign,
115  StatInt__Znwm,
116  StatInt__ZnwmRKSt9nothrow_t,
117  StatInt__Znam,
118  StatInt__ZnamRKSt9nothrow_t,
119  StatInt__ZdlPv,
120  StatInt__ZdlPvRKSt9nothrow_t,
121  StatInt__ZdaPv,
122  StatInt__ZdaPvRKSt9nothrow_t,
123  StatInt_strlen,
124  StatInt_memset,
125  StatInt_memcpy,
126  StatInt_strcmp,
127  StatInt_memchr,
128  StatInt_memrchr,
129  StatInt_memmove,
130  StatInt_memcmp,
131  StatInt_strchr,
132  StatInt_strchrnul,
133  StatInt_strrchr,
134  StatInt_strncmp,
135  StatInt_strcpy,
136  StatInt_strncpy,
137  StatInt_strcasecmp,
138  StatInt_strncasecmp,
139  StatInt_strstr,
140  StatInt_strdup,
141  StatInt_atexit,
142  StatInt__exit,
143  StatInt___cxa_guard_acquire,
144  StatInt___cxa_guard_release,
145  StatInt___cxa_guard_abort,
146  StatInt_pthread_create,
147  StatInt_pthread_join,
148  StatInt_pthread_detach,
149  StatInt_pthread_mutex_init,
150  StatInt_pthread_mutex_destroy,
151  StatInt_pthread_mutex_lock,
152  StatInt_pthread_mutex_trylock,
153  StatInt_pthread_mutex_timedlock,
154  StatInt_pthread_mutex_unlock,
155  StatInt_pthread_spin_init,
156  StatInt_pthread_spin_destroy,
157  StatInt_pthread_spin_lock,
158  StatInt_pthread_spin_trylock,
159  StatInt_pthread_spin_unlock,
160  StatInt_pthread_rwlock_init,
161  StatInt_pthread_rwlock_destroy,
162  StatInt_pthread_rwlock_rdlock,
163  StatInt_pthread_rwlock_tryrdlock,
164  StatInt_pthread_rwlock_timedrdlock,
165  StatInt_pthread_rwlock_wrlock,
166  StatInt_pthread_rwlock_trywrlock,
167  StatInt_pthread_rwlock_timedwrlock,
168  StatInt_pthread_rwlock_unlock,
169  StatInt_pthread_cond_init,
170  StatInt_pthread_cond_destroy,
171  StatInt_pthread_cond_signal,
172  StatInt_pthread_cond_broadcast,
173  StatInt_pthread_cond_wait,
174  StatInt_pthread_cond_timedwait,
175  StatInt_pthread_barrier_init,
176  StatInt_pthread_barrier_destroy,
177  StatInt_pthread_barrier_wait,
178  StatInt_pthread_once,
179  StatInt_pthread_getschedparam,
180  StatInt_pthread_setname_np,
181  StatInt_sem_init,
182  StatInt_sem_destroy,
183  StatInt_sem_wait,
184  StatInt_sem_trywait,
185  StatInt_sem_timedwait,
186  StatInt_sem_post,
187  StatInt_sem_getvalue,
188  StatInt_stat,
189  StatInt___xstat,
190  StatInt_stat64,
191  StatInt___xstat64,
192  StatInt_lstat,
193  StatInt___lxstat,
194  StatInt_lstat64,
195  StatInt___lxstat64,
196  StatInt_fstat,
197  StatInt___fxstat,
198  StatInt_fstat64,
199  StatInt___fxstat64,
200  StatInt_open,
201  StatInt_open64,
202  StatInt_creat,
203  StatInt_creat64,
204  StatInt_dup,
205  StatInt_dup2,
206  StatInt_dup3,
207  StatInt_eventfd,
208  StatInt_signalfd,
209  StatInt_inotify_init,
210  StatInt_inotify_init1,
211  StatInt_socket,
212  StatInt_socketpair,
213  StatInt_connect,
214  StatInt_bind,
215  StatInt_listen,
216  StatInt_accept,
217  StatInt_accept4,
218  StatInt_epoll_create,
219  StatInt_epoll_create1,
220  StatInt_close,
221  StatInt___close,
222  StatInt___res_iclose,
223  StatInt_pipe,
224  StatInt_pipe2,
225  StatInt_read,
226  StatInt_prctl,
227  StatInt_pread,
228  StatInt_pread64,
229  StatInt_readv,
230  StatInt_preadv,
231  StatInt_preadv64,
232  StatInt_write,
233  StatInt_pwrite,
234  StatInt_pwrite64,
235  StatInt_writev,
236  StatInt_pwritev,
237  StatInt_pwritev64,
238  StatInt_send,
239  StatInt_sendmsg,
240  StatInt_recv,
241  StatInt_recvmsg,
242  StatInt_unlink,
243  StatInt_fopen,
244  StatInt_freopen,
245  StatInt_fclose,
246  StatInt_fread,
247  StatInt_fwrite,
248  StatInt_fflush,
249  StatInt_abort,
250  StatInt_puts,
251  StatInt_rmdir,
252  StatInt_opendir,
253  StatInt_epoll_ctl,
254  StatInt_epoll_wait,
255  StatInt_poll,
256  StatInt_ppoll,
257  StatInt_sigaction,
258  StatInt_signal,
259  StatInt_sigsuspend,
260  StatInt_raise,
261  StatInt_kill,
262  StatInt_pthread_kill,
263  StatInt_sleep,
264  StatInt_usleep,
265  StatInt_nanosleep,
266  StatInt_gettimeofday,
267  StatInt_fork,
268  StatInt_vscanf,
269  StatInt_vsscanf,
270  StatInt_vfscanf,
271  StatInt_scanf,
272  StatInt_sscanf,
273  StatInt_fscanf,
274  StatInt___isoc99_vscanf,
275  StatInt___isoc99_vsscanf,
276  StatInt___isoc99_vfscanf,
277  StatInt___isoc99_scanf,
278  StatInt___isoc99_sscanf,
279  StatInt___isoc99_fscanf,
280  StatInt_on_exit,
281  StatInt___cxa_atexit,
282  StatInt_localtime,
283  StatInt_localtime_r,
284  StatInt_gmtime,
285  StatInt_gmtime_r,
286  StatInt_ctime,
287  StatInt_ctime_r,
288  StatInt_asctime,
289  StatInt_asctime_r,
290  StatInt_frexp,
291  StatInt_frexpf,
292  StatInt_frexpl,
293  StatInt_getpwnam,
294  StatInt_getpwuid,
295  StatInt_getgrnam,
296  StatInt_getgrgid,
297  StatInt_getpwnam_r,
298  StatInt_getpwuid_r,
299  StatInt_getgrnam_r,
300  StatInt_getgrgid_r,
301  StatInt_clock_getres,
302  StatInt_clock_gettime,
303  StatInt_clock_settime,
304  StatInt_getitimer,
305  StatInt_setitimer,
306  StatInt_time,
307  StatInt_glob,
308  StatInt_glob64,
309  StatInt_wait,
310  StatInt_waitid,
311  StatInt_waitpid,
312  StatInt_wait3,
313  StatInt_wait4,
314  StatInt_inet_ntop,
315  StatInt_inet_pton,
316  StatInt_inet_aton,
317  StatInt_getaddrinfo,
318  StatInt_getnameinfo,
319  StatInt_getsockname,
320  StatInt_gethostent,
321  StatInt_gethostbyname,
322  StatInt_gethostbyname2,
323  StatInt_gethostbyaddr,
324  StatInt_gethostent_r,
325  StatInt_gethostbyname_r,
326  StatInt_gethostbyname2_r,
327  StatInt_gethostbyaddr_r,
328  StatInt_getsockopt,
329  StatInt_modf,
330  StatInt_modff,
331  StatInt_modfl,
332  StatInt_getpeername,
333  StatInt_ioctl,
334  StatInt_sysinfo,
335  StatInt_readdir,
336  StatInt_readdir64,
337  StatInt_readdir_r,
338  StatInt_readdir64_r,
339  StatInt_ptrace,
340  StatInt_setlocale,
341  StatInt_getcwd,
342  StatInt_get_current_dir_name,
343  StatInt_strtoimax,
344  StatInt_strtoumax,
345  StatInt_mbstowcs,
346  StatInt_mbsrtowcs,
347  StatInt_mbsnrtowcs,
348  StatInt_wcstombs,
349  StatInt_wcsrtombs,
350  StatInt_wcsnrtombs,
351  StatInt_tcgetattr,
352  StatInt_realpath,
353  StatInt_canonicalize_file_name,
354  StatInt_confstr,
355  StatInt_sched_getaffinity,
356  StatInt_strerror,
357  StatInt_strerror_r,
358  StatInt_scandir,
359  StatInt_scandir64,
360  StatInt_getgroups,
361  StatInt_wordexp,
362  StatInt_sigwait,
363  StatInt_sigwaitinfo,
364  StatInt_sigtimedwait,
365  StatInt_sigemptyset,
366  StatInt_sigfillset,
367  StatInt_sigpending,
368  StatInt_sigprocmask,
369  StatInt_backtrace,
370  StatInt_backtrace_symbols,
371  StatInt_dlopen,
372  StatInt_dlclose,
373  StatInt_getmntent,
374  StatInt_getmntent_r,
375  StatInt_statfs,
376  StatInt_statfs64,
377  StatInt_fstatfs,
378  StatInt_fstatfs64,
379  StatInt_statvfs,
380  StatInt_statvfs64,
381  StatInt_fstatvfs,
382  StatInt_fstatvfs64,
383  StatInt_initgroups,
384  StatInt_ether_ntoa,
385  StatInt_ether_aton,
386  StatInt_ether_ntoa_r,
387  StatInt_ether_aton_r,
388  StatInt_ether_ntohost,
389  StatInt_ether_hostton,
390  StatInt_ether_line,
391  StatInt_shmctl,
392  StatInt_random_r,
393  StatInt_tmpnam,
394  StatInt_tmpnam_r,
395  StatInt_tempnam,
396  StatInt_sincos,
397  StatInt_sincosf,
398  StatInt_sincosl,
399  StatInt_remquo,
400  StatInt_remquof,
401  StatInt_remquol,
402  StatInt_lgamma,
403  StatInt_lgammaf,
404  StatInt_lgammal,
405  StatInt_lgamma_r,
406  StatInt_lgammaf_r,
407  StatInt_lgammal_r,
408  StatInt_drand48_r,
409  StatInt_lrand48_r,
410  StatInt_getline,
411  StatInt_getdelim,
412
413  StatInt_pthread_attr_getdetachstate,
414  StatInt_pthread_attr_getguardsize,
415  StatInt_pthread_attr_getschedparam,
416  StatInt_pthread_attr_getschedpolicy,
417  StatInt_pthread_attr_getinheritsched,
418  StatInt_pthread_attr_getscope,
419  StatInt_pthread_attr_getstacksize,
420  StatInt_pthread_attr_getstack,
421  StatInt_pthread_attr_getaffinity_np,
422
423  // Dynamic annotations.
424  StatAnnotation,
425  StatAnnotateHappensBefore,
426  StatAnnotateHappensAfter,
427  StatAnnotateCondVarSignal,
428  StatAnnotateCondVarSignalAll,
429  StatAnnotateMutexIsNotPHB,
430  StatAnnotateCondVarWait,
431  StatAnnotateRWLockCreate,
432  StatAnnotateRWLockCreateStatic,
433  StatAnnotateRWLockDestroy,
434  StatAnnotateRWLockAcquired,
435  StatAnnotateRWLockReleased,
436  StatAnnotateTraceMemory,
437  StatAnnotateFlushState,
438  StatAnnotateNewMemory,
439  StatAnnotateNoOp,
440  StatAnnotateFlushExpectedRaces,
441  StatAnnotateEnableRaceDetection,
442  StatAnnotateMutexIsUsedAsCondVar,
443  StatAnnotatePCQGet,
444  StatAnnotatePCQPut,
445  StatAnnotatePCQDestroy,
446  StatAnnotatePCQCreate,
447  StatAnnotateExpectRace,
448  StatAnnotateBenignRaceSized,
449  StatAnnotateBenignRace,
450  StatAnnotateIgnoreReadsBegin,
451  StatAnnotateIgnoreReadsEnd,
452  StatAnnotateIgnoreWritesBegin,
453  StatAnnotateIgnoreWritesEnd,
454  StatAnnotateIgnoreSyncBegin,
455  StatAnnotateIgnoreSyncEnd,
456  StatAnnotatePublishMemoryRange,
457  StatAnnotateUnpublishMemoryRange,
458  StatAnnotateThreadName,
459
460  // Internal mutex contentionz.
461  StatMtxTotal,
462  StatMtxTrace,
463  StatMtxThreads,
464  StatMtxReport,
465  StatMtxSyncVar,
466  StatMtxSyncTab,
467  StatMtxSlab,
468  StatMtxAnnotations,
469  StatMtxAtExit,
470  StatMtxMBlock,
471  StatMtxJavaMBlock,
472  StatMtxFD,
473
474  // This must be the last.
475  StatCnt
476};
477
478}  // namespace __tsan
479
480#endif  // TSAN_STAT_H
481