OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/trace_event/trace_log.h" | 5 #include "base/trace_event/trace_log.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/memory/ref_counted_memory.h" | 19 #include "base/memory/ref_counted_memory.h" |
20 #include "base/memory/singleton.h" | 20 #include "base/memory/singleton.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/process/process_metrics.h" | 22 #include "base/process/process_metrics.h" |
23 #include "base/stl_util.h" | 23 #include "base/stl_util.h" |
| 24 #include "base/strings/string_piece.h" |
24 #include "base/strings/string_split.h" | 25 #include "base/strings/string_split.h" |
25 #include "base/strings/string_tokenizer.h" | 26 #include "base/strings/string_tokenizer.h" |
26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
27 #include "base/sys_info.h" | 28 #include "base/sys_info.h" |
28 #include "base/task_scheduler/post_task.h" | 29 #include "base/task_scheduler/post_task.h" |
29 #include "base/threading/platform_thread.h" | 30 #include "base/threading/platform_thread.h" |
30 #include "base/threading/thread_id_name_manager.h" | 31 #include "base/threading/thread_id_name_manager.h" |
31 #include "base/threading/thread_task_runner_handle.h" | 32 #include "base/threading/thread_task_runner_handle.h" |
32 #include "base/time/time.h" | 33 #include "base/time/time.h" |
33 #include "base/trace_event/category_registry.h" | 34 #include "base/trace_event/category_registry.h" |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 "sort_index", process_sort_index_); | 1495 "sort_index", process_sort_index_); |
1495 } | 1496 } |
1496 | 1497 |
1497 if (!process_name_.empty()) { | 1498 if (!process_name_.empty()) { |
1498 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 1499 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
1499 current_thread_id, "process_name", "name", | 1500 current_thread_id, "process_name", "name", |
1500 process_name_); | 1501 process_name_); |
1501 } | 1502 } |
1502 | 1503 |
1503 if (!process_labels_.empty()) { | 1504 if (!process_labels_.empty()) { |
1504 std::vector<std::string> labels; | 1505 std::vector<base::StringPiece> labels; |
1505 for (const auto& it : process_labels_) | 1506 for (const auto& it : process_labels_) |
1506 labels.push_back(it.second); | 1507 labels.push_back(it.second); |
1507 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 1508 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
1508 current_thread_id, "process_labels", "labels", | 1509 current_thread_id, "process_labels", "labels", |
1509 base::JoinString(labels, ",")); | 1510 base::JoinString(labels, ",")); |
1510 } | 1511 } |
1511 | 1512 |
1512 // Thread sort indices. | 1513 // Thread sort indices. |
1513 for (const auto& it : thread_sort_indices_) { | 1514 for (const auto& it : thread_sort_indices_) { |
1514 if (it.second == 0) | 1515 if (it.second == 0) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 } | 1722 } |
1722 | 1723 |
1723 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1724 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1724 if (*category_group_enabled_) { | 1725 if (*category_group_enabled_) { |
1725 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1726 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1726 event_handle_); | 1727 event_handle_); |
1727 } | 1728 } |
1728 } | 1729 } |
1729 | 1730 |
1730 } // namespace trace_event_internal | 1731 } // namespace trace_event_internal |
OLD | NEW |