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

Side by Side Diff: base/process/process_metrics.h

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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_info_win.cc ('k') | base/process/process_metrics.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 // This file contains routines for gathering resource statistics for processes 5 // This file contains routines for gathering resource statistics for processes
6 // running on the system. 6 // running on the system.
7 7
8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_ 8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_
9 #define BASE_PROCESS_PROCESS_METRICS_H_ 9 #define BASE_PROCESS_PROCESS_METRICS_H_
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Total/free memory are available on all platforms that implement 260 // Total/free memory are available on all platforms that implement
261 // GetSystemMemoryInfo(). Total/free swap memory are available on all platforms 261 // GetSystemMemoryInfo(). Total/free swap memory are available on all platforms
262 // except on Mac. Buffers/cached/active_anon/inactive_anon/active_file/ 262 // except on Mac. Buffers/cached/active_anon/inactive_anon/active_file/
263 // inactive_file/dirty/pswpin/pswpout/pgmajfault are available on 263 // inactive_file/dirty/pswpin/pswpout/pgmajfault are available on
264 // Linux/Android/Chrome OS. Shmem/slab/gem_objects/gem_size are Chrome OS only. 264 // Linux/Android/Chrome OS. Shmem/slab/gem_objects/gem_size are Chrome OS only.
265 struct BASE_EXPORT SystemMemoryInfoKB { 265 struct BASE_EXPORT SystemMemoryInfoKB {
266 SystemMemoryInfoKB(); 266 SystemMemoryInfoKB();
267 SystemMemoryInfoKB(const SystemMemoryInfoKB& other); 267 SystemMemoryInfoKB(const SystemMemoryInfoKB& other);
268 268
269 // Serializes the platform specific fields to value. 269 // Serializes the platform specific fields to value.
270 scoped_ptr<Value> ToValue() const; 270 std::unique_ptr<Value> ToValue() const;
271 271
272 int total; 272 int total;
273 int free; 273 int free;
274 274
275 #if !defined(OS_MACOSX) 275 #if !defined(OS_MACOSX)
276 int swap_total; 276 int swap_total;
277 int swap_free; 277 int swap_free;
278 #endif 278 #endif
279 279
280 #if defined(OS_ANDROID) || defined(OS_LINUX) 280 #if defined(OS_ANDROID) || defined(OS_LINUX)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // returns true on success or false for a parsing error 336 // returns true on success or false for a parsing error
337 BASE_EXPORT bool ParseProcVmstat(const std::string& input, 337 BASE_EXPORT bool ParseProcVmstat(const std::string& input,
338 SystemMemoryInfoKB* meminfo); 338 SystemMemoryInfoKB* meminfo);
339 339
340 // Data from /proc/diskstats about system-wide disk I/O. 340 // Data from /proc/diskstats about system-wide disk I/O.
341 struct BASE_EXPORT SystemDiskInfo { 341 struct BASE_EXPORT SystemDiskInfo {
342 SystemDiskInfo(); 342 SystemDiskInfo();
343 SystemDiskInfo(const SystemDiskInfo& other); 343 SystemDiskInfo(const SystemDiskInfo& other);
344 344
345 // Serializes the platform specific fields to value. 345 // Serializes the platform specific fields to value.
346 scoped_ptr<Value> ToValue() const; 346 std::unique_ptr<Value> ToValue() const;
347 347
348 uint64_t reads; 348 uint64_t reads;
349 uint64_t reads_merged; 349 uint64_t reads_merged;
350 uint64_t sectors_read; 350 uint64_t sectors_read;
351 uint64_t read_time; 351 uint64_t read_time;
352 uint64_t writes; 352 uint64_t writes;
353 uint64_t writes_merged; 353 uint64_t writes_merged;
354 uint64_t sectors_written; 354 uint64_t sectors_written;
355 uint64_t write_time; 355 uint64_t write_time;
356 uint64_t io; 356 uint64_t io;
(...skipping 16 matching lines...) Expand all
373 struct BASE_EXPORT SwapInfo { 373 struct BASE_EXPORT SwapInfo {
374 SwapInfo() 374 SwapInfo()
375 : num_reads(0), 375 : num_reads(0),
376 num_writes(0), 376 num_writes(0),
377 compr_data_size(0), 377 compr_data_size(0),
378 orig_data_size(0), 378 orig_data_size(0),
379 mem_used_total(0) { 379 mem_used_total(0) {
380 } 380 }
381 381
382 // Serializes the platform specific fields to value. 382 // Serializes the platform specific fields to value.
383 scoped_ptr<Value> ToValue() const; 383 std::unique_ptr<Value> ToValue() const;
384 384
385 uint64_t num_reads; 385 uint64_t num_reads;
386 uint64_t num_writes; 386 uint64_t num_writes;
387 uint64_t compr_data_size; 387 uint64_t compr_data_size;
388 uint64_t orig_data_size; 388 uint64_t orig_data_size;
389 uint64_t mem_used_total; 389 uint64_t mem_used_total;
390 }; 390 };
391 391
392 // In ChromeOS, reads files from /sys/block/zram0 that contain ZRAM usage data. 392 // In ChromeOS, reads files from /sys/block/zram0 that contain ZRAM usage data.
393 // Fills in the provided |swap_data| structure. 393 // Fills in the provided |swap_data| structure.
394 BASE_EXPORT void GetSwapInfo(SwapInfo* swap_info); 394 BASE_EXPORT void GetSwapInfo(SwapInfo* swap_info);
395 #endif // defined(OS_CHROMEOS) 395 #endif // defined(OS_CHROMEOS)
396 396
397 // Collects and holds performance metrics for system memory and disk. 397 // Collects and holds performance metrics for system memory and disk.
398 // Provides functionality to retrieve the data on various platforms and 398 // Provides functionality to retrieve the data on various platforms and
399 // to serialize the stored data. 399 // to serialize the stored data.
400 class SystemMetrics { 400 class SystemMetrics {
401 public: 401 public:
402 SystemMetrics(); 402 SystemMetrics();
403 403
404 static SystemMetrics Sample(); 404 static SystemMetrics Sample();
405 405
406 // Serializes the system metrics to value. 406 // Serializes the system metrics to value.
407 scoped_ptr<Value> ToValue() const; 407 std::unique_ptr<Value> ToValue() const;
408 408
409 private: 409 private:
410 FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics); 410 FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
411 411
412 size_t committed_memory_; 412 size_t committed_memory_;
413 #if defined(OS_LINUX) || defined(OS_ANDROID) 413 #if defined(OS_LINUX) || defined(OS_ANDROID)
414 SystemMemoryInfoKB memory_info_; 414 SystemMemoryInfoKB memory_info_;
415 SystemDiskInfo disk_info_; 415 SystemDiskInfo disk_info_;
416 #endif 416 #endif
417 #if defined(OS_CHROMEOS) 417 #if defined(OS_CHROMEOS)
418 SwapInfo swap_info_; 418 SwapInfo swap_info_;
419 #endif 419 #endif
420 }; 420 };
421 421
422 } // namespace base 422 } // namespace base
423 423
424 #endif // BASE_PROCESS_PROCESS_METRICS_H_ 424 #endif // BASE_PROCESS_PROCESS_METRICS_H_
OLDNEW
« no previous file with comments | « base/process/process_info_win.cc ('k') | base/process/process_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698