Alexey Samsonov | 603c4be | 2012-06-04 13:55:19 +0000 | [diff] [blame] | 1 | //===-- tsan_stat.cc ------------------------------------------------------===// |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 82dbc51 | 2013-03-20 13:21:50 +0000 | [diff] [blame] | 41 | name[StatMopRodata] = " Including .rodata "; |
| 42 | name[StatMopRangeRodata] = " Including .rodata range "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 02b45d2 | 2012-11-26 09:42:56 +0000 | [diff] [blame] | 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 "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 63da509 | 2012-11-27 07:41:27 +0000 | [diff] [blame] | 99 | name[StatAtomic16] = " size 16 "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 100 | |
| 101 | name[StatInterceptor] = "Interceptors "; |
Dmitry Vyukov | f037f56 | 2012-05-31 18:03:59 +0000 | [diff] [blame] | 102 | name[StatInt_longjmp] = " longjmp "; |
| 103 | name[StatInt_siglongjmp] = " siglongjmp "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 104 | name[StatInt_malloc] = " malloc "; |
Dmitry Vyukov | 07ba8ef | 2012-11-30 17:27:58 +0000 | [diff] [blame] | 105 | name[StatInt___libc_memalign] = " __libc_memalign "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 106 | name[StatInt_calloc] = " calloc "; |
| 107 | name[StatInt_realloc] = " realloc "; |
| 108 | name[StatInt_free] = " free "; |
| 109 | name[StatInt_cfree] = " cfree "; |
Dmitry Vyukov | 423bd20 | 2013-03-20 14:04:23 +0000 | [diff] [blame] | 110 | name[StatInt_malloc_usable_size] = " malloc_usable_size "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 39fa68e | 2013-09-21 23:44:19 +0000 | [diff] [blame] | 141 | name[StatInt_strdup] = " strdup "; |
Dmitry Vyukov | be52366 | 2013-03-26 12:40:23 +0000 | [diff] [blame] | 142 | name[StatInt_strcasecmp] = " strcasecmp "; |
| 143 | name[StatInt_strncasecmp] = " strncasecmp "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 144 | name[StatInt_atexit] = " atexit "; |
Dmitry Vyukov | c78140f | 2013-10-03 14:00:46 +0000 | [diff] [blame] | 145 | name[StatInt__exit] = " _exit "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 146 | name[StatInt___cxa_guard_acquire] = " __cxa_guard_acquire "; |
| 147 | name[StatInt___cxa_guard_release] = " __cxa_guard_release "; |
Dmitry Vyukov | 1ffeded | 2012-12-05 12:10:22 +0000 | [diff] [blame] | 148 | name[StatInt___cxa_guard_abort] = " __cxa_guard_abort "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | fae2bff | 2013-09-19 23:44:51 +0000 | [diff] [blame] | 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 "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 56d3472 | 2013-05-21 08:12:08 +0000 | [diff] [blame] | 184 | name[StatInt_pthread_getschedparam] = " pthread_getschedparam "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 61ba1b5 | 2013-01-29 09:23:09 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | ba3ae35 | 2012-12-07 18:30:40 +0000 | [diff] [blame] | 204 | name[StatInt_open] = " open "; |
Dmitry Vyukov | c78839f | 2012-12-12 11:59:30 +0000 | [diff] [blame] | 205 | name[StatInt_open64] = " open64 "; |
Dmitry Vyukov | ba3ae35 | 2012-12-07 18:30:40 +0000 | [diff] [blame] | 206 | name[StatInt_creat] = " creat "; |
Dmitry Vyukov | c78839f | 2012-12-12 11:59:30 +0000 | [diff] [blame] | 207 | name[StatInt_creat64] = " creat64 "; |
Dmitry Vyukov | ba3ae35 | 2012-12-07 18:30:40 +0000 | [diff] [blame] | 208 | name[StatInt_dup] = " dup "; |
| 209 | name[StatInt_dup2] = " dup2 "; |
| 210 | name[StatInt_dup3] = " dup3 "; |
Dmitry Vyukov | 68230a1 | 2012-12-07 19:23:59 +0000 | [diff] [blame] | 211 | name[StatInt_eventfd] = " eventfd "; |
Dmitry Vyukov | 45d4324 | 2012-12-18 12:35:31 +0000 | [diff] [blame] | 212 | name[StatInt_signalfd] = " signalfd "; |
| 213 | name[StatInt_inotify_init] = " inotify_init "; |
| 214 | name[StatInt_inotify_init1] = " inotify_init1 "; |
Dmitry Vyukov | 68230a1 | 2012-12-07 19:23:59 +0000 | [diff] [blame] | 215 | name[StatInt_socket] = " socket "; |
Dmitry Vyukov | 983518e | 2012-12-14 09:57:42 +0000 | [diff] [blame] | 216 | name[StatInt_socketpair] = " socketpair "; |
Dmitry Vyukov | 68230a1 | 2012-12-07 19:23:59 +0000 | [diff] [blame] | 217 | name[StatInt_connect] = " connect "; |
Dmitry Vyukov | 52c70e5 | 2013-02-04 08:06:32 +0000 | [diff] [blame] | 218 | name[StatInt_bind] = " bind "; |
| 219 | name[StatInt_listen] = " listen "; |
Dmitry Vyukov | 68230a1 | 2012-12-07 19:23:59 +0000 | [diff] [blame] | 220 | name[StatInt_accept] = " accept "; |
| 221 | name[StatInt_accept4] = " accept4 "; |
| 222 | name[StatInt_epoll_create] = " epoll_create "; |
| 223 | name[StatInt_epoll_create1] = " epoll_create1 "; |
Dmitry Vyukov | ddeb2c3 | 2012-12-07 15:32:56 +0000 | [diff] [blame] | 224 | name[StatInt_close] = " close "; |
Dmitry Vyukov | c78839f | 2012-12-12 11:59:30 +0000 | [diff] [blame] | 225 | name[StatInt___close] = " __close "; |
Dmitry Vyukov | 03f2248 | 2013-02-07 15:27:45 +0000 | [diff] [blame] | 226 | name[StatInt___res_iclose] = " __res_iclose "; |
Dmitry Vyukov | ddeb2c3 | 2012-12-07 15:32:56 +0000 | [diff] [blame] | 227 | name[StatInt_pipe] = " pipe "; |
| 228 | name[StatInt_pipe2] = " pipe2 "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 229 | name[StatInt_read] = " read "; |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 230 | name[StatInt_prctl] = " prctl "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 231 | name[StatInt_pread] = " pread "; |
| 232 | name[StatInt_pread64] = " pread64 "; |
| 233 | name[StatInt_readv] = " readv "; |
Evgeniy Stepanov | b916e6a | 2013-06-24 10:43:23 +0000 | [diff] [blame] | 234 | name[StatInt_preadv] = " preadv "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | b916e6a | 2013-06-24 10:43:23 +0000 | [diff] [blame] | 240 | name[StatInt_pwritev] = " pwritev "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | c78839f | 2012-12-12 11:59:30 +0000 | [diff] [blame] | 248 | name[StatInt_freopen] = " freopen "; |
| 249 | name[StatInt_fclose] = " fclose "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 250 | name[StatInt_fread] = " fread "; |
| 251 | name[StatInt_fwrite] = " fwrite "; |
Dmitry Vyukov | 0ebfc6f | 2013-03-20 14:01:10 +0000 | [diff] [blame] | 252 | name[StatInt_fflush] = " fflush "; |
Dmitry Vyukov | 5043f05 | 2013-03-21 12:50:43 +0000 | [diff] [blame] | 253 | name[StatInt_abort] = " abort "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | ee8ee24 | 2012-11-15 17:40:49 +0000 | [diff] [blame] | 259 | name[StatInt_poll] = " poll "; |
Evgeniy Stepanov | e18e3f0 | 2013-08-12 13:19:53 +0000 | [diff] [blame] | 260 | name[StatInt_ppoll] = " ppoll "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 261 | name[StatInt_sigaction] = " sigaction "; |
Dmitry Vyukov | 423bd20 | 2013-03-20 14:04:23 +0000 | [diff] [blame] | 262 | name[StatInt_signal] = " signal "; |
Dmitry Vyukov | fbeab51 | 2013-07-16 11:28:04 +0000 | [diff] [blame] | 263 | name[StatInt_sigsuspend] = " sigsuspend "; |
Dmitry Vyukov | 423bd20 | 2013-03-20 14:04:23 +0000 | [diff] [blame] | 264 | name[StatInt_raise] = " raise "; |
| 265 | name[StatInt_kill] = " kill "; |
| 266 | name[StatInt_pthread_kill] = " pthread_kill "; |
Dmitry Vyukov | aad173b | 2012-11-09 19:55:06 +0000 | [diff] [blame] | 267 | name[StatInt_sleep] = " sleep "; |
| 268 | name[StatInt_usleep] = " usleep "; |
| 269 | name[StatInt_nanosleep] = " nanosleep "; |
| 270 | name[StatInt_gettimeofday] = " gettimeofday "; |
Dmitry Vyukov | 4554b7a | 2012-12-18 14:44:44 +0000 | [diff] [blame] | 271 | name[StatInt_fork] = " fork "; |
Evgeniy Stepanov | 996c4f2 | 2013-01-18 11:17:23 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 86edb3b | 2013-02-12 12:02:49 +0000 | [diff] [blame] | 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 "; |
Dmitry Vyukov | 31c05ea | 2013-01-29 13:05:30 +0000 | [diff] [blame] | 284 | name[StatInt_on_exit] = " on_exit "; |
| 285 | name[StatInt___cxa_atexit] = " __cxa_atexit "; |
Evgeniy Stepanov | 9358c58 | 2013-02-19 09:19:16 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 7cbbb29 | 2013-03-14 11:34:39 +0000 | [diff] [blame] | 294 | name[StatInt_frexp] = " frexp "; |
| 295 | name[StatInt_frexpf] = " frexpf "; |
| 296 | name[StatInt_frexpl] = " frexpl "; |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 297 | name[StatInt_getpwnam] = " getpwnam "; |
| 298 | name[StatInt_getpwuid] = " getpwuid "; |
Evgeniy Stepanov | 103a63e | 2013-04-23 12:01:20 +0000 | [diff] [blame] | 299 | name[StatInt_getgrnam] = " getgrnam "; |
| 300 | name[StatInt_getgrgid] = " getgrgid "; |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 301 | name[StatInt_getpwnam_r] = " getpwnam_r "; |
| 302 | name[StatInt_getpwuid_r] = " getpwuid_r "; |
Evgeniy Stepanov | 103a63e | 2013-04-23 12:01:20 +0000 | [diff] [blame] | 303 | name[StatInt_getgrnam_r] = " getgrnam_r "; |
| 304 | name[StatInt_getgrgid_r] = " getgrgid_r "; |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | cc24ec9 | 2013-04-08 08:46:25 +0000 | [diff] [blame] | 310 | name[StatInt_time] = " time "; |
Evgeniy Stepanov | a1c2a55 | 2013-04-09 11:35:13 +0000 | [diff] [blame] | 311 | name[StatInt_glob] = " glob "; |
| 312 | name[StatInt_glob64] = " glob64 "; |
Evgeniy Stepanov | 897a4ae | 2013-04-09 14:34:59 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 9530eb7 | 2013-04-23 14:05:15 +0000 | [diff] [blame] | 318 | name[StatInt_inet_ntop] = " inet_ntop "; |
| 319 | name[StatInt_inet_pton] = " inet_pton "; |
Evgeniy Stepanov | 90a65aa | 2013-06-24 14:03:13 +0000 | [diff] [blame] | 320 | name[StatInt_inet_aton] = " inet_aton "; |
Evgeniy Stepanov | 447ef19 | 2013-05-22 12:50:26 +0000 | [diff] [blame] | 321 | name[StatInt_getaddrinfo] = " getaddrinfo "; |
Evgeniy Stepanov | 9eedf48 | 2013-07-01 13:51:31 +0000 | [diff] [blame] | 322 | name[StatInt_getnameinfo] = " getnameinfo "; |
Evgeniy Stepanov | 9f58c5c | 2013-05-22 13:46:22 +0000 | [diff] [blame] | 323 | name[StatInt_getsockname] = " getsockname "; |
Evgeniy Stepanov | 0a2cc37 | 2013-05-23 11:10:23 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | f32be42 | 2013-05-23 11:38:08 +0000 | [diff] [blame] | 332 | name[StatInt_getsockopt] = " getsockopt "; |
Evgeniy Stepanov | c87088b | 2013-05-29 10:03:11 +0000 | [diff] [blame] | 333 | name[StatInt_modf] = " modf "; |
| 334 | name[StatInt_modff] = " modff "; |
| 335 | name[StatInt_modfl] = " modfl "; |
Evgeniy Stepanov | bc33e13 | 2013-05-29 11:49:25 +0000 | [diff] [blame] | 336 | name[StatInt_getpeername] = " getpeername "; |
Evgeniy Stepanov | 745dd0d | 2013-06-07 13:00:47 +0000 | [diff] [blame] | 337 | name[StatInt_ioctl] = " ioctl "; |
Evgeniy Stepanov | 359d7fc | 2013-06-24 14:25:33 +0000 | [diff] [blame] | 338 | name[StatInt_sysinfo] = " sysinfo "; |
Evgeniy Stepanov | b5cf98f | 2013-06-26 15:00:53 +0000 | [diff] [blame] | 339 | name[StatInt_readdir] = " readdir "; |
| 340 | name[StatInt_readdir64] = " readdir64 "; |
| 341 | name[StatInt_readdir_r] = " readdir_r "; |
| 342 | name[StatInt_readdir64_r] = " readdir64_r "; |
Evgeniy Stepanov | 341b9e6 | 2013-06-28 11:02:43 +0000 | [diff] [blame] | 343 | name[StatInt_ptrace] = " ptrace "; |
Evgeniy Stepanov | 3cae604 | 2013-07-02 09:23:45 +0000 | [diff] [blame] | 344 | name[StatInt_setlocale] = " setlocale "; |
Evgeniy Stepanov | 8014489 | 2013-07-02 13:34:44 +0000 | [diff] [blame] | 345 | name[StatInt_getcwd] = " getcwd "; |
| 346 | name[StatInt_get_current_dir_name] = " get_current_dir_name "; |
Evgeniy Stepanov | ff6c9fb | 2013-07-04 13:19:41 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | ea72768 | 2013-07-04 14:03:31 +0000 | [diff] [blame] | 355 | name[StatInt_tcgetattr] = " tcgetattr "; |
Evgeniy Stepanov | 12eb79d | 2013-07-09 09:53:37 +0000 | [diff] [blame] | 356 | name[StatInt_realpath] = " realpath "; |
| 357 | name[StatInt_canonicalize_file_name] = " canonicalize_file_name "; |
Evgeniy Stepanov | 5ec19bc | 2013-07-30 12:46:59 +0000 | [diff] [blame] | 358 | name[StatInt_confstr] = " confstr "; |
Evgeniy Stepanov | 84ba74c | 2013-08-07 09:10:16 +0000 | [diff] [blame] | 359 | name[StatInt_sched_getaffinity] = " sched_getaffinity "; |
Evgeniy Stepanov | 1204979 | 2013-08-08 11:44:05 +0000 | [diff] [blame] | 360 | name[StatInt_strerror] = " strerror "; |
| 361 | name[StatInt_strerror_r] = " strerror_r "; |
Evgeniy Stepanov | 224226c | 2013-08-08 13:57:15 +0000 | [diff] [blame] | 362 | name[StatInt_scandir] = " scandir "; |
| 363 | name[StatInt_scandir64] = " scandir64 "; |
Evgeniy Stepanov | edff34b | 2013-08-12 11:01:40 +0000 | [diff] [blame] | 364 | name[StatInt_getgroups] = " getgroups "; |
Evgeniy Stepanov | c5a3855 | 2013-09-24 14:38:22 +0000 | [diff] [blame] | 365 | name[StatInt_wordexp] = " wordexp "; |
Evgeniy Stepanov | 9a949a8 | 2013-09-25 14:47:43 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 1394be1 | 2013-09-27 12:40:23 +0000 | [diff] [blame] | 373 | name[StatInt_backtrace] = " backtrace "; |
| 374 | name[StatInt_backtrace_symbols] = " backtrace_symbols "; |
Dmitry Vyukov | 4af0f21 | 2013-10-03 13:37:17 +0000 | [diff] [blame] | 375 | name[StatInt_dlopen] = " dlopen "; |
| 376 | name[StatInt_dlclose] = " dlclose "; |
Evgeniy Stepanov | 4d7297d | 2013-10-18 09:41:43 +0000 | [diff] [blame] | 377 | name[StatInt_getmntent] = " getmntent "; |
| 378 | name[StatInt_getmntent_r] = " getmntent_r "; |
Evgeniy Stepanov | 5cee73e | 2013-10-18 11:14:16 +0000 | [diff] [blame] | 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 "; |
Evgeniy Stepanov | 285d458 | 2013-10-22 12:24:48 +0000 | [diff] [blame] | 387 | name[StatInt_initgroups] = " initgroups "; |
Evgeniy Stepanov | 369a9a6 | 2013-10-23 13:57:47 +0000 | [diff] [blame^] | 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 "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 395 | |
| 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 Vyukov | 423bd20 | 2013-03-20 14:04:23 +0000 | [diff] [blame] | 404 | name[StatAnnotateRWLockCreateStatic] = " StatAnnotateRWLockCreateStatic "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 405 | 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 Vyukov | e1ddbf9 | 2013-10-10 15:58:12 +0000 | [diff] [blame] | 426 | name[StatAnnotateIgnoreSyncBegin] = " IgnoreSyncBegin "; |
| 427 | name[StatAnnotateIgnoreSyncEnd] = " IgnoreSyncEnd "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 428 | 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 Vyukov | ad9da37 | 2012-12-06 12:16:15 +0000 | [diff] [blame] | 441 | name[StatMtxMBlock] = " MBlock "; |
Dmitry Vyukov | f4e4f93 | 2012-12-21 11:30:14 +0000 | [diff] [blame] | 442 | name[StatMtxJavaMBlock] = " JavaMBlock "; |
Dmitry Vyukov | 52c70e5 | 2013-02-04 08:06:32 +0000 | [diff] [blame] | 443 | name[StatMtxFD] = " FD "; |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 444 | |
Alexey Samsonov | b1fe302 | 2012-11-02 12:17:51 +0000 | [diff] [blame] | 445 | Printf("Statistics:\n"); |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 446 | for (int i = 0; i < StatCnt; i++) |
Alexey Samsonov | b1fe302 | 2012-11-02 12:17:51 +0000 | [diff] [blame] | 447 | Printf("%s: %zu\n", name[i], (uptr)stat[i]); |
Kostya Serebryany | 7ac4148 | 2012-05-10 13:48:04 +0000 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | } // namespace __tsan |