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

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

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_linux.cc ('k') | base/strings/string_split.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) 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 <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/time.h> 10 #include <sys/time.h>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 std::string totmaps_data; 310 std::string totmaps_data;
311 { 311 {
312 FilePath totmaps_file = internal::GetProcPidDir(process_).Append("totmaps"); 312 FilePath totmaps_file = internal::GetProcPidDir(process_).Append("totmaps");
313 ThreadRestrictions::ScopedAllowIO allow_io; 313 ThreadRestrictions::ScopedAllowIO allow_io;
314 bool ret = ReadFileToString(totmaps_file, &totmaps_data); 314 bool ret = ReadFileToString(totmaps_file, &totmaps_data);
315 if (!ret || totmaps_data.length() == 0) 315 if (!ret || totmaps_data.length() == 0)
316 return false; 316 return false;
317 } 317 }
318 318
319 std::vector<std::string> totmaps_fields; 319 std::vector<std::string> totmaps_fields = SplitString(
320 SplitStringAlongWhitespace(totmaps_data, &totmaps_fields); 320 totmaps_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE,
321 base::SPLIT_WANT_NONEMPTY);
321 322
322 DCHECK_EQ("Pss:", totmaps_fields[kPssIndex-1]); 323 DCHECK_EQ("Pss:", totmaps_fields[kPssIndex-1]);
323 DCHECK_EQ("Private_Clean:", totmaps_fields[kPrivate_CleanIndex - 1]); 324 DCHECK_EQ("Private_Clean:", totmaps_fields[kPrivate_CleanIndex - 1]);
324 DCHECK_EQ("Private_Dirty:", totmaps_fields[kPrivate_DirtyIndex - 1]); 325 DCHECK_EQ("Private_Dirty:", totmaps_fields[kPrivate_DirtyIndex - 1]);
325 DCHECK_EQ("Swap:", totmaps_fields[kSwapIndex-1]); 326 DCHECK_EQ("Swap:", totmaps_fields[kSwapIndex-1]);
326 327
327 int pss = 0; 328 int pss = 0;
328 int private_clean = 0; 329 int private_clean = 0;
329 int private_dirty = 0; 330 int private_dirty = 0;
330 int swap = 0; 331 int swap = 0;
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 #if defined(OS_LINUX) 904 #if defined(OS_LINUX)
904 int ProcessMetrics::GetIdleWakeupsPerSecond() { 905 int ProcessMetrics::GetIdleWakeupsPerSecond() {
905 uint64 wake_ups; 906 uint64 wake_ups;
906 const char kWakeupStat[] = "se.statistics.nr_wakeups"; 907 const char kWakeupStat[] = "se.statistics.nr_wakeups";
907 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ? 908 return ReadProcSchedAndGetFieldAsUint64(process_, kWakeupStat, &wake_ups) ?
908 CalculateIdleWakeupsPerSecond(wake_ups) : 0; 909 CalculateIdleWakeupsPerSecond(wake_ups) : 0;
909 } 910 }
910 #endif // defined(OS_LINUX) 911 #endif // defined(OS_LINUX)
911 912
912 } // namespace base 913 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_linux.cc ('k') | base/strings/string_split.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698