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_info.h" | |
23 #include "base/process/process_metrics.h" | 22 #include "base/process/process_metrics.h" |
24 #include "base/stl_util.h" | 23 #include "base/stl_util.h" |
25 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
26 #include "base/strings/string_tokenizer.h" | 25 #include "base/strings/string_tokenizer.h" |
27 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
28 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
29 #include "base/task_scheduler/post_task.h" | 28 #include "base/task_scheduler/post_task.h" |
30 #include "base/threading/platform_thread.h" | 29 #include "base/threading/platform_thread.h" |
31 #include "base/threading/thread_id_name_manager.h" | 30 #include "base/threading/thread_id_name_manager.h" |
32 #include "base/threading/thread_task_runner_handle.h" | 31 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 current_thread_id, "process_sort_index", | 1493 current_thread_id, "process_sort_index", |
1495 "sort_index", process_sort_index_); | 1494 "sort_index", process_sort_index_); |
1496 } | 1495 } |
1497 | 1496 |
1498 if (!process_name_.empty()) { | 1497 if (!process_name_.empty()) { |
1499 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 1498 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
1500 current_thread_id, "process_name", "name", | 1499 current_thread_id, "process_name", "name", |
1501 process_name_); | 1500 process_name_); |
1502 } | 1501 } |
1503 | 1502 |
1504 #if !defined(OS_NACL) && !defined(OS_IOS) | |
1505 Time process_creation_time = CurrentProcessInfo::CreationTime(); | |
1506 if (!process_creation_time.is_null()) { | |
1507 TimeDelta process_uptime = Time::Now() - process_creation_time; | |
1508 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | |
1509 current_thread_id, "process_uptime_seconds", | |
1510 "uptime", process_uptime.InSeconds()); | |
1511 } | |
1512 #endif // !defined(OS_NACL) && !defined(OS_IOS) | |
1513 | |
1514 if (!process_labels_.empty()) { | 1503 if (!process_labels_.empty()) { |
1515 std::vector<std::string> labels; | 1504 std::vector<std::string> labels; |
1516 for (const auto& it : process_labels_) | 1505 for (const auto& it : process_labels_) |
1517 labels.push_back(it.second); | 1506 labels.push_back(it.second); |
1518 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 1507 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
1519 current_thread_id, "process_labels", "labels", | 1508 current_thread_id, "process_labels", "labels", |
1520 base::JoinString(labels, ",")); | 1509 base::JoinString(labels, ",")); |
1521 } | 1510 } |
1522 | 1511 |
1523 // Thread sort indices. | 1512 // Thread sort indices. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 } | 1721 } |
1733 | 1722 |
1734 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1723 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1735 if (*category_group_enabled_) { | 1724 if (*category_group_enabled_) { |
1736 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1725 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1737 event_handle_); | 1726 event_handle_); |
1738 } | 1727 } |
1739 } | 1728 } |
1740 | 1729 |
1741 } // namespace trace_event_internal | 1730 } // namespace trace_event_internal |
OLD | NEW |