| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2014 Google Inc. | 2  * Copyright 2014 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #ifndef ProcStats_DEFINED | 8 #ifndef ProcStats_DEFINED | 
| 9 #define ProcStats_DEFINED | 9 #define ProcStats_DEFINED | 
| 10 | 10 | 
| 11 /** | 11 /** | 
| 12  * ProcStats - Process Statistics Functions | 12  * ProcStats - Process Statistics Functions | 
| 13  */ | 13  */ | 
| 14 | 14 | 
| 15 namespace sk_tools { | 15 namespace sk_tools { | 
| 16 | 16 | 
| 17 /** | 17 /** | 
| 18  *  If not implemented for this OS, returns -1.  Otherwise, return | 18  *  If implemented, returns the maximum resident set size in MB. | 
| 19  *  the maximum resident set size, as reported by getrusage(). | 19  *  If not, returns -1. | 
| 20  */ | 20  */ | 
| 21 int getMaxResidentSetSizeMB(); | 21 int getMaxResidentSetSizeMB(); | 
| 22 | 22 | 
|  | 23 /** | 
|  | 24  *  If implemented, returns the current resident set size in MB. | 
|  | 25  *  If not, returns -1. | 
|  | 26  */ | 
|  | 27 int getCurrResidentSetSizeMB(); | 
|  | 28 | 
|  | 29 /** | 
|  | 30  *  If implemented, returns getCurrResidentSetSizeMB(). | 
|  | 31  *  If not, if implemented, returns getMaxResidentSetSizeMB(). | 
|  | 32  *  If not, returns -1. | 
|  | 33  */ | 
|  | 34 inline int getBestResidentSetSizeMB() { | 
|  | 35     int mb = getCurrResidentSetSizeMB(); | 
|  | 36     return mb >= 0 ? mb : getMaxResidentSetSizeMB(); | 
|  | 37 } | 
|  | 38 | 
| 23 }  // namespace sk_tools | 39 }  // namespace sk_tools | 
| 24 | 40 | 
| 25 #endif  // ProcStats_DEFINED | 41 #endif  // ProcStats_DEFINED | 
| OLD | NEW | 
|---|