blob: 5eccca69312f45857d88438e1fab18fb947b93f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
//===-- tsan_stat.cc ------------------------------------------------------===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of ThreadSanitizer (TSan), a race detector.
//
//===----------------------------------------------------------------------===//
#include "tsan_stat.h"
#include "tsan_rtl.h"
namespace __tsan {
#if TSAN_COLLECT_STATS
void StatAggregate(u64 *dst, u64 *src) {
for (int i = 0; i < StatCnt; i++)
dst[i] += src[i];
}
void StatOutput(u64 *stat) {
stat[StatShadowNonZero] = stat[StatShadowProcessed] - stat[StatShadowZero];
static const char *name[StatCnt] = {};
name[StatMop] = "Memory accesses ";
name[StatMopRead] = " Including reads ";
name[StatMopWrite] = " writes ";
name[StatMop1] = " Including size 1 ";
name[StatMop2] = " size 2 ";
name[StatMop4] = " size 4 ";
name[StatMop8] = " size 8 ";
name[StatMopSame] = " Including same ";
name[StatMopIgnored] = " Including ignored ";
name[StatMopRange] = " Including range ";
name[StatMopRodata] = " Including .rodata ";
name[StatMopRangeRodata] = " Including .rodata range ";
name[StatShadowProcessed] = "Shadow processed ";
name[StatShadowZero] = " Including empty ";
name[StatShadowNonZero] = " Including non empty ";
name[StatShadowSameSize] = " Including same size ";
name[StatShadowIntersect] = " intersect ";
name[StatShadowNotIntersect] = " not intersect ";
name[StatShadowSameThread] = " Including same thread ";
name[StatShadowAnotherThread] = " another thread ";
name[StatShadowReplace] = " Including evicted ";
name[StatFuncEnter] = "Function entries ";
name[StatFuncExit] = "Function exits ";
name[StatEvents] = "Events collected ";
name[StatThreadCreate] = "Total threads created ";
name[StatThreadFinish] = " threads finished ";
name[StatThreadReuse] = " threads reused ";
name[StatThreadMaxTid] = " max tid ";
name[StatThreadMaxAlive] = " max alive threads ";
name[StatMutexCreate] = "Mutexes created ";
name[StatMutexDestroy] = " destroyed ";
name[StatMutexLock] = " lock ";
name[StatMutexUnlock] = " unlock ";
name[StatMutexRecLock] = " recursive lock ";
name[StatMutexRecUnlock] = " recursive unlock ";
name[StatMutexReadLock] = " read lock ";
name[StatMutexReadUnlock] = " read unlock ";
name[StatSyncCreated] = "Sync objects created ";
name[StatSyncDestroyed] = " destroyed ";
name[StatSyncAcquire] = " acquired ";
name[StatSyncRelease] = " released ";
name[StatClockAcquire] = "Clock acquire ";
name[StatClockAcquireEmpty] = " empty clock ";
name[StatClockAcquireFastRelease] = " fast from release-store ";
name[StatClockAcquireLarge] = " contains my tid ";
name[StatClockAcquireRepeat] = " repeated (fast) ";
name[StatClockAcquireFull] = " full (slow) ";
name[StatClockAcquiredSomething] = " acquired something ";
name[StatClockRelease] = "Clock release ";
name[StatClockReleaseResize] = " resize ";
name[StatClockReleaseFast1] = " fast1 ";
name[StatClockReleaseFast2] = " fast2 ";
name[StatClockReleaseSlow] = " dirty overflow (slow) ";
name[StatClockReleaseFull] = " full (slow) ";
name[StatClockReleaseAcquired] = " was acquired ";
name[StatClockReleaseClearTail] = " clear tail ";
name[StatClockStore] = "Clock release store ";
name[StatClockStoreResize] = " resize ";
name[StatClockStoreFast] = " fast ";
name[StatClockStoreFull] = " slow ";
name[StatClockStoreTail] = " clear tail ";
name[StatClockAcquireRelease] = "Clock acquire-release ";
name[StatAtomic] = "Atomic operations ";
name[StatAtomicLoad] = " Including load ";
name[StatAtomicStore] = " store ";
name[StatAtomicExchange] = " exchange ";
name[StatAtomicFetchAdd] = " fetch_add ";
name[StatAtomicFetchSub] = " fetch_sub ";
name[StatAtomicFetchAnd] = " fetch_and ";
name[StatAtomicFetchOr] = " fetch_or ";
name[StatAtomicFetchXor] = " fetch_xor ";
name[StatAtomicFetchNand] = " fetch_nand ";
name[StatAtomicCAS] = " compare_exchange ";
name[StatAtomicFence] = " fence ";
name[StatAtomicRelaxed] = " Including relaxed ";
name[StatAtomicConsume] = " consume ";
name[StatAtomicAcquire] = " acquire ";
name[StatAtomicRelease] = " release ";
name[StatAtomicAcq_Rel] = " acq_rel ";
name[StatAtomicSeq_Cst] = " seq_cst ";
name[StatAtomic1] = " Including size 1 ";
name[StatAtomic2] = " size 2 ";
name[StatAtomic4] = " size 4 ";
name[StatAtomic8] = " size 8 ";
name[StatAtomic16] = " size 16 ";
name[StatAnnotation] = "Dynamic annotations ";
name[StatAnnotateHappensBefore] = " HappensBefore ";
name[StatAnnotateHappensAfter] = " HappensAfter ";
name[StatAnnotateCondVarSignal] = " CondVarSignal ";
name[StatAnnotateCondVarSignalAll] = " CondVarSignalAll ";
name[StatAnnotateMutexIsNotPHB] = " MutexIsNotPHB ";
name[StatAnnotateCondVarWait] = " CondVarWait ";
name[StatAnnotateRWLockCreate] = " RWLockCreate ";
name[StatAnnotateRWLockCreateStatic] = " StatAnnotateRWLockCreateStatic ";
name[StatAnnotateRWLockDestroy] = " RWLockDestroy ";
name[StatAnnotateRWLockAcquired] = " RWLockAcquired ";
name[StatAnnotateRWLockReleased] = " RWLockReleased ";
name[StatAnnotateTraceMemory] = " TraceMemory ";
name[StatAnnotateFlushState] = " FlushState ";
name[StatAnnotateNewMemory] = " NewMemory ";
name[StatAnnotateNoOp] = " NoOp ";
name[StatAnnotateFlushExpectedRaces] = " FlushExpectedRaces ";
name[StatAnnotateEnableRaceDetection] = " EnableRaceDetection ";
name[StatAnnotateMutexIsUsedAsCondVar] = " MutexIsUsedAsCondVar ";
name[StatAnnotatePCQGet] = " PCQGet ";
name[StatAnnotatePCQPut] = " PCQPut ";
name[StatAnnotatePCQDestroy] = " PCQDestroy ";
name[StatAnnotatePCQCreate] = " PCQCreate ";
name[StatAnnotateExpectRace] = " ExpectRace ";
name[StatAnnotateBenignRaceSized] = " BenignRaceSized ";
name[StatAnnotateBenignRace] = " BenignRace ";
name[StatAnnotateIgnoreReadsBegin] = " IgnoreReadsBegin ";
name[StatAnnotateIgnoreReadsEnd] = " IgnoreReadsEnd ";
name[StatAnnotateIgnoreWritesBegin] = " IgnoreWritesBegin ";
name[StatAnnotateIgnoreWritesEnd] = " IgnoreWritesEnd ";
name[StatAnnotateIgnoreSyncBegin] = " IgnoreSyncBegin ";
name[StatAnnotateIgnoreSyncEnd] = " IgnoreSyncEnd ";
name[StatAnnotatePublishMemoryRange] = " PublishMemoryRange ";
name[StatAnnotateUnpublishMemoryRange] = " UnpublishMemoryRange ";
name[StatAnnotateThreadName] = " ThreadName ";
name[StatMtxTotal] = "Contentionz ";
name[StatMtxTrace] = " Trace ";
name[StatMtxThreads] = " Threads ";
name[StatMtxReport] = " Report ";
name[StatMtxSyncVar] = " SyncVar ";
name[StatMtxSyncTab] = " SyncTab ";
name[StatMtxSlab] = " Slab ";
name[StatMtxAtExit] = " Atexit ";
name[StatMtxAnnotations] = " Annotations ";
name[StatMtxMBlock] = " MBlock ";
name[StatMtxDeadlockDetector] = " DeadlockDetector ";
name[StatMtxFired] = " FiredSuppressions ";
name[StatMtxRacy] = " RacyStacks ";
name[StatMtxFD] = " FD ";
Printf("Statistics:\n");
for (int i = 0; i < StatCnt; i++)
Printf("%s: %16zu\n", name[i], (uptr)stat[i]);
}
#endif
} // namespace __tsan
|