| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
| 6 | 6 |
| 7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
| 8 #include "vm/hash_map.h" | 8 #include "vm/hash_map.h" |
| 9 #include "vm/log.h" | 9 #include "vm/log.h" |
| 10 #include "vm/native_symbol.h" | 10 #include "vm/native_symbol.h" |
| (...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 } | 2412 } |
| 2413 { | 2413 { |
| 2414 JSONArray events(&obj, "traceEvents"); | 2414 JSONArray events(&obj, "traceEvents"); |
| 2415 intptr_t pid = OS::ProcessId(); | 2415 intptr_t pid = OS::ProcessId(); |
| 2416 intptr_t isolate_id = reinterpret_cast<intptr_t>(isolate_); | 2416 intptr_t isolate_id = reinterpret_cast<intptr_t>(isolate_); |
| 2417 for (intptr_t sample_index = 0; sample_index < samples_->length(); | 2417 for (intptr_t sample_index = 0; sample_index < samples_->length(); |
| 2418 sample_index++) { | 2418 sample_index++) { |
| 2419 ProcessedSample* sample = samples_->At(sample_index); | 2419 ProcessedSample* sample = samples_->At(sample_index); |
| 2420 JSONObject event(&events); | 2420 JSONObject event(&events); |
| 2421 event.AddProperty("ph", "P"); // kind = sample event | 2421 event.AddProperty("ph", "P"); // kind = sample event |
| 2422 // Add a blank name to keep about:tracing happy. |
| 2423 event.AddProperty("name", ""); |
| 2422 event.AddProperty64("pid", pid); | 2424 event.AddProperty64("pid", pid); |
| 2423 event.AddProperty64("tid", OSThread::ThreadIdToIntPtr(sample->tid())); | 2425 event.AddProperty64("tid", OSThread::ThreadIdToIntPtr(sample->tid())); |
| 2424 event.AddPropertyTimeMicros("ts", sample->timestamp()); | 2426 event.AddPropertyTimeMicros("ts", sample->timestamp()); |
| 2425 event.AddProperty("cat", "Dart"); | 2427 event.AddProperty("cat", "Dart"); |
| 2426 | 2428 |
| 2427 ProfileTrieNode* trie = sample->timeline_trie(); | 2429 ProfileTrieNode* trie = sample->timeline_trie(); |
| 2428 ASSERT(trie->frame_id() != -1); | 2430 ASSERT(trie->frame_id() != -1); |
| 2429 event.AddPropertyF("sf", "%" Pd "-%" Pd, isolate_id, trie->frame_id()); | 2431 event.AddPropertyF("sf", "%" Pd "-%" Pd, isolate_id, trie->frame_id()); |
| 2430 } | 2432 } |
| 2431 } | 2433 } |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2764 // Disable thread interrupts while processing the buffer. | 2766 // Disable thread interrupts while processing the buffer. |
| 2765 DisableThreadInterruptsScope dtis(thread); | 2767 DisableThreadInterruptsScope dtis(thread); |
| 2766 | 2768 |
| 2767 ClearProfileVisitor clear_profile(isolate); | 2769 ClearProfileVisitor clear_profile(isolate); |
| 2768 sample_buffer->VisitSamples(&clear_profile); | 2770 sample_buffer->VisitSamples(&clear_profile); |
| 2769 } | 2771 } |
| 2770 | 2772 |
| 2771 #endif // !PRODUCT | 2773 #endif // !PRODUCT |
| 2772 | 2774 |
| 2773 } // namespace dart | 2775 } // namespace dart |
| OLD | NEW |