Home | History | Annotate | Download | only in rtl
      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 
     16 namespace __tsan {
     17 
     18 void 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 
     25 void 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_strcasecmp]               = "  strcasecmp                      ";
    142   name[StatInt_strncasecmp]              = "  strncasecmp                     ";
    143   name[StatInt_atexit]                   = "  atexit                          ";
    144   name[StatInt___cxa_guard_acquire]      = "  __cxa_guard_acquire             ";
    145   name[StatInt___cxa_guard_release]      = "  __cxa_guard_release             ";
    146   name[StatInt___cxa_guard_abort]        = "  __cxa_guard_abort               ";
    147   name[StatInt_pthread_create]           = "  pthread_create                  ";
    148   name[StatInt_pthread_join]             = "  pthread_join                    ";
    149   name[StatInt_pthread_detach]           = "  pthread_detach                  ";
    150   name[StatInt_pthread_mutex_init]       = "  pthread_mutex_init              ";
    151   name[StatInt_pthread_mutex_destroy]    = "  pthread_mutex_destroy           ";
    152   name[StatInt_pthread_mutex_lock]       = "  pthread_mutex_lock              ";
    153   name[StatInt_pthread_mutex_trylock]    = "  pthread_mutex_trylock           ";
    154   name[StatInt_pthread_mutex_timedlock]  = "  pthread_mutex_timedlock         ";
    155   name[StatInt_pthread_mutex_unlock]     = "  pthread_mutex_unlock            ";
    156   name[StatInt_pthread_spin_init]        = "  pthread_spin_init               ";
    157   name[StatInt_pthread_spin_destroy]     = "  pthread_spin_destroy            ";
    158   name[StatInt_pthread_spin_lock]        = "  pthread_spin_lock               ";
    159   name[StatInt_pthread_spin_trylock]     = "  pthread_spin_trylock            ";
    160   name[StatInt_pthread_spin_unlock]      = "  pthread_spin_unlock             ";
    161   name[StatInt_pthread_rwlock_init]      = "  pthread_rwlock_init             ";
    162   name[StatInt_pthread_rwlock_destroy]   = "  pthread_rwlock_destroy          ";
    163   name[StatInt_pthread_rwlock_rdlock]    = "  pthread_rwlock_rdlock           ";
    164   name[StatInt_pthread_rwlock_tryrdlock] = "  pthread_rwlock_tryrdlock        ";
    165   name[StatInt_pthread_rwlock_timedrdlock]
    166                                          = "  pthread_rwlock_timedrdlock      ";
    167   name[StatInt_pthread_rwlock_wrlock]    = "  pthread_rwlock_wrlock           ";
    168   name[StatInt_pthread_rwlock_trywrlock] = "  pthread_rwlock_trywrlock        ";
    169   name[StatInt_pthread_rwlock_timedwrlock]
    170                                          = "  pthread_rwlock_timedwrlock      ";
    171   name[StatInt_pthread_rwlock_unlock]    = "  pthread_rwlock_unlock           ";
    172   name[StatInt_pthread_cond_init]        = "  pthread_cond_init               ";
    173   name[StatInt_pthread_cond_destroy]     = "  pthread_cond_destroy            ";
    174   name[StatInt_pthread_cond_signal]      = "  pthread_cond_signal             ";
    175   name[StatInt_pthread_cond_broadcast]   = "  pthread_cond_broadcast          ";
    176   name[StatInt_pthread_cond_wait]        = "  pthread_cond_wait               ";
    177   name[StatInt_pthread_cond_timedwait]   = "  pthread_cond_timedwait          ";
    178   name[StatInt_pthread_barrier_init]     = "  pthread_barrier_init            ";
    179   name[StatInt_pthread_barrier_destroy]  = "  pthread_barrier_destroy         ";
    180   name[StatInt_pthread_barrier_wait]     = "  pthread_barrier_wait            ";
    181   name[StatInt_pthread_once]             = "  pthread_once                    ";
    182   name[StatInt_pthread_getschedparam]    = "  pthread_getschedparam           ";
    183   name[StatInt_sem_init]                 = "  sem_init                        ";
    184   name[StatInt_sem_destroy]              = "  sem_destroy                     ";
    185   name[StatInt_sem_wait]                 = "  sem_wait                        ";
    186   name[StatInt_sem_trywait]              = "  sem_trywait                     ";
    187   name[StatInt_sem_timedwait]            = "  sem_timedwait                   ";
    188   name[StatInt_sem_post]                 = "  sem_post                        ";
    189   name[StatInt_sem_getvalue]             = "  sem_getvalue                    ";
    190   name[StatInt_stat]                     = "  stat                            ";
    191   name[StatInt___xstat]                  = "  __xstat                         ";
    192   name[StatInt_stat64]                   = "  stat64                          ";
    193   name[StatInt___xstat64]                = "  __xstat64                       ";
    194   name[StatInt_lstat]                    = "  lstat                           ";
    195   name[StatInt___lxstat]                 = "  __lxstat                        ";
    196   name[StatInt_lstat64]                  = "  lstat64                         ";
    197   name[StatInt___lxstat64]               = "  __lxstat64                      ";
    198   name[StatInt_fstat]                    = "  fstat                           ";
    199   name[StatInt___fxstat]                 = "  __fxstat                        ";
    200   name[StatInt_fstat64]                  = "  fstat64                         ";
    201   name[StatInt___fxstat64]               = "  __fxstat64                      ";
    202   name[StatInt_open]                     = "  open                            ";
    203   name[StatInt_open64]                   = "  open64                          ";
    204   name[StatInt_creat]                    = "  creat                           ";
    205   name[StatInt_creat64]                  = "  creat64                         ";
    206   name[StatInt_dup]                      = "  dup                             ";
    207   name[StatInt_dup2]                     = "  dup2                            ";
    208   name[StatInt_dup3]                     = "  dup3                            ";
    209   name[StatInt_eventfd]                  = "  eventfd                         ";
    210   name[StatInt_signalfd]                 = "  signalfd                        ";
    211   name[StatInt_inotify_init]             = "  inotify_init                    ";
    212   name[StatInt_inotify_init1]            = "  inotify_init1                   ";
    213   name[StatInt_socket]                   = "  socket                          ";
    214   name[StatInt_socketpair]               = "  socketpair                      ";
    215   name[StatInt_connect]                  = "  connect                         ";
    216   name[StatInt_bind]                     = "  bind                            ";
    217   name[StatInt_listen]                   = "  listen                          ";
    218   name[StatInt_accept]                   = "  accept                          ";
    219   name[StatInt_accept4]                  = "  accept4                         ";
    220   name[StatInt_epoll_create]             = "  epoll_create                    ";
    221   name[StatInt_epoll_create1]            = "  epoll_create1                   ";
    222   name[StatInt_close]                    = "  close                           ";
    223   name[StatInt___close]                  = "  __close                         ";
    224   name[StatInt___res_iclose]             = "  __res_iclose                    ";
    225   name[StatInt_pipe]                     = "  pipe                            ";
    226   name[StatInt_pipe2]                    = "  pipe2                           ";
    227   name[StatInt_read]                     = "  read                            ";
    228   name[StatInt_prctl]                    = "  prctl                           ";
    229   name[StatInt_pread]                    = "  pread                           ";
    230   name[StatInt_pread64]                  = "  pread64                         ";
    231   name[StatInt_readv]                    = "  readv                           ";
    232   name[StatInt_preadv]                   = "  preadv                          ";
    233   name[StatInt_preadv64]                 = "  preadv64                        ";
    234   name[StatInt_write]                    = "  write                           ";
    235   name[StatInt_pwrite]                   = "  pwrite                          ";
    236   name[StatInt_pwrite64]                 = "  pwrite64                        ";
    237   name[StatInt_writev]                   = "  writev                          ";
    238   name[StatInt_pwritev]                  = "  pwritev                         ";
    239   name[StatInt_pwritev64]                = "  pwritev64                       ";
    240   name[StatInt_send]                     = "  send                            ";
    241   name[StatInt_sendmsg]                  = "  sendmsg                         ";
    242   name[StatInt_recv]                     = "  recv                            ";
    243   name[StatInt_recvmsg]                  = "  recvmsg                         ";
    244   name[StatInt_unlink]                   = "  unlink                          ";
    245   name[StatInt_fopen]                    = "  fopen                           ";
    246   name[StatInt_freopen]                  = "  freopen                         ";
    247   name[StatInt_fclose]                   = "  fclose                          ";
    248   name[StatInt_fread]                    = "  fread                           ";
    249   name[StatInt_fwrite]                   = "  fwrite                          ";
    250   name[StatInt_fflush]                   = "  fflush                          ";
    251   name[StatInt_abort]                    = "  abort                           ";
    252   name[StatInt_puts]                     = "  puts                            ";
    253   name[StatInt_rmdir]                    = "  rmdir                           ";
    254   name[StatInt_opendir]                  = "  opendir                         ";
    255   name[StatInt_epoll_ctl]                = "  epoll_ctl                       ";
    256   name[StatInt_epoll_wait]               = "  epoll_wait                      ";
    257   name[StatInt_poll]                     = "  poll                            ";
    258   name[StatInt_sigaction]                = "  sigaction                       ";
    259   name[StatInt_signal]                   = "  signal                          ";
    260   name[StatInt_sigsuspend]               = "  sigsuspend                      ";
    261   name[StatInt_raise]                    = "  raise                           ";
    262   name[StatInt_kill]                     = "  kill                            ";
    263   name[StatInt_pthread_kill]             = "  pthread_kill                    ";
    264   name[StatInt_sleep]                    = "  sleep                           ";
    265   name[StatInt_usleep]                   = "  usleep                          ";
    266   name[StatInt_nanosleep]                = "  nanosleep                       ";
    267   name[StatInt_gettimeofday]             = "  gettimeofday                    ";
    268   name[StatInt_fork]                     = "  fork                            ";
    269   name[StatInt_vscanf]                   = "  vscanf                          ";
    270   name[StatInt_vsscanf]                  = "  vsscanf                         ";
    271   name[StatInt_vfscanf]                  = "  vfscanf                         ";
    272   name[StatInt_scanf]                    = "  scanf                           ";
    273   name[StatInt_sscanf]                   = "  sscanf                          ";
    274   name[StatInt_fscanf]                   = "  fscanf                          ";
    275   name[StatInt___isoc99_vscanf]          = "  vscanf                          ";
    276   name[StatInt___isoc99_vsscanf]         = "  vsscanf                         ";
    277   name[StatInt___isoc99_vfscanf]         = "  vfscanf                         ";
    278   name[StatInt___isoc99_scanf]           = "  scanf                           ";
    279   name[StatInt___isoc99_sscanf]          = "  sscanf                          ";
    280   name[StatInt___isoc99_fscanf]          = "  fscanf                          ";
    281   name[StatInt_on_exit]                  = "  on_exit                         ";
    282   name[StatInt___cxa_atexit]             = "  __cxa_atexit                    ";
    283   name[StatInt_localtime]                = "  localtime                       ";
    284   name[StatInt_localtime_r]              = "  localtime_r                     ";
    285   name[StatInt_gmtime]                   = "  gmtime                          ";
    286   name[StatInt_gmtime_r]                 = "  gmtime_r                        ";
    287   name[StatInt_ctime]                    = "  ctime                           ";
    288   name[StatInt_ctime_r]                  = "  ctime_r                         ";
    289   name[StatInt_asctime]                  = "  asctime                         ";
    290   name[StatInt_asctime_r]                = "  asctime_r                       ";
    291   name[StatInt_frexp]                    = "  frexp                           ";
    292   name[StatInt_frexpf]                   = "  frexpf                          ";
    293   name[StatInt_frexpl]                   = "  frexpl                          ";
    294   name[StatInt_getpwnam]                 = "  getpwnam                        ";
    295   name[StatInt_getpwuid]                 = "  getpwuid                        ";
    296   name[StatInt_getgrnam]                 = "  getgrnam                        ";
    297   name[StatInt_getgrgid]                 = "  getgrgid                        ";
    298   name[StatInt_getpwnam_r]               = "  getpwnam_r                      ";
    299   name[StatInt_getpwuid_r]               = "  getpwuid_r                      ";
    300   name[StatInt_getgrnam_r]               = "  getgrnam_r                      ";
    301   name[StatInt_getgrgid_r]               = "  getgrgid_r                      ";
    302   name[StatInt_clock_getres]             = "  clock_getres                    ";
    303   name[StatInt_clock_gettime]            = "  clock_gettime                   ";
    304   name[StatInt_clock_settime]            = "  clock_settime                   ";
    305   name[StatInt_getitimer]                = "  getitimer                       ";
    306   name[StatInt_setitimer]                = "  setitimer                       ";
    307   name[StatInt_time]                     = "  time                            ";
    308   name[StatInt_glob]                     = "  glob                            ";
    309   name[StatInt_glob64]                   = "  glob64                          ";
    310   name[StatInt_wait]                     = "  wait                            ";
    311   name[StatInt_waitid]                   = "  waitid                          ";
    312   name[StatInt_waitpid]                  = "  waitpid                         ";
    313   name[StatInt_wait3]                    = "  wait3                           ";
    314   name[StatInt_wait4]                    = "  wait4                           ";
    315   name[StatInt_inet_ntop]                = "  inet_ntop                       ";
    316   name[StatInt_inet_pton]                = "  inet_pton                       ";
    317   name[StatInt_inet_aton]                = "  inet_aton                       ";
    318   name[StatInt_getaddrinfo]              = "  getaddrinfo                     ";
    319   name[StatInt_getnameinfo]              = "  getnameinfo                     ";
    320   name[StatInt_getsockname]              = "  getsockname                     ";
    321   name[StatInt_gethostent]               = "  gethostent                      ";
    322   name[StatInt_gethostbyname]            = "  gethostbyname                   ";
    323   name[StatInt_gethostbyname2]           = "  gethostbyname2                  ";
    324   name[StatInt_gethostbyaddr]            = "  gethostbyaddr                   ";
    325   name[StatInt_gethostent_r]             = "  gethostent_r                    ";
    326   name[StatInt_gethostbyname_r]          = "  gethostbyname_r                 ";
    327   name[StatInt_gethostbyname2_r]         = "  gethostbyname2_r                ";
    328   name[StatInt_gethostbyaddr_r]          = "  gethostbyaddr_r                 ";
    329   name[StatInt_getsockopt]               = "  getsockopt                      ";
    330   name[StatInt_modf]                     = "  modf                            ";
    331   name[StatInt_modff]                    = "  modff                           ";
    332   name[StatInt_modfl]                    = "  modfl                           ";
    333   name[StatInt_getpeername]              = "  getpeername                     ";
    334   name[StatInt_ioctl]                    = "  ioctl                           ";
    335   name[StatInt_sysinfo]                  = "  sysinfo                         ";
    336   name[StatInt_readdir]                  = "  readdir                         ";
    337   name[StatInt_readdir64]                = "  readdir64                       ";
    338   name[StatInt_readdir_r]                = "  readdir_r                       ";
    339   name[StatInt_readdir64_r]              = "  readdir64_r                     ";
    340   name[StatInt_ptrace]                   = "  ptrace                          ";
    341   name[StatInt_setlocale]                = "  setlocale                       ";
    342   name[StatInt_getcwd]                   = "  getcwd                          ";
    343   name[StatInt_get_current_dir_name]     = "  get_current_dir_name            ";
    344   name[StatInt_strtoimax]                = "  strtoimax                       ";
    345   name[StatInt_strtoumax]                = "  strtoumax                       ";
    346   name[StatInt_mbstowcs]                 = "  mbstowcs                        ";
    347   name[StatInt_mbsrtowcs]                = "  mbsrtowcs                       ";
    348   name[StatInt_mbsnrtowcs]               = "  mbsnrtowcs                      ";
    349   name[StatInt_wcstombs]                 = "  wcstombs                        ";
    350   name[StatInt_wcsrtombs]                = "  wcsrtombs                       ";
    351   name[StatInt_wcsnrtombs]               = "  wcsnrtombs                      ";
    352   name[StatInt_tcgetattr]                = "  tcgetattr                       ";
    353   name[StatInt_realpath]                 = "  realpath                        ";
    354   name[StatInt_canonicalize_file_name]   = "  canonicalize_file_name          ";
    355   name[StatInt_confstr]                  = "  confstr                         ";
    356   name[StatInt_sched_getaffinity]        = "  sched_getaffinity               ";
    357 
    358   name[StatAnnotation]                   = "Dynamic annotations               ";
    359   name[StatAnnotateHappensBefore]        = "  HappensBefore                   ";
    360   name[StatAnnotateHappensAfter]         = "  HappensAfter                    ";
    361   name[StatAnnotateCondVarSignal]        = "  CondVarSignal                   ";
    362   name[StatAnnotateCondVarSignalAll]     = "  CondVarSignalAll                ";
    363   name[StatAnnotateMutexIsNotPHB]        = "  MutexIsNotPHB                   ";
    364   name[StatAnnotateCondVarWait]          = "  CondVarWait                     ";
    365   name[StatAnnotateRWLockCreate]         = "  RWLockCreate                    ";
    366   name[StatAnnotateRWLockCreateStatic]   = "  StatAnnotateRWLockCreateStatic  ";
    367   name[StatAnnotateRWLockDestroy]        = "  RWLockDestroy                   ";
    368   name[StatAnnotateRWLockAcquired]       = "  RWLockAcquired                  ";
    369   name[StatAnnotateRWLockReleased]       = "  RWLockReleased                  ";
    370   name[StatAnnotateTraceMemory]          = "  TraceMemory                     ";
    371   name[StatAnnotateFlushState]           = "  FlushState                      ";
    372   name[StatAnnotateNewMemory]            = "  NewMemory                       ";
    373   name[StatAnnotateNoOp]                 = "  NoOp                            ";
    374   name[StatAnnotateFlushExpectedRaces]   = "  FlushExpectedRaces              ";
    375   name[StatAnnotateEnableRaceDetection]  = "  EnableRaceDetection             ";
    376   name[StatAnnotateMutexIsUsedAsCondVar] = "  MutexIsUsedAsCondVar            ";
    377   name[StatAnnotatePCQGet]               = "  PCQGet                          ";
    378   name[StatAnnotatePCQPut]               = "  PCQPut                          ";
    379   name[StatAnnotatePCQDestroy]           = "  PCQDestroy                      ";
    380   name[StatAnnotatePCQCreate]            = "  PCQCreate                       ";
    381   name[StatAnnotateExpectRace]           = "  ExpectRace                      ";
    382   name[StatAnnotateBenignRaceSized]      = "  BenignRaceSized                 ";
    383   name[StatAnnotateBenignRace]           = "  BenignRace                      ";
    384   name[StatAnnotateIgnoreReadsBegin]     = "  IgnoreReadsBegin                ";
    385   name[StatAnnotateIgnoreReadsEnd]       = "  IgnoreReadsEnd                  ";
    386   name[StatAnnotateIgnoreWritesBegin]    = "  IgnoreWritesBegin               ";
    387   name[StatAnnotateIgnoreWritesEnd]      = "  IgnoreWritesEnd                 ";
    388   name[StatAnnotatePublishMemoryRange]   = "  PublishMemoryRange              ";
    389   name[StatAnnotateUnpublishMemoryRange] = "  UnpublishMemoryRange            ";
    390   name[StatAnnotateThreadName]           = "  ThreadName                      ";
    391 
    392   name[StatMtxTotal]                     = "Contentionz                       ";
    393   name[StatMtxTrace]                     = "  Trace                           ";
    394   name[StatMtxThreads]                   = "  Threads                         ";
    395   name[StatMtxReport]                    = "  Report                          ";
    396   name[StatMtxSyncVar]                   = "  SyncVar                         ";
    397   name[StatMtxSyncTab]                   = "  SyncTab                         ";
    398   name[StatMtxSlab]                      = "  Slab                            ";
    399   name[StatMtxAtExit]                    = "  Atexit                          ";
    400   name[StatMtxAnnotations]               = "  Annotations                     ";
    401   name[StatMtxMBlock]                    = "  MBlock                          ";
    402   name[StatMtxJavaMBlock]                = "  JavaMBlock                      ";
    403   name[StatMtxFD]                        = "  FD                              ";
    404 
    405   Printf("Statistics:\n");
    406   for (int i = 0; i < StatCnt; i++)
    407     Printf("%s: %zu\n", name[i], (uptr)stat[i]);
    408 }
    409 
    410 }  // namespace __tsan
    411