File tree Expand file tree Collapse file tree 6 files changed +24
-122
lines changed Expand file tree Collapse file tree 6 files changed +24
-122
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 16
16
17
17
#include < assert.h>
18
18
19
- #include " branch_hints .h"
19
+ #include " arch_dd .h"
20
20
#include " context.h"
21
21
#include " counters.h"
22
22
#include " engine.h"
Original file line number Diff line number Diff line change 20
20
// - These methods assume slot_id comes from registerThread() (undefined behavior otherwise)
21
21
22
22
#include " threadFilter.h"
23
- #include " branch_hints .h"
23
+ #include " arch_dd .h"
24
24
25
+ #include < cassert>
25
26
#include < cstdlib>
27
+ #include < cstdio>
26
28
#include < thread>
27
29
#include < algorithm>
28
30
#include < cstring>
@@ -181,10 +183,17 @@ void ThreadFilter::remove(SlotID slot_id) {
181
183
int chunk_idx = slot_id >> kChunkShift ;
182
184
int slot_idx = slot_id & kChunkMask ;
183
185
186
+ if (unlikely (chunk_idx >= kMaxChunks )) {
187
+ assert (false && " Invalid slot_id in ThreadFilter::remove - should not happen after wall clock fix" );
188
+ return ;
189
+ }
190
+
184
191
ChunkStorage* chunk = _chunks[chunk_idx].load (std::memory_order_relaxed);
185
- if (likely (chunk ! = nullptr )) {
186
- chunk-> slots [slot_idx]. value . store (- 1 , std::memory_order_release) ;
192
+ if (unlikely (chunk = = nullptr )) {
193
+ return ;
187
194
}
195
+
196
+ chunk->slots [slot_idx].value .store (-1 , std::memory_order_release);
188
197
}
189
198
190
199
void ThreadFilter::unregisterThread (SlotID slot_id) {
Original file line number Diff line number Diff line change 19
19
20
20
#include < atomic>
21
21
#include < unordered_set>
22
- #include " branch_hints .h"
22
+ #include " arch_dd .h"
23
23
24
24
// Simple fixed size thread ID table
25
25
class ThreadIdTable {
Original file line number Diff line number Diff line change 21
21
#include " os.h"
22
22
#include " profiler.h"
23
23
#include " reservoirSampler.h"
24
+ #include " thread.h"
24
25
#include " threadFilter.h"
25
26
#include " threadState.h"
26
27
#include " tsc.h"
@@ -67,7 +68,15 @@ class BaseWallClock : public Engine {
67
68
threads.reserve (reservoirSize);
68
69
int self = OS::threadId ();
69
70
ThreadFilter* thread_filter = Profiler::instance ()->threadFilter ();
70
- thread_filter->remove (self);
71
+
72
+ // We don't want to profile ourselves in wall time
73
+ ProfiledThread* current = ProfiledThread::current ();
74
+ if (current != nullptr ) {
75
+ int slot_id = current->filterSlotId ();
76
+ if (slot_id != -1 ) {
77
+ thread_filter->remove (slot_id);
78
+ }
79
+ }
71
80
72
81
u64 startTime = TSC::ticks ();
73
82
WallClockEpochEvent epoch (startTime);
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments