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

Unified Diff: base/trace_event/trace_log.cc

Issue 2768933002: Reland of Add process uptime metadata event in tracing (Closed)
Patch Set: Fix if condition. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/memory_dump_scheduler.cc ('k') | chrome/common/trace_event_args_whitelist.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.cc
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 6dddb94018f6e1b6ec0047f22460c2940399b076..4c03aeb0585d04dba86c9a2fa528a9f555eafcc5 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -19,6 +19,7 @@
#include "base/memory/ref_counted_memory.h"
#include "base/memory/singleton.h"
#include "base/message_loop/message_loop.h"
+#include "base/process/process_info.h"
#include "base/process/process_metrics.h"
#include "base/stl_util.h"
#include "base/strings/string_split.h"
@@ -1500,6 +1501,16 @@ void TraceLog::AddMetadataEventsWhileLocked() {
process_name_);
}
+#if !defined(OS_NACL) && !defined(OS_IOS)
+ Time process_creation_time = CurrentProcessInfo::CreationTime();
+ if (!process_creation_time.is_null()) {
+ TimeDelta process_uptime = Time::Now() - process_creation_time;
+ InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false),
+ current_thread_id, "process_uptime_seconds",
+ "uptime", process_uptime.InSeconds());
+ }
+#endif // !defined(OS_NACL) && !defined(OS_IOS)
+
if (!process_labels_.empty()) {
std::vector<std::string> labels;
for (const auto& it : process_labels_)
« no previous file with comments | « base/trace_event/memory_dump_scheduler.cc ('k') | chrome/common/trace_event_args_whitelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698