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

Side by Side Diff: base/process_util.h

Issue 6081007: Start sorting methods in class declarations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/platform_file.cc ('k') | base/ref_counted_memory.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) 2010 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 // This file/namespace contains utility functions for enumerating, ending and 5 // This file/namespace contains utility functions for enumerating, ending and
6 // computing statistics of processes. 6 // computing statistics of processes.
7 7
8 #ifndef BASE_PROCESS_UTIL_H_ 8 #ifndef BASE_PROCESS_UTIL_H_
9 #define BASE_PROCESS_UTIL_H_ 9 #define BASE_PROCESS_UTIL_H_
10 #pragma once 10 #pragma once
11 11
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const uint32 kProcessAccessSuspendResume = PROCESS_SUSPEND_RESUME; 69 const uint32 kProcessAccessSuspendResume = PROCESS_SUSPEND_RESUME;
70 const uint32 kProcessAccessQueryLimitedInfomation = 70 const uint32 kProcessAccessQueryLimitedInfomation =
71 PROCESS_QUERY_LIMITED_INFORMATION; 71 PROCESS_QUERY_LIMITED_INFORMATION;
72 const uint32 kProcessAccessWaitForTermination = SYNCHRONIZE; 72 const uint32 kProcessAccessWaitForTermination = SYNCHRONIZE;
73 #elif defined(OS_POSIX) 73 #elif defined(OS_POSIX)
74 74
75 struct ProcessEntry { 75 struct ProcessEntry {
76 ProcessEntry(); 76 ProcessEntry();
77 ~ProcessEntry(); 77 ~ProcessEntry();
78 78
79 ProcessId pid_;
80 ProcessId ppid_;
81 ProcessId gid_;
82 std::string exe_file_;
83 std::vector<std::string> cmd_line_args_;
84
85 ProcessId pid() const { return pid_; } 79 ProcessId pid() const { return pid_; }
86 ProcessId parent_pid() const { return ppid_; } 80 ProcessId parent_pid() const { return ppid_; }
87 ProcessId gid() const { return gid_; } 81 ProcessId gid() const { return gid_; }
88 const char* exe_file() const { return exe_file_.c_str(); } 82 const char* exe_file() const { return exe_file_.c_str(); }
89 const std::vector<std::string>& cmd_line_args() const { 83 const std::vector<std::string>& cmd_line_args() const {
90 return cmd_line_args_; 84 return cmd_line_args_;
91 } 85 }
86
87 ProcessId pid_;
88 ProcessId ppid_;
89 ProcessId gid_;
90 std::string exe_file_;
91 std::vector<std::string> cmd_line_args_;
92 }; 92 };
93 93
94 struct IoCounters { 94 struct IoCounters {
95 uint64_t ReadOperationCount; 95 uint64_t ReadOperationCount;
96 uint64_t WriteOperationCount; 96 uint64_t WriteOperationCount;
97 uint64_t OtherOperationCount; 97 uint64_t OtherOperationCount;
98 uint64_t ReadTransferCount; 98 uint64_t ReadTransferCount;
99 uint64_t WriteTransferCount; 99 uint64_t WriteTransferCount;
100 uint64_t OtherTransferCount; 100 uint64_t OtherTransferCount;
101 }; 101 };
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 // Convert a POSIX timeval to microseconds. 522 // Convert a POSIX timeval to microseconds.
523 int64 TimeValToMicroseconds(const struct timeval& tv); 523 int64 TimeValToMicroseconds(const struct timeval& tv);
524 524
525 // Provides performance metrics for a specified process (CPU usage, memory and 525 // Provides performance metrics for a specified process (CPU usage, memory and
526 // IO counters). To use it, invoke CreateProcessMetrics() to get an instance 526 // IO counters). To use it, invoke CreateProcessMetrics() to get an instance
527 // for a specific process, then access the information with the different get 527 // for a specific process, then access the information with the different get
528 // methods. 528 // methods.
529 class ProcessMetrics { 529 class ProcessMetrics {
530 public: 530 public:
531 ~ProcessMetrics();
532
531 // Creates a ProcessMetrics for the specified process. 533 // Creates a ProcessMetrics for the specified process.
532 // The caller owns the returned object. 534 // The caller owns the returned object.
533 #if !defined(OS_MACOSX) 535 #if !defined(OS_MACOSX)
534 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process); 536 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process);
535 #else 537 #else
536 class PortProvider { 538 class PortProvider {
537 public: 539 public:
538 // Should return the mach task for |process| if possible, or else 540 // Should return the mach task for |process| if possible, or else
539 // |MACH_PORT_NULL|. Only processes that this returns tasks for will have 541 // |MACH_PORT_NULL|. Only processes that this returns tasks for will have
540 // metrics on OS X (except for the current process, which always gets 542 // metrics on OS X (except for the current process, which always gets
541 // metrics). 543 // metrics).
542 virtual mach_port_t TaskForPid(ProcessHandle process) const = 0; 544 virtual mach_port_t TaskForPid(ProcessHandle process) const = 0;
543 }; 545 };
544 546
545 // The port provider needs to outlive the ProcessMetrics object returned by 547 // The port provider needs to outlive the ProcessMetrics object returned by
546 // this function. If NULL is passed as provider, the returned object 548 // this function. If NULL is passed as provider, the returned object
547 // only returns valid metrics if |process| is the current process. 549 // only returns valid metrics if |process| is the current process.
548 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process, 550 static ProcessMetrics* CreateProcessMetrics(ProcessHandle process,
549 PortProvider* port_provider); 551 PortProvider* port_provider);
550 #endif // !defined(OS_MACOSX) 552 #endif // !defined(OS_MACOSX)
551 553
552 ~ProcessMetrics();
553
554 // Returns the current space allocated for the pagefile, in bytes (these pages 554 // Returns the current space allocated for the pagefile, in bytes (these pages
555 // may or may not be in memory). On Linux, this returns the total virtual 555 // may or may not be in memory). On Linux, this returns the total virtual
556 // memory size. 556 // memory size.
557 size_t GetPagefileUsage() const; 557 size_t GetPagefileUsage() const;
558 // Returns the peak space allocated for the pagefile, in bytes. 558 // Returns the peak space allocated for the pagefile, in bytes.
559 size_t GetPeakPagefileUsage() const; 559 size_t GetPeakPagefileUsage() const;
560 // Returns the current working set size, in bytes. On Linux, this returns 560 // Returns the current working set size, in bytes. On Linux, this returns
561 // the resident set size. 561 // the resident set size.
562 size_t GetWorkingSetSize() const; 562 size_t GetWorkingSetSize() const;
563 // Returns the peak working set size, in bytes. 563 // Returns the peak working set size, in bytes.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 // instance running inside the parent. The parent's Breakpad instance should 669 // instance running inside the parent. The parent's Breakpad instance should
670 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler 670 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler
671 // in the child after forking will restore the standard exception handler. 671 // in the child after forking will restore the standard exception handler.
672 // See http://crbug.com/20371/ for more details. 672 // See http://crbug.com/20371/ for more details.
673 void RestoreDefaultExceptionHandler(); 673 void RestoreDefaultExceptionHandler();
674 #endif // defined(OS_MACOSX) 674 #endif // defined(OS_MACOSX)
675 675
676 } // namespace base 676 } // namespace base
677 677
678 #endif // BASE_PROCESS_UTIL_H_ 678 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« no previous file with comments | « base/platform_file.cc ('k') | base/ref_counted_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698