tsan_stat.cc revision e236dbb5e558b174609d2d13e80685d488c129d8
1//===-- tsan_stat.cc ------------------------------------------------------===//
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#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                 ";
41  name[StatMopRodata]                    = "  Including .rodata               ";
42  name[StatMopRangeRodata]               = "  Including .rodata range         ";
43  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             ";
82  name[StatAtomicFetchSub]               = "            fetch_sub             ";
83  name[StatAtomicFetchAnd]               = "            fetch_and             ";
84  name[StatAtomicFetchOr]                = "            fetch_or              ";
85  name[StatAtomicFetchXor]               = "            fetch_xor             ";
86  name[StatAtomicFetchNand]              = "            fetch_nand            ";
87  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                ";
99  name[StatAtomic16]                     = "            size 16               ";
100
101  name[StatInterceptor]                  = "Interceptors                      ";
102  name[StatInt_longjmp]                  = "  longjmp                         ";
103  name[StatInt_siglongjmp]               = "  siglongjmp                      ";
104  name[StatInt_malloc]                   = "  malloc                          ";
105  name[StatInt___libc_memalign]          = "  __libc_memalign                 ";
106  name[StatInt_calloc]                   = "  calloc                          ";
107  name[StatInt_realloc]                  = "  realloc                         ";
108  name[StatInt_free]                     = "  free                            ";
109  name[StatInt_cfree]                    = "  cfree                           ";
110  name[StatInt_malloc_usable_size]       = "  malloc_usable_size              ";
111  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                          ";
141  name[StatInt_strdup]                   = "  strdup                          ";
142  name[StatInt_strcasecmp]               = "  strcasecmp                      ";
143  name[StatInt_strncasecmp]              = "  strncasecmp                     ";
144  name[StatInt_atexit]                   = "  atexit                          ";
145  name[StatInt__exit]                    = "  _exit                           ";
146  name[StatInt___cxa_guard_acquire]      = "  __cxa_guard_acquire             ";
147  name[StatInt___cxa_guard_release]      = "  __cxa_guard_release             ";
148  name[StatInt___cxa_guard_abort]        = "  __cxa_guard_abort               ";
149  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           ";
174  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          ";
180  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                    ";
184  name[StatInt_pthread_getschedparam]    = "  pthread_getschedparam           ";
185  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                    ";
192  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                      ";
204  name[StatInt_open]                     = "  open                            ";
205  name[StatInt_open64]                   = "  open64                          ";
206  name[StatInt_creat]                    = "  creat                           ";
207  name[StatInt_creat64]                  = "  creat64                         ";
208  name[StatInt_dup]                      = "  dup                             ";
209  name[StatInt_dup2]                     = "  dup2                            ";
210  name[StatInt_dup3]                     = "  dup3                            ";
211  name[StatInt_eventfd]                  = "  eventfd                         ";
212  name[StatInt_signalfd]                 = "  signalfd                        ";
213  name[StatInt_inotify_init]             = "  inotify_init                    ";
214  name[StatInt_inotify_init1]            = "  inotify_init1                   ";
215  name[StatInt_socket]                   = "  socket                          ";
216  name[StatInt_socketpair]               = "  socketpair                      ";
217  name[StatInt_connect]                  = "  connect                         ";
218  name[StatInt_bind]                     = "  bind                            ";
219  name[StatInt_listen]                   = "  listen                          ";
220  name[StatInt_accept]                   = "  accept                          ";
221  name[StatInt_accept4]                  = "  accept4                         ";
222  name[StatInt_epoll_create]             = "  epoll_create                    ";
223  name[StatInt_epoll_create1]            = "  epoll_create1                   ";
224  name[StatInt_close]                    = "  close                           ";
225  name[StatInt___close]                  = "  __close                         ";
226  name[StatInt___res_iclose]             = "  __res_iclose                    ";
227  name[StatInt_pipe]                     = "  pipe                            ";
228  name[StatInt_pipe2]                    = "  pipe2                           ";
229  name[StatInt_read]                     = "  read                            ";
230  name[StatInt_prctl]                    = "  prctl                           ";
231  name[StatInt_pread]                    = "  pread                           ";
232  name[StatInt_pread64]                  = "  pread64                         ";
233  name[StatInt_readv]                    = "  readv                           ";
234  name[StatInt_preadv]                   = "  preadv                          ";
235  name[StatInt_preadv64]                 = "  preadv64                        ";
236  name[StatInt_write]                    = "  write                           ";
237  name[StatInt_pwrite]                   = "  pwrite                          ";
238  name[StatInt_pwrite64]                 = "  pwrite64                        ";
239  name[StatInt_writev]                   = "  writev                          ";
240  name[StatInt_pwritev]                  = "  pwritev                         ";
241  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                           ";
248  name[StatInt_freopen]                  = "  freopen                         ";
249  name[StatInt_fclose]                   = "  fclose                          ";
250  name[StatInt_fread]                    = "  fread                           ";
251  name[StatInt_fwrite]                   = "  fwrite                          ";
252  name[StatInt_fflush]                   = "  fflush                          ";
253  name[StatInt_abort]                    = "  abort                           ";
254  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                      ";
259  name[StatInt_poll]                     = "  poll                            ";
260  name[StatInt_ppoll]                    = "  ppoll                           ";
261  name[StatInt_sigaction]                = "  sigaction                       ";
262  name[StatInt_signal]                   = "  signal                          ";
263  name[StatInt_sigsuspend]               = "  sigsuspend                      ";
264  name[StatInt_raise]                    = "  raise                           ";
265  name[StatInt_kill]                     = "  kill                            ";
266  name[StatInt_pthread_kill]             = "  pthread_kill                    ";
267  name[StatInt_sleep]                    = "  sleep                           ";
268  name[StatInt_usleep]                   = "  usleep                          ";
269  name[StatInt_nanosleep]                = "  nanosleep                       ";
270  name[StatInt_gettimeofday]             = "  gettimeofday                    ";
271  name[StatInt_fork]                     = "  fork                            ";
272  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                          ";
278  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                          ";
284  name[StatInt_on_exit]                  = "  on_exit                         ";
285  name[StatInt___cxa_atexit]             = "  __cxa_atexit                    ";
286  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                       ";
294  name[StatInt_frexp]                    = "  frexp                           ";
295  name[StatInt_frexpf]                   = "  frexpf                          ";
296  name[StatInt_frexpl]                   = "  frexpl                          ";
297  name[StatInt_getpwnam]                 = "  getpwnam                        ";
298  name[StatInt_getpwuid]                 = "  getpwuid                        ";
299  name[StatInt_getgrnam]                 = "  getgrnam                        ";
300  name[StatInt_getgrgid]                 = "  getgrgid                        ";
301  name[StatInt_getpwnam_r]               = "  getpwnam_r                      ";
302  name[StatInt_getpwuid_r]               = "  getpwuid_r                      ";
303  name[StatInt_getgrnam_r]               = "  getgrnam_r                      ";
304  name[StatInt_getgrgid_r]               = "  getgrgid_r                      ";
305  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                       ";
310  name[StatInt_time]                     = "  time                            ";
311  name[StatInt_glob]                     = "  glob                            ";
312  name[StatInt_glob64]                   = "  glob64                          ";
313  name[StatInt_wait]                     = "  wait                            ";
314  name[StatInt_waitid]                   = "  waitid                          ";
315  name[StatInt_waitpid]                  = "  waitpid                         ";
316  name[StatInt_wait3]                    = "  wait3                           ";
317  name[StatInt_wait4]                    = "  wait4                           ";
318  name[StatInt_inet_ntop]                = "  inet_ntop                       ";
319  name[StatInt_inet_pton]                = "  inet_pton                       ";
320  name[StatInt_inet_aton]                = "  inet_aton                       ";
321  name[StatInt_getaddrinfo]              = "  getaddrinfo                     ";
322  name[StatInt_getnameinfo]              = "  getnameinfo                     ";
323  name[StatInt_getsockname]              = "  getsockname                     ";
324  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                 ";
332  name[StatInt_getsockopt]               = "  getsockopt                      ";
333  name[StatInt_modf]                     = "  modf                            ";
334  name[StatInt_modff]                    = "  modff                           ";
335  name[StatInt_modfl]                    = "  modfl                           ";
336  name[StatInt_getpeername]              = "  getpeername                     ";
337  name[StatInt_ioctl]                    = "  ioctl                           ";
338  name[StatInt_sysinfo]                  = "  sysinfo                         ";
339  name[StatInt_readdir]                  = "  readdir                         ";
340  name[StatInt_readdir64]                = "  readdir64                       ";
341  name[StatInt_readdir_r]                = "  readdir_r                       ";
342  name[StatInt_readdir64_r]              = "  readdir64_r                     ";
343  name[StatInt_ptrace]                   = "  ptrace                          ";
344  name[StatInt_setlocale]                = "  setlocale                       ";
345  name[StatInt_getcwd]                   = "  getcwd                          ";
346  name[StatInt_get_current_dir_name]     = "  get_current_dir_name            ";
347  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                      ";
355  name[StatInt_tcgetattr]                = "  tcgetattr                       ";
356  name[StatInt_realpath]                 = "  realpath                        ";
357  name[StatInt_canonicalize_file_name]   = "  canonicalize_file_name          ";
358  name[StatInt_confstr]                  = "  confstr                         ";
359  name[StatInt_sched_getaffinity]        = "  sched_getaffinity               ";
360  name[StatInt_strerror]                 = "  strerror                        ";
361  name[StatInt_strerror_r]               = "  strerror_r                      ";
362  name[StatInt_scandir]                  = "  scandir                         ";
363  name[StatInt_scandir64]                = "  scandir64                       ";
364  name[StatInt_getgroups]                = "  getgroups                       ";
365  name[StatInt_wordexp]                  = "  wordexp                         ";
366  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                     ";
373  name[StatInt_backtrace]                = "  backtrace                       ";
374  name[StatInt_backtrace_symbols]        = "  backtrace_symbols               ";
375  name[StatInt_dlopen]                   = "  dlopen                          ";
376  name[StatInt_dlclose]                  = "  dlclose                         ";
377  name[StatInt_getmntent]                = "  getmntent                       ";
378  name[StatInt_getmntent_r]              = "  getmntent_r                     ";
379  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                      ";
387  name[StatInt_initgroups]               = "  initgroups                      ";
388  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                      ";
395  name[StatInt_shmctl]                   = "  shmctl                          ";
396  name[StatInt_random_r]                 = "  random_r                        ";
397
398  name[StatInt_pthread_attr_getdetachstate]  = "  pthread_addr_getdetachstate     ";  // NOLINT
399  name[StatInt_pthread_attr_getguardsize]    = "  pthread_addr_getguardsize       ";  // NOLINT
400  name[StatInt_pthread_attr_getschedparam]   = "  pthread_addr_getschedparam      ";  // NOLINT
401  name[StatInt_pthread_attr_getschedpolicy]  = "  pthread_addr_getschedpolicy     ";  // NOLINT
402  name[StatInt_pthread_attr_getinheritsched] = "  pthread_addr_getinheritsched    ";  // NOLINT
403  name[StatInt_pthread_attr_getscope]        = "  pthread_addr_getscope           ";  // NOLINT
404  name[StatInt_pthread_attr_getstackaddr]    = "  pthread_addr_getstackaddr       ";  // NOLINT
405  name[StatInt_pthread_attr_getstacksize]    = "  pthread_addr_getstacksize       ";  // NOLINT
406  name[StatInt_pthread_attr_getstack]        = "  pthread_addr_getstack           ";  // NOLINT
407  name[StatInt_pthread_attr_getaffinity_np]  = "  pthread_addr_getaffinity_np     ";  // NOLINT
408
409  name[StatAnnotation]                   = "Dynamic annotations               ";
410  name[StatAnnotateHappensBefore]        = "  HappensBefore                   ";
411  name[StatAnnotateHappensAfter]         = "  HappensAfter                    ";
412  name[StatAnnotateCondVarSignal]        = "  CondVarSignal                   ";
413  name[StatAnnotateCondVarSignalAll]     = "  CondVarSignalAll                ";
414  name[StatAnnotateMutexIsNotPHB]        = "  MutexIsNotPHB                   ";
415  name[StatAnnotateCondVarWait]          = "  CondVarWait                     ";
416  name[StatAnnotateRWLockCreate]         = "  RWLockCreate                    ";
417  name[StatAnnotateRWLockCreateStatic]   = "  StatAnnotateRWLockCreateStatic  ";
418  name[StatAnnotateRWLockDestroy]        = "  RWLockDestroy                   ";
419  name[StatAnnotateRWLockAcquired]       = "  RWLockAcquired                  ";
420  name[StatAnnotateRWLockReleased]       = "  RWLockReleased                  ";
421  name[StatAnnotateTraceMemory]          = "  TraceMemory                     ";
422  name[StatAnnotateFlushState]           = "  FlushState                      ";
423  name[StatAnnotateNewMemory]            = "  NewMemory                       ";
424  name[StatAnnotateNoOp]                 = "  NoOp                            ";
425  name[StatAnnotateFlushExpectedRaces]   = "  FlushExpectedRaces              ";
426  name[StatAnnotateEnableRaceDetection]  = "  EnableRaceDetection             ";
427  name[StatAnnotateMutexIsUsedAsCondVar] = "  MutexIsUsedAsCondVar            ";
428  name[StatAnnotatePCQGet]               = "  PCQGet                          ";
429  name[StatAnnotatePCQPut]               = "  PCQPut                          ";
430  name[StatAnnotatePCQDestroy]           = "  PCQDestroy                      ";
431  name[StatAnnotatePCQCreate]            = "  PCQCreate                       ";
432  name[StatAnnotateExpectRace]           = "  ExpectRace                      ";
433  name[StatAnnotateBenignRaceSized]      = "  BenignRaceSized                 ";
434  name[StatAnnotateBenignRace]           = "  BenignRace                      ";
435  name[StatAnnotateIgnoreReadsBegin]     = "  IgnoreReadsBegin                ";
436  name[StatAnnotateIgnoreReadsEnd]       = "  IgnoreReadsEnd                  ";
437  name[StatAnnotateIgnoreWritesBegin]    = "  IgnoreWritesBegin               ";
438  name[StatAnnotateIgnoreWritesEnd]      = "  IgnoreWritesEnd                 ";
439  name[StatAnnotateIgnoreSyncBegin]      = "  IgnoreSyncBegin                 ";
440  name[StatAnnotateIgnoreSyncEnd]        = "  IgnoreSyncEnd                   ";
441  name[StatAnnotatePublishMemoryRange]   = "  PublishMemoryRange              ";
442  name[StatAnnotateUnpublishMemoryRange] = "  UnpublishMemoryRange            ";
443  name[StatAnnotateThreadName]           = "  ThreadName                      ";
444
445  name[StatMtxTotal]                     = "Contentionz                       ";
446  name[StatMtxTrace]                     = "  Trace                           ";
447  name[StatMtxThreads]                   = "  Threads                         ";
448  name[StatMtxReport]                    = "  Report                          ";
449  name[StatMtxSyncVar]                   = "  SyncVar                         ";
450  name[StatMtxSyncTab]                   = "  SyncTab                         ";
451  name[StatMtxSlab]                      = "  Slab                            ";
452  name[StatMtxAtExit]                    = "  Atexit                          ";
453  name[StatMtxAnnotations]               = "  Annotations                     ";
454  name[StatMtxMBlock]                    = "  MBlock                          ";
455  name[StatMtxJavaMBlock]                = "  JavaMBlock                      ";
456  name[StatMtxFD]                        = "  FD                              ";
457
458  Printf("Statistics:\n");
459  for (int i = 0; i < StatCnt; i++)
460    Printf("%s: %zu\n", name[i], (uptr)stat[i]);
461}
462
463}  // namespace __tsan
464