| Index: base/process/process_metrics_linux.cc
|
| diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc
|
| index 4d98772670e4ea045f0d2c731a7d1d89b1fb07f6..bcebcf5729fda730528c49119c3c58c19e0ac6dc 100644
|
| --- a/base/process/process_metrics_linux.cc
|
| +++ b/base/process/process_metrics_linux.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include <dirent.h>
|
| #include <fcntl.h>
|
| +#include <stddef.h>
|
| +#include <stdint.h>
|
| #include <sys/stat.h>
|
| #include <sys/time.h>
|
| #include <sys/types.h>
|
| @@ -22,6 +24,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/sys_info.h"
|
| #include "base/threading/thread_restrictions.h"
|
| +#include "build/build_config.h"
|
|
|
| namespace base {
|
|
|
| @@ -37,13 +40,13 @@ void TrimKeyValuePairs(StringPairs* pairs) {
|
| }
|
|
|
| #if defined(OS_CHROMEOS)
|
| -// Read a file with a single number string and return the number as a uint64.
|
| -static uint64 ReadFileToUint64(const FilePath file) {
|
| +// Read a file with a single number string and return the number as a uint64_t.
|
| +static uint64_t ReadFileToUint64(const FilePath file) {
|
| std::string file_as_string;
|
| if (!ReadFileToString(file, &file_as_string))
|
| return 0;
|
| TrimWhitespaceASCII(file_as_string, TRIM_ALL, &file_as_string);
|
| - uint64 file_as_uint64 = 0;
|
| + uint64_t file_as_uint64 = 0;
|
| if (!StringToUint64(file_as_string, &file_as_uint64))
|
| return 0;
|
| return file_as_uint64;
|
| @@ -93,7 +96,7 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) {
|
| // Only works for fields in the form of "field : uint_value"
|
| bool ReadProcSchedAndGetFieldAsUint64(pid_t pid,
|
| const std::string& field,
|
| - uint64* result) {
|
| + uint64_t* result) {
|
| std::string sched_data;
|
| {
|
| // Synchronously reading files in /proc does not hit the disk.
|
| @@ -110,7 +113,7 @@ bool ReadProcSchedAndGetFieldAsUint64(pid_t pid,
|
| const std::string& key = pairs[i].first;
|
| const std::string& value_str = pairs[i].second;
|
| if (key == field) {
|
| - uint64 value;
|
| + uint64_t value;
|
| if (!StringToUint64(value_str, &value))
|
| return false;
|
| *result = value;
|
| @@ -270,7 +273,7 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
|
| for (size_t i = 0; i < pairs.size(); ++i) {
|
| const std::string& key = pairs[i].first;
|
| const std::string& value_str = pairs[i].second;
|
| - uint64* target_counter = NULL;
|
| + uint64_t* target_counter = NULL;
|
| if (key == "syscr")
|
| target_counter = &io_counters->ReadOperationCount;
|
| else if (key == "syscw")
|
| @@ -766,7 +769,7 @@ SystemDiskInfo::SystemDiskInfo() {
|
| scoped_ptr<Value> SystemDiskInfo::ToValue() const {
|
| scoped_ptr<DictionaryValue> res(new DictionaryValue());
|
|
|
| - // Write out uint64 variables as doubles.
|
| + // Write out uint64_t variables as doubles.
|
| // Note: this may discard some precision, but for JS there's no other option.
|
| res->SetDouble("reads", static_cast<double>(reads));
|
| res->SetDouble("reads_merged", static_cast<double>(reads_merged));
|
| @@ -841,17 +844,17 @@ bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
|
| diskinfo->io_time = 0;
|
| diskinfo->weighted_io_time = 0;
|
|
|
| - uint64 reads = 0;
|
| - uint64 reads_merged = 0;
|
| - uint64 sectors_read = 0;
|
| - uint64 read_time = 0;
|
| - uint64 writes = 0;
|
| - uint64 writes_merged = 0;
|
| - uint64 sectors_written = 0;
|
| - uint64 write_time = 0;
|
| - uint64 io = 0;
|
| - uint64 io_time = 0;
|
| - uint64 weighted_io_time = 0;
|
| + uint64_t reads = 0;
|
| + uint64_t reads_merged = 0;
|
| + uint64_t sectors_read = 0;
|
| + uint64_t read_time = 0;
|
| + uint64_t writes = 0;
|
| + uint64_t writes_merged = 0;
|
| + uint64_t sectors_written = 0;
|
| + uint64_t write_time = 0;
|
| + uint64_t io = 0;
|
| + uint64_t io_time = 0;
|
| + uint64_t weighted_io_time = 0;
|
|
|
| for (const StringPiece& line : diskinfo_lines) {
|
| std::vector<StringPiece> disk_fields = SplitStringPiece(
|
| @@ -892,7 +895,7 @@ bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
|
| scoped_ptr<Value> SwapInfo::ToValue() const {
|
| scoped_ptr<DictionaryValue> res(new DictionaryValue());
|
|
|
| - // Write out uint64 variables as doubles.
|
| + // Write out uint64_t variables as doubles.
|
| // Note: this may discard some precision, but for JS there's no other option.
|
| res->SetDouble("num_reads", static_cast<double>(num_reads));
|
| res->SetDouble("num_writes", static_cast<double>(num_writes));
|
| @@ -913,7 +916,8 @@ void GetSwapInfo(SwapInfo* swap_info) {
|
| ThreadRestrictions::ScopedAllowIO allow_io;
|
|
|
| FilePath zram_path("/sys/block/zram0");
|
| - uint64 orig_data_size = ReadFileToUint64(zram_path.Append("orig_data_size"));
|
| + uint64_t orig_data_size =
|
| + ReadFileToUint64(zram_path.Append("orig_data_size"));
|
| if (orig_data_size <= 4096) {
|
| // A single page is compressed at startup, and has a high compression
|
| // ratio. We ignore this as it doesn't indicate any real swapping.
|
| @@ -936,7 +940,7 @@ void GetSwapInfo(SwapInfo* swap_info) {
|
|
|
| #if defined(OS_LINUX)
|
| int ProcessMetrics::GetIdleWakeupsPerSecond() {
|
| - uint64 wake_ups;
|
| + uint64_t wake_ups;
|
| const char kWakeupStat[] = "se.statistics.nr_wakeups";
|
| return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
|
| CalculateIdleWakeupsPerSecond(wake_ups) : 0;
|
|
|