blob: 7362298654d286b1620b97b188b899ae00c534b6 [file] [log] [blame]
Alexey Samsonov603c4be2012-06-04 13:55:19 +00001//===-- tsan_stat.cc ------------------------------------------------------===//
Kostya Serebryany7ac41482012-05-10 13:48:04 +00002//
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#include "tsan_stat.h"
14#include "tsan_rtl.h"
15
16namespace __tsan {
17
18void StatAggregate(u64 *dst, u64 *src) {
19 if (!kCollectStats)
20 return;
21 for (int i = 0; i < StatCnt; i++)
22 dst[i] += src[i];
23}
24
25void StatOutput(u64 *stat) {
26 if (!kCollectStats)
27 return;
28
29 stat[StatShadowNonZero] = stat[StatShadowProcessed] - stat[StatShadowZero];
30
31 static const char *name[StatCnt] = {};
32 name[StatMop] = "Memory accesses ";
33 name[StatMopRead] = " Including reads ";
34 name[StatMopWrite] = " writes ";
35 name[StatMop1] = " Including size 1 ";
36 name[StatMop2] = " size 2 ";
37 name[StatMop4] = " size 4 ";
38 name[StatMop8] = " size 8 ";
39 name[StatMopSame] = " Including same ";
40 name[StatMopRange] = " Including range ";
Dmitry Vyukov82dbc512013-03-20 13:21:50 +000041 name[StatMopRodata] = " Including .rodata ";
42 name[StatMopRangeRodata] = " Including .rodata range ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +000043 name[StatShadowProcessed] = "Shadow processed ";
44 name[StatShadowZero] = " Including empty ";
45 name[StatShadowNonZero] = " Including non empty ";
46 name[StatShadowSameSize] = " Including same size ";
47 name[StatShadowIntersect] = " intersect ";
48 name[StatShadowNotIntersect] = " not intersect ";
49 name[StatShadowSameThread] = " Including same thread ";
50 name[StatShadowAnotherThread] = " another thread ";
51 name[StatShadowReplace] = " Including evicted ";
52
53 name[StatFuncEnter] = "Function entries ";
54 name[StatFuncExit] = "Function exits ";
55 name[StatEvents] = "Events collected ";
56
57 name[StatThreadCreate] = "Total threads created ";
58 name[StatThreadFinish] = " threads finished ";
59 name[StatThreadReuse] = " threads reused ";
60 name[StatThreadMaxTid] = " max tid ";
61 name[StatThreadMaxAlive] = " max alive threads ";
62
63 name[StatMutexCreate] = "Mutexes created ";
64 name[StatMutexDestroy] = " destroyed ";
65 name[StatMutexLock] = " lock ";
66 name[StatMutexUnlock] = " unlock ";
67 name[StatMutexRecLock] = " recursive lock ";
68 name[StatMutexRecUnlock] = " recursive unlock ";
69 name[StatMutexReadLock] = " read lock ";
70 name[StatMutexReadUnlock] = " read unlock ";
71
72 name[StatSyncCreated] = "Sync objects created ";
73 name[StatSyncDestroyed] = " destroyed ";
74 name[StatSyncAcquire] = " acquired ";
75 name[StatSyncRelease] = " released ";
76
77 name[StatAtomic] = "Atomic operations ";
78 name[StatAtomicLoad] = " Including load ";
79 name[StatAtomicStore] = " store ";
80 name[StatAtomicExchange] = " exchange ";
81 name[StatAtomicFetchAdd] = " fetch_add ";
Dmitry Vyukov02b45d22012-11-26 09:42:56 +000082 name[StatAtomicFetchSub] = " fetch_sub ";
83 name[StatAtomicFetchAnd] = " fetch_and ";
84 name[StatAtomicFetchOr] = " fetch_or ";
85 name[StatAtomicFetchXor] = " fetch_xor ";
86 name[StatAtomicFetchNand] = " fetch_nand ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +000087 name[StatAtomicCAS] = " compare_exchange ";
88 name[StatAtomicFence] = " fence ";
89 name[StatAtomicRelaxed] = " Including relaxed ";
90 name[StatAtomicConsume] = " consume ";
91 name[StatAtomicAcquire] = " acquire ";
92 name[StatAtomicRelease] = " release ";
93 name[StatAtomicAcq_Rel] = " acq_rel ";
94 name[StatAtomicSeq_Cst] = " seq_cst ";
95 name[StatAtomic1] = " Including size 1 ";
96 name[StatAtomic2] = " size 2 ";
97 name[StatAtomic4] = " size 4 ";
98 name[StatAtomic8] = " size 8 ";
Dmitry Vyukov63da5092012-11-27 07:41:27 +000099 name[StatAtomic16] = " size 16 ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000100
101 name[StatInterceptor] = "Interceptors ";
Dmitry Vyukovf037f562012-05-31 18:03:59 +0000102 name[StatInt_longjmp] = " longjmp ";
103 name[StatInt_siglongjmp] = " siglongjmp ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000104 name[StatInt_malloc] = " malloc ";
Dmitry Vyukov07ba8ef2012-11-30 17:27:58 +0000105 name[StatInt___libc_memalign] = " __libc_memalign ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000106 name[StatInt_calloc] = " calloc ";
107 name[StatInt_realloc] = " realloc ";
108 name[StatInt_free] = " free ";
109 name[StatInt_cfree] = " cfree ";
Dmitry Vyukov423bd202013-03-20 14:04:23 +0000110 name[StatInt_malloc_usable_size] = " malloc_usable_size ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000111 name[StatInt_mmap] = " mmap ";
112 name[StatInt_mmap64] = " mmap64 ";
113 name[StatInt_munmap] = " munmap ";
114 name[StatInt_memalign] = " memalign ";
115 name[StatInt_valloc] = " valloc ";
116 name[StatInt_pvalloc] = " pvalloc ";
117 name[StatInt_posix_memalign] = " posix_memalign ";
118 name[StatInt__Znwm] = " _Znwm ";
119 name[StatInt__ZnwmRKSt9nothrow_t] = " _ZnwmRKSt9nothrow_t ";
120 name[StatInt__Znam] = " _Znam ";
121 name[StatInt__ZnamRKSt9nothrow_t] = " _ZnamRKSt9nothrow_t ";
122 name[StatInt__ZdlPv] = " _ZdlPv ";
123 name[StatInt__ZdlPvRKSt9nothrow_t] = " _ZdlPvRKSt9nothrow_t ";
124 name[StatInt__ZdaPv] = " _ZdaPv ";
125 name[StatInt__ZdaPvRKSt9nothrow_t] = " _ZdaPvRKSt9nothrow_t ";
126 name[StatInt_strlen] = " strlen ";
127 name[StatInt_memset] = " memset ";
128 name[StatInt_memcpy] = " memcpy ";
129 name[StatInt_strcmp] = " strcmp ";
130 name[StatInt_memchr] = " memchr ";
131 name[StatInt_memrchr] = " memrchr ";
132 name[StatInt_memmove] = " memmove ";
133 name[StatInt_memcmp] = " memcmp ";
134 name[StatInt_strchr] = " strchr ";
135 name[StatInt_strchrnul] = " strchrnul ";
136 name[StatInt_strrchr] = " strrchr ";
137 name[StatInt_strncmp] = " strncmp ";
138 name[StatInt_strcpy] = " strcpy ";
139 name[StatInt_strncpy] = " strncpy ";
140 name[StatInt_strstr] = " strstr ";
Dmitry Vyukov39fa68e2013-09-21 23:44:19 +0000141 name[StatInt_strdup] = " strdup ";
Dmitry Vyukovbe523662013-03-26 12:40:23 +0000142 name[StatInt_strcasecmp] = " strcasecmp ";
143 name[StatInt_strncasecmp] = " strncasecmp ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000144 name[StatInt_atexit] = " atexit ";
Dmitry Vyukovc78140f2013-10-03 14:00:46 +0000145 name[StatInt__exit] = " _exit ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000146 name[StatInt___cxa_guard_acquire] = " __cxa_guard_acquire ";
147 name[StatInt___cxa_guard_release] = " __cxa_guard_release ";
Dmitry Vyukov1ffeded2012-12-05 12:10:22 +0000148 name[StatInt___cxa_guard_abort] = " __cxa_guard_abort ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000149 name[StatInt_pthread_create] = " pthread_create ";
150 name[StatInt_pthread_join] = " pthread_join ";
151 name[StatInt_pthread_detach] = " pthread_detach ";
152 name[StatInt_pthread_mutex_init] = " pthread_mutex_init ";
153 name[StatInt_pthread_mutex_destroy] = " pthread_mutex_destroy ";
154 name[StatInt_pthread_mutex_lock] = " pthread_mutex_lock ";
155 name[StatInt_pthread_mutex_trylock] = " pthread_mutex_trylock ";
156 name[StatInt_pthread_mutex_timedlock] = " pthread_mutex_timedlock ";
157 name[StatInt_pthread_mutex_unlock] = " pthread_mutex_unlock ";
158 name[StatInt_pthread_spin_init] = " pthread_spin_init ";
159 name[StatInt_pthread_spin_destroy] = " pthread_spin_destroy ";
160 name[StatInt_pthread_spin_lock] = " pthread_spin_lock ";
161 name[StatInt_pthread_spin_trylock] = " pthread_spin_trylock ";
162 name[StatInt_pthread_spin_unlock] = " pthread_spin_unlock ";
163 name[StatInt_pthread_rwlock_init] = " pthread_rwlock_init ";
164 name[StatInt_pthread_rwlock_destroy] = " pthread_rwlock_destroy ";
165 name[StatInt_pthread_rwlock_rdlock] = " pthread_rwlock_rdlock ";
166 name[StatInt_pthread_rwlock_tryrdlock] = " pthread_rwlock_tryrdlock ";
167 name[StatInt_pthread_rwlock_timedrdlock]
168 = " pthread_rwlock_timedrdlock ";
169 name[StatInt_pthread_rwlock_wrlock] = " pthread_rwlock_wrlock ";
170 name[StatInt_pthread_rwlock_trywrlock] = " pthread_rwlock_trywrlock ";
171 name[StatInt_pthread_rwlock_timedwrlock]
172 = " pthread_rwlock_timedwrlock ";
173 name[StatInt_pthread_rwlock_unlock] = " pthread_rwlock_unlock ";
Dmitry Vyukovfae2bff2013-09-19 23:44:51 +0000174 name[StatInt_pthread_cond_init] = " pthread_cond_init ";
175 name[StatInt_pthread_cond_destroy] = " pthread_cond_destroy ";
176 name[StatInt_pthread_cond_signal] = " pthread_cond_signal ";
177 name[StatInt_pthread_cond_broadcast] = " pthread_cond_broadcast ";
178 name[StatInt_pthread_cond_wait] = " pthread_cond_wait ";
179 name[StatInt_pthread_cond_timedwait] = " pthread_cond_timedwait ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000180 name[StatInt_pthread_barrier_init] = " pthread_barrier_init ";
181 name[StatInt_pthread_barrier_destroy] = " pthread_barrier_destroy ";
182 name[StatInt_pthread_barrier_wait] = " pthread_barrier_wait ";
183 name[StatInt_pthread_once] = " pthread_once ";
Evgeniy Stepanov56d34722013-05-21 08:12:08 +0000184 name[StatInt_pthread_getschedparam] = " pthread_getschedparam ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000185 name[StatInt_sem_init] = " sem_init ";
186 name[StatInt_sem_destroy] = " sem_destroy ";
187 name[StatInt_sem_wait] = " sem_wait ";
188 name[StatInt_sem_trywait] = " sem_trywait ";
189 name[StatInt_sem_timedwait] = " sem_timedwait ";
190 name[StatInt_sem_post] = " sem_post ";
191 name[StatInt_sem_getvalue] = " sem_getvalue ";
Dmitry Vyukov61ba1b52013-01-29 09:23:09 +0000192 name[StatInt_stat] = " stat ";
193 name[StatInt___xstat] = " __xstat ";
194 name[StatInt_stat64] = " stat64 ";
195 name[StatInt___xstat64] = " __xstat64 ";
196 name[StatInt_lstat] = " lstat ";
197 name[StatInt___lxstat] = " __lxstat ";
198 name[StatInt_lstat64] = " lstat64 ";
199 name[StatInt___lxstat64] = " __lxstat64 ";
200 name[StatInt_fstat] = " fstat ";
201 name[StatInt___fxstat] = " __fxstat ";
202 name[StatInt_fstat64] = " fstat64 ";
203 name[StatInt___fxstat64] = " __fxstat64 ";
Dmitry Vyukovba3ae352012-12-07 18:30:40 +0000204 name[StatInt_open] = " open ";
Dmitry Vyukovc78839f2012-12-12 11:59:30 +0000205 name[StatInt_open64] = " open64 ";
Dmitry Vyukovba3ae352012-12-07 18:30:40 +0000206 name[StatInt_creat] = " creat ";
Dmitry Vyukovc78839f2012-12-12 11:59:30 +0000207 name[StatInt_creat64] = " creat64 ";
Dmitry Vyukovba3ae352012-12-07 18:30:40 +0000208 name[StatInt_dup] = " dup ";
209 name[StatInt_dup2] = " dup2 ";
210 name[StatInt_dup3] = " dup3 ";
Dmitry Vyukov68230a12012-12-07 19:23:59 +0000211 name[StatInt_eventfd] = " eventfd ";
Dmitry Vyukov45d43242012-12-18 12:35:31 +0000212 name[StatInt_signalfd] = " signalfd ";
213 name[StatInt_inotify_init] = " inotify_init ";
214 name[StatInt_inotify_init1] = " inotify_init1 ";
Dmitry Vyukov68230a12012-12-07 19:23:59 +0000215 name[StatInt_socket] = " socket ";
Dmitry Vyukov983518e2012-12-14 09:57:42 +0000216 name[StatInt_socketpair] = " socketpair ";
Dmitry Vyukov68230a12012-12-07 19:23:59 +0000217 name[StatInt_connect] = " connect ";
Dmitry Vyukov52c70e52013-02-04 08:06:32 +0000218 name[StatInt_bind] = " bind ";
219 name[StatInt_listen] = " listen ";
Dmitry Vyukov68230a12012-12-07 19:23:59 +0000220 name[StatInt_accept] = " accept ";
221 name[StatInt_accept4] = " accept4 ";
222 name[StatInt_epoll_create] = " epoll_create ";
223 name[StatInt_epoll_create1] = " epoll_create1 ";
Dmitry Vyukovddeb2c32012-12-07 15:32:56 +0000224 name[StatInt_close] = " close ";
Dmitry Vyukovc78839f2012-12-12 11:59:30 +0000225 name[StatInt___close] = " __close ";
Dmitry Vyukov03f22482013-02-07 15:27:45 +0000226 name[StatInt___res_iclose] = " __res_iclose ";
Dmitry Vyukovddeb2c32012-12-07 15:32:56 +0000227 name[StatInt_pipe] = " pipe ";
228 name[StatInt_pipe2] = " pipe2 ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000229 name[StatInt_read] = " read ";
Kostya Serebryanyc20b3212013-01-18 06:43:13 +0000230 name[StatInt_prctl] = " prctl ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000231 name[StatInt_pread] = " pread ";
232 name[StatInt_pread64] = " pread64 ";
233 name[StatInt_readv] = " readv ";
Evgeniy Stepanovb916e6a2013-06-24 10:43:23 +0000234 name[StatInt_preadv] = " preadv ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000235 name[StatInt_preadv64] = " preadv64 ";
236 name[StatInt_write] = " write ";
237 name[StatInt_pwrite] = " pwrite ";
238 name[StatInt_pwrite64] = " pwrite64 ";
239 name[StatInt_writev] = " writev ";
Evgeniy Stepanovb916e6a2013-06-24 10:43:23 +0000240 name[StatInt_pwritev] = " pwritev ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000241 name[StatInt_pwritev64] = " pwritev64 ";
242 name[StatInt_send] = " send ";
243 name[StatInt_sendmsg] = " sendmsg ";
244 name[StatInt_recv] = " recv ";
245 name[StatInt_recvmsg] = " recvmsg ";
246 name[StatInt_unlink] = " unlink ";
247 name[StatInt_fopen] = " fopen ";
Dmitry Vyukovc78839f2012-12-12 11:59:30 +0000248 name[StatInt_freopen] = " freopen ";
249 name[StatInt_fclose] = " fclose ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000250 name[StatInt_fread] = " fread ";
251 name[StatInt_fwrite] = " fwrite ";
Dmitry Vyukov0ebfc6f2013-03-20 14:01:10 +0000252 name[StatInt_fflush] = " fflush ";
Dmitry Vyukov5043f052013-03-21 12:50:43 +0000253 name[StatInt_abort] = " abort ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000254 name[StatInt_puts] = " puts ";
255 name[StatInt_rmdir] = " rmdir ";
256 name[StatInt_opendir] = " opendir ";
257 name[StatInt_epoll_ctl] = " epoll_ctl ";
258 name[StatInt_epoll_wait] = " epoll_wait ";
Dmitry Vyukovee8ee242012-11-15 17:40:49 +0000259 name[StatInt_poll] = " poll ";
Evgeniy Stepanove18e3f02013-08-12 13:19:53 +0000260 name[StatInt_ppoll] = " ppoll ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000261 name[StatInt_sigaction] = " sigaction ";
Dmitry Vyukov423bd202013-03-20 14:04:23 +0000262 name[StatInt_signal] = " signal ";
Dmitry Vyukovfbeab512013-07-16 11:28:04 +0000263 name[StatInt_sigsuspend] = " sigsuspend ";
Dmitry Vyukov423bd202013-03-20 14:04:23 +0000264 name[StatInt_raise] = " raise ";
265 name[StatInt_kill] = " kill ";
266 name[StatInt_pthread_kill] = " pthread_kill ";
Dmitry Vyukovaad173b2012-11-09 19:55:06 +0000267 name[StatInt_sleep] = " sleep ";
268 name[StatInt_usleep] = " usleep ";
269 name[StatInt_nanosleep] = " nanosleep ";
270 name[StatInt_gettimeofday] = " gettimeofday ";
Dmitry Vyukov4554b7a2012-12-18 14:44:44 +0000271 name[StatInt_fork] = " fork ";
Evgeniy Stepanov996c4f22013-01-18 11:17:23 +0000272 name[StatInt_vscanf] = " vscanf ";
273 name[StatInt_vsscanf] = " vsscanf ";
274 name[StatInt_vfscanf] = " vfscanf ";
275 name[StatInt_scanf] = " scanf ";
276 name[StatInt_sscanf] = " sscanf ";
277 name[StatInt_fscanf] = " fscanf ";
Evgeniy Stepanov86edb3b2013-02-12 12:02:49 +0000278 name[StatInt___isoc99_vscanf] = " vscanf ";
279 name[StatInt___isoc99_vsscanf] = " vsscanf ";
280 name[StatInt___isoc99_vfscanf] = " vfscanf ";
281 name[StatInt___isoc99_scanf] = " scanf ";
282 name[StatInt___isoc99_sscanf] = " sscanf ";
283 name[StatInt___isoc99_fscanf] = " fscanf ";
Dmitry Vyukov31c05ea2013-01-29 13:05:30 +0000284 name[StatInt_on_exit] = " on_exit ";
285 name[StatInt___cxa_atexit] = " __cxa_atexit ";
Evgeniy Stepanov9358c582013-02-19 09:19:16 +0000286 name[StatInt_localtime] = " localtime ";
287 name[StatInt_localtime_r] = " localtime_r ";
288 name[StatInt_gmtime] = " gmtime ";
289 name[StatInt_gmtime_r] = " gmtime_r ";
290 name[StatInt_ctime] = " ctime ";
291 name[StatInt_ctime_r] = " ctime_r ";
292 name[StatInt_asctime] = " asctime ";
293 name[StatInt_asctime_r] = " asctime_r ";
Evgeniy Stepanov7cbbb292013-03-14 11:34:39 +0000294 name[StatInt_frexp] = " frexp ";
295 name[StatInt_frexpf] = " frexpf ";
296 name[StatInt_frexpl] = " frexpl ";
Evgeniy Stepanove4bdda52013-04-01 14:47:21 +0000297 name[StatInt_getpwnam] = " getpwnam ";
298 name[StatInt_getpwuid] = " getpwuid ";
Evgeniy Stepanov103a63e2013-04-23 12:01:20 +0000299 name[StatInt_getgrnam] = " getgrnam ";
300 name[StatInt_getgrgid] = " getgrgid ";
Evgeniy Stepanove4bdda52013-04-01 14:47:21 +0000301 name[StatInt_getpwnam_r] = " getpwnam_r ";
302 name[StatInt_getpwuid_r] = " getpwuid_r ";
Evgeniy Stepanov103a63e2013-04-23 12:01:20 +0000303 name[StatInt_getgrnam_r] = " getgrnam_r ";
304 name[StatInt_getgrgid_r] = " getgrgid_r ";
Evgeniy Stepanove4bdda52013-04-01 14:47:21 +0000305 name[StatInt_clock_getres] = " clock_getres ";
306 name[StatInt_clock_gettime] = " clock_gettime ";
307 name[StatInt_clock_settime] = " clock_settime ";
308 name[StatInt_getitimer] = " getitimer ";
309 name[StatInt_setitimer] = " setitimer ";
Evgeniy Stepanovcc24ec92013-04-08 08:46:25 +0000310 name[StatInt_time] = " time ";
Evgeniy Stepanova1c2a552013-04-09 11:35:13 +0000311 name[StatInt_glob] = " glob ";
312 name[StatInt_glob64] = " glob64 ";
Evgeniy Stepanov897a4ae2013-04-09 14:34:59 +0000313 name[StatInt_wait] = " wait ";
314 name[StatInt_waitid] = " waitid ";
315 name[StatInt_waitpid] = " waitpid ";
316 name[StatInt_wait3] = " wait3 ";
317 name[StatInt_wait4] = " wait4 ";
Evgeniy Stepanov9530eb72013-04-23 14:05:15 +0000318 name[StatInt_inet_ntop] = " inet_ntop ";
319 name[StatInt_inet_pton] = " inet_pton ";
Evgeniy Stepanov90a65aa2013-06-24 14:03:13 +0000320 name[StatInt_inet_aton] = " inet_aton ";
Evgeniy Stepanov447ef192013-05-22 12:50:26 +0000321 name[StatInt_getaddrinfo] = " getaddrinfo ";
Evgeniy Stepanov9eedf482013-07-01 13:51:31 +0000322 name[StatInt_getnameinfo] = " getnameinfo ";
Evgeniy Stepanov9f58c5c2013-05-22 13:46:22 +0000323 name[StatInt_getsockname] = " getsockname ";
Evgeniy Stepanov0a2cc372013-05-23 11:10:23 +0000324 name[StatInt_gethostent] = " gethostent ";
325 name[StatInt_gethostbyname] = " gethostbyname ";
326 name[StatInt_gethostbyname2] = " gethostbyname2 ";
327 name[StatInt_gethostbyaddr] = " gethostbyaddr ";
328 name[StatInt_gethostent_r] = " gethostent_r ";
329 name[StatInt_gethostbyname_r] = " gethostbyname_r ";
330 name[StatInt_gethostbyname2_r] = " gethostbyname2_r ";
331 name[StatInt_gethostbyaddr_r] = " gethostbyaddr_r ";
Evgeniy Stepanovf32be422013-05-23 11:38:08 +0000332 name[StatInt_getsockopt] = " getsockopt ";
Evgeniy Stepanovc87088b2013-05-29 10:03:11 +0000333 name[StatInt_modf] = " modf ";
334 name[StatInt_modff] = " modff ";
335 name[StatInt_modfl] = " modfl ";
Evgeniy Stepanovbc33e132013-05-29 11:49:25 +0000336 name[StatInt_getpeername] = " getpeername ";
Evgeniy Stepanov745dd0d2013-06-07 13:00:47 +0000337 name[StatInt_ioctl] = " ioctl ";
Evgeniy Stepanov359d7fc2013-06-24 14:25:33 +0000338 name[StatInt_sysinfo] = " sysinfo ";
Evgeniy Stepanovb5cf98f2013-06-26 15:00:53 +0000339 name[StatInt_readdir] = " readdir ";
340 name[StatInt_readdir64] = " readdir64 ";
341 name[StatInt_readdir_r] = " readdir_r ";
342 name[StatInt_readdir64_r] = " readdir64_r ";
Evgeniy Stepanov341b9e62013-06-28 11:02:43 +0000343 name[StatInt_ptrace] = " ptrace ";
Evgeniy Stepanov3cae6042013-07-02 09:23:45 +0000344 name[StatInt_setlocale] = " setlocale ";
Evgeniy Stepanov80144892013-07-02 13:34:44 +0000345 name[StatInt_getcwd] = " getcwd ";
346 name[StatInt_get_current_dir_name] = " get_current_dir_name ";
Evgeniy Stepanovff6c9fb2013-07-04 13:19:41 +0000347 name[StatInt_strtoimax] = " strtoimax ";
348 name[StatInt_strtoumax] = " strtoumax ";
349 name[StatInt_mbstowcs] = " mbstowcs ";
350 name[StatInt_mbsrtowcs] = " mbsrtowcs ";
351 name[StatInt_mbsnrtowcs] = " mbsnrtowcs ";
352 name[StatInt_wcstombs] = " wcstombs ";
353 name[StatInt_wcsrtombs] = " wcsrtombs ";
354 name[StatInt_wcsnrtombs] = " wcsnrtombs ";
Evgeniy Stepanovea727682013-07-04 14:03:31 +0000355 name[StatInt_tcgetattr] = " tcgetattr ";
Evgeniy Stepanov12eb79d2013-07-09 09:53:37 +0000356 name[StatInt_realpath] = " realpath ";
357 name[StatInt_canonicalize_file_name] = " canonicalize_file_name ";
Evgeniy Stepanov5ec19bc2013-07-30 12:46:59 +0000358 name[StatInt_confstr] = " confstr ";
Evgeniy Stepanov84ba74c2013-08-07 09:10:16 +0000359 name[StatInt_sched_getaffinity] = " sched_getaffinity ";
Evgeniy Stepanov12049792013-08-08 11:44:05 +0000360 name[StatInt_strerror] = " strerror ";
361 name[StatInt_strerror_r] = " strerror_r ";
Evgeniy Stepanov224226c2013-08-08 13:57:15 +0000362 name[StatInt_scandir] = " scandir ";
363 name[StatInt_scandir64] = " scandir64 ";
Evgeniy Stepanovedff34b2013-08-12 11:01:40 +0000364 name[StatInt_getgroups] = " getgroups ";
Evgeniy Stepanovc5a38552013-09-24 14:38:22 +0000365 name[StatInt_wordexp] = " wordexp ";
Evgeniy Stepanov9a949a82013-09-25 14:47:43 +0000366 name[StatInt_sigwait] = " sigwait ";
367 name[StatInt_sigwaitinfo] = " sigwaitinfo ";
368 name[StatInt_sigtimedwait] = " sigtimedwait ";
369 name[StatInt_sigemptyset] = " sigemptyset ";
370 name[StatInt_sigfillset] = " sigfillset ";
371 name[StatInt_sigpending] = " sigpending ";
372 name[StatInt_sigprocmask] = " sigprocmask ";
Evgeniy Stepanov1394be12013-09-27 12:40:23 +0000373 name[StatInt_backtrace] = " backtrace ";
374 name[StatInt_backtrace_symbols] = " backtrace_symbols ";
Dmitry Vyukov4af0f212013-10-03 13:37:17 +0000375 name[StatInt_dlopen] = " dlopen ";
376 name[StatInt_dlclose] = " dlclose ";
Evgeniy Stepanov4d7297d2013-10-18 09:41:43 +0000377 name[StatInt_getmntent] = " getmntent ";
378 name[StatInt_getmntent_r] = " getmntent_r ";
Evgeniy Stepanov5cee73e2013-10-18 11:14:16 +0000379 name[StatInt_statfs] = " statfs ";
380 name[StatInt_statfs64] = " statfs64 ";
381 name[StatInt_fstatfs] = " fstatfs ";
382 name[StatInt_fstatfs64] = " fstatfs64 ";
383 name[StatInt_statvfs] = " statvfs ";
384 name[StatInt_statvfs64] = " statvfs64 ";
385 name[StatInt_fstatvfs] = " fstatvfs ";
386 name[StatInt_fstatvfs64] = " fstatvfs64 ";
Evgeniy Stepanov285d4582013-10-22 12:24:48 +0000387 name[StatInt_initgroups] = " initgroups ";
Evgeniy Stepanov369a9a62013-10-23 13:57:47 +0000388 name[StatInt_ether_ntoa] = " ether_ntoa ";
389 name[StatInt_ether_aton] = " ether_aton ";
390 name[StatInt_ether_ntoa_r] = " ether_ntoa_r ";
391 name[StatInt_ether_aton_r] = " ether_aton_r ";
392 name[StatInt_ether_ntohost] = " ether_ntohost ";
393 name[StatInt_ether_hostton] = " ether_hostton ";
394 name[StatInt_ether_line] = " ether_line ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000395
396 name[StatAnnotation] = "Dynamic annotations ";
397 name[StatAnnotateHappensBefore] = " HappensBefore ";
398 name[StatAnnotateHappensAfter] = " HappensAfter ";
399 name[StatAnnotateCondVarSignal] = " CondVarSignal ";
400 name[StatAnnotateCondVarSignalAll] = " CondVarSignalAll ";
401 name[StatAnnotateMutexIsNotPHB] = " MutexIsNotPHB ";
402 name[StatAnnotateCondVarWait] = " CondVarWait ";
403 name[StatAnnotateRWLockCreate] = " RWLockCreate ";
Dmitry Vyukov423bd202013-03-20 14:04:23 +0000404 name[StatAnnotateRWLockCreateStatic] = " StatAnnotateRWLockCreateStatic ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000405 name[StatAnnotateRWLockDestroy] = " RWLockDestroy ";
406 name[StatAnnotateRWLockAcquired] = " RWLockAcquired ";
407 name[StatAnnotateRWLockReleased] = " RWLockReleased ";
408 name[StatAnnotateTraceMemory] = " TraceMemory ";
409 name[StatAnnotateFlushState] = " FlushState ";
410 name[StatAnnotateNewMemory] = " NewMemory ";
411 name[StatAnnotateNoOp] = " NoOp ";
412 name[StatAnnotateFlushExpectedRaces] = " FlushExpectedRaces ";
413 name[StatAnnotateEnableRaceDetection] = " EnableRaceDetection ";
414 name[StatAnnotateMutexIsUsedAsCondVar] = " MutexIsUsedAsCondVar ";
415 name[StatAnnotatePCQGet] = " PCQGet ";
416 name[StatAnnotatePCQPut] = " PCQPut ";
417 name[StatAnnotatePCQDestroy] = " PCQDestroy ";
418 name[StatAnnotatePCQCreate] = " PCQCreate ";
419 name[StatAnnotateExpectRace] = " ExpectRace ";
420 name[StatAnnotateBenignRaceSized] = " BenignRaceSized ";
421 name[StatAnnotateBenignRace] = " BenignRace ";
422 name[StatAnnotateIgnoreReadsBegin] = " IgnoreReadsBegin ";
423 name[StatAnnotateIgnoreReadsEnd] = " IgnoreReadsEnd ";
424 name[StatAnnotateIgnoreWritesBegin] = " IgnoreWritesBegin ";
425 name[StatAnnotateIgnoreWritesEnd] = " IgnoreWritesEnd ";
Dmitry Vyukove1ddbf92013-10-10 15:58:12 +0000426 name[StatAnnotateIgnoreSyncBegin] = " IgnoreSyncBegin ";
427 name[StatAnnotateIgnoreSyncEnd] = " IgnoreSyncEnd ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000428 name[StatAnnotatePublishMemoryRange] = " PublishMemoryRange ";
429 name[StatAnnotateUnpublishMemoryRange] = " UnpublishMemoryRange ";
430 name[StatAnnotateThreadName] = " ThreadName ";
431
432 name[StatMtxTotal] = "Contentionz ";
433 name[StatMtxTrace] = " Trace ";
434 name[StatMtxThreads] = " Threads ";
435 name[StatMtxReport] = " Report ";
436 name[StatMtxSyncVar] = " SyncVar ";
437 name[StatMtxSyncTab] = " SyncTab ";
438 name[StatMtxSlab] = " Slab ";
439 name[StatMtxAtExit] = " Atexit ";
440 name[StatMtxAnnotations] = " Annotations ";
Dmitry Vyukovad9da372012-12-06 12:16:15 +0000441 name[StatMtxMBlock] = " MBlock ";
Dmitry Vyukovf4e4f932012-12-21 11:30:14 +0000442 name[StatMtxJavaMBlock] = " JavaMBlock ";
Dmitry Vyukov52c70e52013-02-04 08:06:32 +0000443 name[StatMtxFD] = " FD ";
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000444
Alexey Samsonovb1fe3022012-11-02 12:17:51 +0000445 Printf("Statistics:\n");
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000446 for (int i = 0; i < StatCnt; i++)
Alexey Samsonovb1fe3022012-11-02 12:17:51 +0000447 Printf("%s: %zu\n", name[i], (uptr)stat[i]);
Kostya Serebryany7ac41482012-05-10 13:48:04 +0000448}
449
450} // namespace __tsan