Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: runtime/vm/profiler_test.cc

Issue 1820013002: Remember thread's task when sampling use it when filtering (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/profiler.h" 10 #include "vm/profiler.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 196
197 class AllocationFilter : public SampleFilter { 197 class AllocationFilter : public SampleFilter {
198 public: 198 public:
199 AllocationFilter(Isolate* isolate, 199 AllocationFilter(Isolate* isolate,
200 intptr_t cid, 200 intptr_t cid,
201 int64_t time_origin_micros = -1, 201 int64_t time_origin_micros = -1,
202 int64_t time_extent_micros = -1) 202 int64_t time_extent_micros = -1)
203 : SampleFilter(isolate, 203 : SampleFilter(isolate,
204 Thread::kMutatorTask,
204 time_origin_micros, 205 time_origin_micros,
205 time_extent_micros), 206 time_extent_micros),
206 cid_(cid), 207 cid_(cid),
207 enable_vm_ticks_(false) { 208 enable_vm_ticks_(false) {
208 } 209 }
209 210
210 bool FilterSample(Sample* sample) { 211 bool FilterSample(Sample* sample) {
211 if (!enable_vm_ticks_ && 212 if (!enable_vm_ticks_ &&
212 (sample->vm_tag() == VMTag::kVMTagId)) { 213 (sample->vm_tag() == VMTag::kVMTagId)) {
213 // We don't want to see embedder ticks in the test. 214 // We don't want to see embedder ticks in the test.
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 2302
2302 static void InsertFakeSample(SampleBuffer* sample_buffer, 2303 static void InsertFakeSample(SampleBuffer* sample_buffer,
2303 uword* pc_offsets) { 2304 uword* pc_offsets) {
2304 ASSERT(sample_buffer != NULL); 2305 ASSERT(sample_buffer != NULL);
2305 Isolate* isolate = Isolate::Current(); 2306 Isolate* isolate = Isolate::Current();
2306 Sample* sample = sample_buffer->ReserveSample(); 2307 Sample* sample = sample_buffer->ReserveSample();
2307 ASSERT(sample != NULL); 2308 ASSERT(sample != NULL);
2308 sample->Init(isolate, 2309 sample->Init(isolate,
2309 OS::GetCurrentMonotonicMicros(), 2310 OS::GetCurrentMonotonicMicros(),
2310 OSThread::Current()->trace_id()); 2311 OSThread::Current()->trace_id());
2312 sample->set_thread_task(Thread::kMutatorTask);
2311 2313
2312 intptr_t i = 0; 2314 intptr_t i = 0;
2313 while (pc_offsets[i] != 0) { 2315 while (pc_offsets[i] != 0) {
2314 // When we collect a real stack trace, all PCs collected aside from the 2316 // When we collect a real stack trace, all PCs collected aside from the
2315 // executing one (i == 0) are actually return addresses. Return addresses 2317 // executing one (i == 0) are actually return addresses. Return addresses
2316 // are one byte beyond the call instruction that is executing. The profiler 2318 // are one byte beyond the call instruction that is executing. The profiler
2317 // accounts for this and subtracts one from these addresses when querying 2319 // accounts for this and subtracts one from these addresses when querying
2318 // inline and token position ranges. To be consistent with real stack 2320 // inline and token position ranges. To be consistent with real stack
2319 // traces, we add one byte to all PCs except the executing one. 2321 // traces, we add one byte to all PCs except the executing one.
2320 // See OffsetForPC in profiler_service.cc for more context. 2322 // See OffsetForPC in profiler_service.cc for more context.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString()); 2494 EXPECT_SUBSTRING("\"positions\":[\"TempMove\",39]", js.ToCString());
2493 // Verify exclusive ticks in main. 2495 // Verify exclusive ticks in main.
2494 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString()); 2496 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,0]", js.ToCString());
2495 // Verify inclusive ticks in main. 2497 // Verify inclusive ticks in main.
2496 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString()); 2498 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString());
2497 } 2499 }
2498 2500
2499 #endif // !PRODUCT 2501 #endif // !PRODUCT
2500 2502
2501 } // namespace dart 2503 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698