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

Side by Side Diff: base/process/process_metrics_linux.cc

Issue 1417003003: [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: Fix header macro. Created 4 years, 11 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
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/process/process_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return 0; 79 return 0;
80 } 80 }
81 size_t value; 81 size_t value;
82 if (!StringToSizeT(split_value_str[0], &value)) { 82 if (!StringToSizeT(split_value_str[0], &value)) {
83 NOTREACHED(); 83 NOTREACHED();
84 return 0; 84 return 0;
85 } 85 }
86 return value; 86 return value;
87 } 87 }
88 } 88 }
89 NOTREACHED();
Nico 2016/01/08 00:45:52 is there test coverage for this change?
ssid 2016/01/08 11:26:01 There doesn't seem to be any unittest for this fun
Nico 2016/01/08 16:07:33 I mean, is this path now taken while it wasn't bef
90 return 0; 89 return 0;
91 } 90 }
92 91
93 #if defined(OS_LINUX) 92 #if defined(OS_LINUX)
94 // Read /proc/<pid>/sched and look for |field|. On succes, return true and 93 // Read /proc/<pid>/sched and look for |field|. On succes, return true and
95 // write the value for |field| into |result|. 94 // write the value for |field| into |result|.
96 // Only works for fields in the form of "field : uint_value" 95 // Only works for fields in the form of "field : uint_value"
97 bool ReadProcSchedAndGetFieldAsUint64(pid_t pid, 96 bool ReadProcSchedAndGetFieldAsUint64(pid_t pid,
98 const std::string& field, 97 const std::string& field,
99 uint64_t* result) { 98 uint64_t* result) {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 #if defined(OS_LINUX) 940 #if defined(OS_LINUX)
942 int ProcessMetrics::GetIdleWakeupsPerSecond() { 941 int ProcessMetrics::GetIdleWakeupsPerSecond() {
943 uint64_t wake_ups; 942 uint64_t wake_ups;
944 const char kWakeupStat[] = "se.statistics.nr_wakeups"; 943 const char kWakeupStat[] = "se.statistics.nr_wakeups";
945 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? 944 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
946 CalculateIdleWakeupsPerSecond(wake_ups) : 0; 945 CalculateIdleWakeupsPerSecond(wake_ups) : 0;
947 } 946 }
948 #endif // defined(OS_LINUX) 947 #endif // defined(OS_LINUX)
949 948
950 } // namespace base 949 } // namespace base
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698