forked from OSchip/llvm-project
tsan: don't initialize trace header in release mode
We are going to use only a small part of the trace with the default value of history_size. However, the constructor writes to the whole trace. It writes mostly zeros, so freshly mmaped memory will do. The only non-zero field if mutex type used for debugging. Reduces per-goroutine overhead by 8K. https://code.google.com/p/thread-sanitizer/issues/detail?id=89 llvm-svn: 229127
This commit is contained in:
parent
ebfe815f5c
commit
8a9d23bf53
|
@ -68,7 +68,13 @@ static ThreadContextBase *CreateThreadContext(u32 tid) {
|
|||
// Map thread trace when context is created.
|
||||
MapThreadTrace(GetThreadTrace(tid), TraceSize() * sizeof(Event));
|
||||
MapThreadTrace(GetThreadTraceHeader(tid), sizeof(Trace));
|
||||
#if SANITIZER_DEBUG
|
||||
// We are going to use only a small part of the trace with the default
|
||||
// value of history_size. However, the constructor writes to the whole trace.
|
||||
// It writes mostly zeros, so freshly mmaped memory will do.
|
||||
// The only non-zero field if mutex type used for debugging.
|
||||
new(ThreadTrace(tid)) Trace();
|
||||
#endif
|
||||
void *mem = internal_alloc(MBlockThreadContex, sizeof(ThreadContext));
|
||||
return new(mem) ThreadContext(tid);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue