Configuration bits for ARC port:
[official-gcc.git] / libsanitizer / tsan / tsan_trace.h
blob69864838e267e835bff5bd7df822b19ca82063a0
1 //===-- tsan_trace.h --------------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 //===----------------------------------------------------------------------===//
11 #ifndef TSAN_TRACE_H
12 #define TSAN_TRACE_H
14 #include "tsan_defs.h"
15 #include "tsan_mutex.h"
16 #include "tsan_sync.h"
17 #include "tsan_mutexset.h"
19 namespace __tsan {
21 const int kTracePartSizeBits = 14;
22 const int kTracePartSize = 1 << kTracePartSizeBits;
23 const int kTraceParts = 4 * 1024 * 1024 / kTracePartSize;
24 const int kTraceSize = kTracePartSize * kTraceParts;
26 // Must fit into 3 bits.
27 enum EventType {
28 EventTypeMop,
29 EventTypeFuncEnter,
30 EventTypeFuncExit,
31 EventTypeLock,
32 EventTypeUnlock,
33 EventTypeRLock,
34 EventTypeRUnlock
37 // Represents a thread event (from most significant bit):
38 // u64 typ : 3; // EventType.
39 // u64 addr : 61; // Associated pc.
40 typedef u64 Event;
42 struct TraceHeader {
43 StackTrace stack0; // Start stack for the trace.
44 u64 epoch0; // Start epoch for the trace.
45 MutexSet mset0;
46 #ifndef TSAN_GO
47 uptr stack0buf[kTraceStackSize];
48 #endif
50 TraceHeader()
51 #ifndef TSAN_GO
52 : stack0(stack0buf, kTraceStackSize)
53 #else
54 : stack0()
55 #endif
56 , epoch0() {
60 struct Trace {
61 TraceHeader headers[kTraceParts];
62 Mutex mtx;
64 Trace()
65 : mtx(MutexTypeTrace, StatMtxTrace) {
69 } // namespace __tsan
71 #endif // TSAN_TRACE_H