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

Side by Side Diff: base/process_util_win.cc

Issue 6816024: Revert 80819 due to failed tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/file_version_info_win.cc ('k') | base/sys_info.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_util.h" 5 #include "base/process_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <io.h> 8 #include <io.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <userenv.h> 10 #include <userenv.h>
11 #include <psapi.h> 11 #include <psapi.h>
12 12
13 #include <ios> 13 #include <ios>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/debug/stack_trace.h" 16 #include "base/debug/stack_trace.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/sys_info.h"
21 #include "base/win/scoped_handle.h" 20 #include "base/win/scoped_handle.h"
22 #include "base/win/windows_version.h" 21 #include "base/win/windows_version.h"
23 22
24 // userenv.dll is required for CreateEnvironmentBlock(). 23 // userenv.dll is required for CreateEnvironmentBlock().
25 #pragma comment(lib, "userenv.lib") 24 #pragma comment(lib, "userenv.lib")
26 25
27 namespace base { 26 namespace base {
28 27
29 namespace { 28 namespace {
30 29
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 wait_milliseconds, 547 wait_milliseconds,
549 filter); 548 filter);
550 if (!exited_cleanly) 549 if (!exited_cleanly)
551 KillProcesses(executable_name, exit_code, filter); 550 KillProcesses(executable_name, exit_code, filter);
552 return exited_cleanly; 551 return exited_cleanly;
553 } 552 }
554 553
555 /////////////////////////////////////////////////////////////////////////////// 554 ///////////////////////////////////////////////////////////////////////////////
556 // ProcesMetrics 555 // ProcesMetrics
557 556
558 ProcessMetrics::ProcessMetrics(ProcessHandle process) 557 ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process),
559 : process_(process), 558 last_time_(0),
560 processor_count_(base::SysInfo::NumberOfProcessors()), 559 last_system_time_(0) {
561 last_time_(0), 560 SYSTEM_INFO system_info;
562 last_system_time_(0) { 561 GetSystemInfo(&system_info);
562 processor_count_ = system_info.dwNumberOfProcessors;
563 } 563 }
564 564
565 // static 565 // static
566 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) { 566 ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) {
567 return new ProcessMetrics(process); 567 return new ProcessMetrics(process);
568 } 568 }
569 569
570 ProcessMetrics::~ProcessMetrics() { } 570 ProcessMetrics::~ProcessMetrics() { }
571 571
572 size_t ProcessMetrics::GetPagefileUsage() const { 572 size_t ProcessMetrics::GetPagefileUsage() const {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 899
900 PERFORMANCE_INFORMATION info; 900 PERFORMANCE_INFORMATION info;
901 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 901 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
902 LOG(ERROR) << "Failed to fetch internal performance info."; 902 LOG(ERROR) << "Failed to fetch internal performance info.";
903 return 0; 903 return 0;
904 } 904 }
905 return (info.CommitTotal * system_info.dwPageSize) / 1024; 905 return (info.CommitTotal * system_info.dwPageSize) / 1024;
906 } 906 }
907 907
908 } // namespace base 908 } // namespace base
OLDNEW
« no previous file with comments | « base/file_version_info_win.cc ('k') | base/sys_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698