1 //===-- tsan_stat.h ---------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of ThreadSanitizer (TSan), a race detector.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef TSAN_STAT_H
14 #define TSAN_STAT_H
15 
16 namespace __tsan {
17 
18 enum StatType {
19   // Memory access processing related stuff.
20   StatMop,
21   StatMopRead,
22   StatMopWrite,
23   StatMop1,  // These must be consequtive.
24   StatMop2,
25   StatMop4,
26   StatMop8,
27   StatMopSame,
28   StatMopIgnored,
29   StatMopRange,
30   StatMopRodata,
31   StatMopRangeRodata,
32   StatShadowProcessed,
33   StatShadowZero,
34   StatShadowNonZero,  // Derived.
35   StatShadowSameSize,
36   StatShadowIntersect,
37   StatShadowNotIntersect,
38   StatShadowSameThread,
39   StatShadowAnotherThread,
40   StatShadowReplace,
41 
42   // Func processing.
43   StatFuncEnter,
44   StatFuncExit,
45 
46   // Trace processing.
47   StatEvents,
48 
49   // Threads.
50   StatThreadCreate,
51   StatThreadFinish,
52   StatThreadReuse,
53   StatThreadMaxTid,
54   StatThreadMaxAlive,
55 
56   // Mutexes.
57   StatMutexCreate,
58   StatMutexDestroy,
59   StatMutexLock,
60   StatMutexUnlock,
61   StatMutexRecLock,
62   StatMutexRecUnlock,
63   StatMutexReadLock,
64   StatMutexReadUnlock,
65 
66   // Synchronization.
67   StatSyncCreated,
68   StatSyncDestroyed,
69   StatSyncAcquire,
70   StatSyncRelease,
71   StatSyncReleaseStoreAcquire,
72 
73   // Clocks - acquire.
74   StatClockAcquire,
75   StatClockAcquireEmpty,
76   StatClockAcquireFastRelease,
77   StatClockAcquireFull,
78   StatClockAcquiredSomething,
79   // Clocks - release.
80   StatClockRelease,
81   StatClockReleaseResize,
82   StatClockReleaseFast,
83   StatClockReleaseSlow,
84   StatClockReleaseFull,
85   StatClockReleaseAcquired,
86   StatClockReleaseClearTail,
87   // Clocks - release store.
88   StatClockStore,
89   StatClockStoreResize,
90   StatClockStoreFast,
91   StatClockStoreFull,
92   StatClockStoreTail,
93   // Clocks - acquire-release.
94   StatClockAcquireRelease,
95 
96   // Atomics.
97   StatAtomic,
98   StatAtomicLoad,
99   StatAtomicStore,
100   StatAtomicExchange,
101   StatAtomicFetchAdd,
102   StatAtomicFetchSub,
103   StatAtomicFetchAnd,
104   StatAtomicFetchOr,
105   StatAtomicFetchXor,
106   StatAtomicFetchNand,
107   StatAtomicCAS,
108   StatAtomicFence,
109   StatAtomicRelaxed,
110   StatAtomicConsume,
111   StatAtomicAcquire,
112   StatAtomicRelease,
113   StatAtomicAcq_Rel,
114   StatAtomicSeq_Cst,
115   StatAtomic1,
116   StatAtomic2,
117   StatAtomic4,
118   StatAtomic8,
119   StatAtomic16,
120 
121   // Dynamic annotations.
122   StatAnnotation,
123   StatAnnotateHappensBefore,
124   StatAnnotateHappensAfter,
125   StatAnnotateCondVarSignal,
126   StatAnnotateCondVarSignalAll,
127   StatAnnotateMutexIsNotPHB,
128   StatAnnotateCondVarWait,
129   StatAnnotateRWLockCreate,
130   StatAnnotateRWLockCreateStatic,
131   StatAnnotateRWLockDestroy,
132   StatAnnotateRWLockAcquired,
133   StatAnnotateRWLockReleased,
134   StatAnnotateTraceMemory,
135   StatAnnotateFlushState,
136   StatAnnotateNewMemory,
137   StatAnnotateNoOp,
138   StatAnnotateFlushExpectedRaces,
139   StatAnnotateEnableRaceDetection,
140   StatAnnotateMutexIsUsedAsCondVar,
141   StatAnnotatePCQGet,
142   StatAnnotatePCQPut,
143   StatAnnotatePCQDestroy,
144   StatAnnotatePCQCreate,
145   StatAnnotateExpectRace,
146   StatAnnotateBenignRaceSized,
147   StatAnnotateBenignRace,
148   StatAnnotateIgnoreReadsBegin,
149   StatAnnotateIgnoreReadsEnd,
150   StatAnnotateIgnoreWritesBegin,
151   StatAnnotateIgnoreWritesEnd,
152   StatAnnotateIgnoreSyncBegin,
153   StatAnnotateIgnoreSyncEnd,
154   StatAnnotatePublishMemoryRange,
155   StatAnnotateUnpublishMemoryRange,
156   StatAnnotateThreadName,
157   Stat__tsan_mutex_create,
158   Stat__tsan_mutex_destroy,
159   Stat__tsan_mutex_pre_lock,
160   Stat__tsan_mutex_post_lock,
161   Stat__tsan_mutex_pre_unlock,
162   Stat__tsan_mutex_post_unlock,
163   Stat__tsan_mutex_pre_signal,
164   Stat__tsan_mutex_post_signal,
165   Stat__tsan_mutex_pre_divert,
166   Stat__tsan_mutex_post_divert,
167 
168   // Internal mutex contentionz.
169   StatMtxTotal,
170   StatMtxTrace,
171   StatMtxThreads,
172   StatMtxReport,
173   StatMtxSyncVar,
174   StatMtxSyncTab,
175   StatMtxSlab,
176   StatMtxAnnotations,
177   StatMtxAtExit,
178   StatMtxMBlock,
179   StatMtxDeadlockDetector,
180   StatMtxFired,
181   StatMtxRacy,
182   StatMtxFD,
183   StatMtxGlobalProc,
184 
185   // This must be the last.
186   StatCnt
187 };
188 
189 }  // namespace __tsan
190 
191 #endif  // TSAN_STAT_H
192