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

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

Issue 1617263002: Revert of [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: 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 // This can be reached if the process dies when proc is read -- in that case, 89 NOTREACHED();
90 // the kernel can return missing fields.
91 return 0; 90 return 0;
92 } 91 }
93 92
94 #if defined(OS_LINUX) 93 #if defined(OS_LINUX)
95 // Read /proc/<pid>/sched and look for |field|. On succes, return true and 94 // Read /proc/<pid>/sched and look for |field|. On succes, return true and
96 // write the value for |field| into |result|. 95 // write the value for |field| into |result|.
97 // Only works for fields in the form of "field : uint_value" 96 // Only works for fields in the form of "field : uint_value"
98 bool ReadProcSchedAndGetFieldAsUint64(pid_t pid, 97 bool ReadProcSchedAndGetFieldAsUint64(pid_t pid,
99 const std::string& field, 98 const std::string& field,
100 uint64_t* result) { 99 uint64_t* result) {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 #if defined(OS_LINUX) 941 #if defined(OS_LINUX)
943 int ProcessMetrics::GetIdleWakeupsPerSecond() { 942 int ProcessMetrics::GetIdleWakeupsPerSecond() {
944 uint64_t wake_ups; 943 uint64_t wake_ups;
945 const char kWakeupStat[] = "se.statistics.nr_wakeups"; 944 const char kWakeupStat[] = "se.statistics.nr_wakeups";
946 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? 945 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
947 CalculateIdleWakeupsPerSecond(wake_ups) : 0; 946 CalculateIdleWakeupsPerSecond(wake_ups) : 0;
948 } 947 }
949 #endif // defined(OS_LINUX) 948 #endif // defined(OS_LINUX)
950 949
951 } // namespace base 950 } // 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