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

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

Issue 1433603004: Add ProcessMetrics::CreateCurrentProcessMetrics() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a_counter_with_ts
Patch Set: Remove patch dependency Created 5 years, 1 month 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/process/process_metrics.h ('k') | base/trace_event/process_memory_totals_dump_provider.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 25 matching lines...) Expand all
36 res->Set("meminfo", memory_info_.ToValue()); 36 res->Set("meminfo", memory_info_.ToValue());
37 res->Set("diskinfo", disk_info_.ToValue()); 37 res->Set("diskinfo", disk_info_.ToValue());
38 #endif 38 #endif
39 #if defined(OS_CHROMEOS) 39 #if defined(OS_CHROMEOS)
40 res->Set("swapinfo", swap_info_.ToValue()); 40 res->Set("swapinfo", swap_info_.ToValue());
41 #endif 41 #endif
42 42
43 return res.Pass(); 43 return res.Pass();
44 } 44 }
45 45
46 ProcessMetrics* ProcessMetrics::CreateCurrentProcessMetrics() {
47 #if !defined(OS_MACOSX) || defined(OS_IOS)
48 return CreateProcessMetrics(base::GetCurrentProcessHandle());
49 #else
50 return CreateProcessMetrics(base::GetCurrentProcessHandle(), nullptr);
51 #endif // !defined(OS_MACOSX) || defined(OS_IOS)
52 }
53
46 double ProcessMetrics::GetPlatformIndependentCPUUsage() { 54 double ProcessMetrics::GetPlatformIndependentCPUUsage() {
47 #if defined(OS_WIN) 55 #if defined(OS_WIN)
48 return GetCPUUsage() * processor_count_; 56 return GetCPUUsage() * processor_count_;
49 #else 57 #else
50 return GetCPUUsage(); 58 return GetCPUUsage();
51 #endif 59 #endif
52 } 60 }
53 61
54 #if defined(OS_MACOSX) || defined(OS_LINUX) 62 #if defined(OS_MACOSX) || defined(OS_LINUX)
55 int ProcessMetrics::CalculateIdleWakeupsPerSecond( 63 int ProcessMetrics::CalculateIdleWakeupsPerSecond(
(...skipping 22 matching lines...) Expand all
78 return (wakeups_delta_for_ms + time_delta / 2) / time_delta; 86 return (wakeups_delta_for_ms + time_delta / 2) / time_delta;
79 } 87 }
80 #else 88 #else
81 int ProcessMetrics::GetIdleWakeupsPerSecond() { 89 int ProcessMetrics::GetIdleWakeupsPerSecond() {
82 NOTIMPLEMENTED(); // http://crbug.com/120488 90 NOTIMPLEMENTED(); // http://crbug.com/120488
83 return 0; 91 return 0;
84 } 92 }
85 #endif // defined(OS_MACOSX) || defined(OS_LINUX) 93 #endif // defined(OS_MACOSX) || defined(OS_LINUX)
86 94
87 } // namespace base 95 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | base/trace_event/process_memory_totals_dump_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698