diff options
author | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 21:25:20 +0000 |
---|---|---|
committer | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 21:25:20 +0000 |
commit | f413478a5a9c008dfab8d760a698a90240c41551 (patch) | |
tree | 90ee3e550b528b42526f14e724c3baa724a30d8c /chrome/browser/memory_details_linux.cc | |
parent | ab55798cc3509e09d497d4df318f0c4415f6d2c9 (diff) | |
download | chromium_src-f413478a5a9c008dfab8d760a698a90240c41551.zip chromium_src-f413478a5a9c008dfab8d760a698a90240c41551.tar.gz chromium_src-f413478a5a9c008dfab8d760a698a90240c41551.tar.bz2 |
Move the SwapData class to base/process (where other system metrics data reside) and rename it to SwapInfo.
This only moves code and adds no new functionality.
This uses ScopedAllowIO. Since this is perfmon code to /proc, we have deemed that IO is acceptable.
BUG=236763
R=darin@chromium.org, nduca@chromium.org
Review URL: https://codereview.chromium.org/22780002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details_linux.cc')
-rw-r--r-- | chrome/browser/memory_details_linux.cc | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/chrome/browser/memory_details_linux.cc b/chrome/browser/memory_details_linux.cc index ec149da..03f000e 100644 --- a/chrome/browser/memory_details_linux.cc +++ b/chrome/browser/memory_details_linux.cc @@ -163,41 +163,6 @@ static std::vector<pid_t> GetAllChildren(const ProcessMap& processes, return children; } -#if defined(OS_CHROMEOS) -static uint64 ReadFileToUint64(const base::FilePath file) { - std::string file_as_string; - if (!file_util::ReadFileToString(file, &file_as_string)) - return 0; - TrimWhitespaceASCII(file_as_string, TRIM_ALL, &file_as_string); - uint64 file_as_uint64 = 0; - if (!base::StringToUint64(file_as_string, &file_as_uint64)) - return 0; - return file_as_uint64; -} - -static void GetSwapData(SwapData* swap_data) { - base::FilePath zram_path("/sys/block/zram0"); - uint64 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. - swap_data->orig_data_size = 0; - swap_data->num_reads = 0; - swap_data->num_writes = 0; - swap_data->compr_data_size = 0; - swap_data->mem_used_total = 0; - return; - } - swap_data->orig_data_size = orig_data_size; - swap_data->num_reads = ReadFileToUint64(zram_path.Append("num_reads")); - swap_data->num_writes = ReadFileToUint64(zram_path.Append("num_writes")); - swap_data->compr_data_size = - ReadFileToUint64(zram_path.Append("compr_data_size")); - swap_data->mem_used_total = - ReadFileToUint64(zram_path.Append("mem_used_total")); -} -#endif - void MemoryDetails::CollectProcessData( const std::vector<ProcessMemoryInformation>& child_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -269,7 +234,7 @@ void MemoryDetails::CollectProcessData( } #if defined(OS_CHROMEOS) - GetSwapData(&swap_data_); + base::GetSwapInfo(&swap_info_); #endif // Finally return to the browser thread. |