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

Side by Side Diff: base/process/process_metrics_linux.cc

Issue 2188043003: Linux: Increase storage size of vmstat data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Swap EXPECT order Created 4 years, 4 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
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_metrics_unittest.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/process_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 // We iterate through the whole file because the position of the 680 // We iterate through the whole file because the position of the
681 // fields are dependent on the kernel version and configuration. 681 // fields are dependent on the kernel version and configuration.
682 682
683 for (const StringPiece& line : SplitStringPiece( 683 for (const StringPiece& line : SplitStringPiece(
684 vmstat_data, "\n", KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY)) { 684 vmstat_data, "\n", KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY)) {
685 std::vector<StringPiece> tokens = SplitStringPiece( 685 std::vector<StringPiece> tokens = SplitStringPiece(
686 line, " ", KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY); 686 line, " ", KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY);
687 if (tokens.size() != 2) 687 if (tokens.size() != 2)
688 continue; 688 continue;
689 689
690 uint64_t val;
691 if (!StringToUint64(tokens[1], &val))
692 continue;
693
690 if (tokens[0] == "pswpin") { 694 if (tokens[0] == "pswpin") {
691 StringToInt(tokens[1], &meminfo->pswpin); 695 meminfo->pswpin = val;
692 } else if (tokens[0] == "pswpout") { 696 } else if (tokens[0] == "pswpout") {
693 StringToInt(tokens[1], &meminfo->pswpout); 697 meminfo->pswpout = val;
694 } else if (tokens[0] == "pgmajfault") { 698 } else if (tokens[0] == "pgmajfault") {
695 StringToInt(tokens[1], &meminfo->pgmajfault); 699 meminfo->pgmajfault = val;
696 } 700 }
697 } 701 }
698 702
699 return true; 703 return true;
700 } 704 }
701 705
702 bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) { 706 bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
703 // Synchronously reading files in /proc and /sys are safe. 707 // Synchronously reading files in /proc and /sys are safe.
704 ThreadRestrictions::ScopedAllowIO allow_io; 708 ThreadRestrictions::ScopedAllowIO allow_io;
705 709
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 #if defined(OS_LINUX) 962 #if defined(OS_LINUX)
959 int ProcessMetrics::GetIdleWakeupsPerSecond() { 963 int ProcessMetrics::GetIdleWakeupsPerSecond() {
960 uint64_t wake_ups; 964 uint64_t wake_ups;
961 const char kWakeupStat[] = "se.statistics.nr_wakeups"; 965 const char kWakeupStat[] = "se.statistics.nr_wakeups";
962 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? 966 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
963 CalculateIdleWakeupsPerSecond(wake_ups) : 0; 967 CalculateIdleWakeupsPerSecond(wake_ups) : 0;
964 } 968 }
965 #endif // defined(OS_LINUX) 969 #endif // defined(OS_LINUX)
966 970
967 } // namespace base 971 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698