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

Side by Side Diff: base/trace_event/process_memory_maps.cc

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/trace_event/process_memory_maps.h" 5 #include "base/trace_event/process_memory_maps.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 10
11 namespace base { 11 namespace base {
12 namespace trace_event { 12 namespace trace_event {
13 13
14 // static 14 // static
15 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4; 15 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4;
16 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2; 16 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2;
17 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1; 17 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1;
18 18
19 ProcessMemoryMaps::VMRegion::VMRegion()
20 : start_address(0),
21 size_in_bytes(0),
22 protection_flags(0),
23 byte_stats_private_dirty_resident(0),
24 byte_stats_private_clean_resident(0),
25 byte_stats_shared_dirty_resident(0),
26 byte_stats_shared_clean_resident(0),
27 byte_stats_swapped(0),
28 byte_stats_proportional_resident(0) {
29 }
30
19 ProcessMemoryMaps::ProcessMemoryMaps() { 31 ProcessMemoryMaps::ProcessMemoryMaps() {
20 } 32 }
21 33
22 ProcessMemoryMaps::~ProcessMemoryMaps() { 34 ProcessMemoryMaps::~ProcessMemoryMaps() {
23 } 35 }
24 36
25 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const { 37 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const {
26 static const char kHexFmt[] = "%" PRIx64; 38 static const char kHexFmt[] = "%" PRIx64;
27 39
28 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields. 40 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields.
29 value->BeginArray("vm_regions"); 41 value->BeginArray("vm_regions");
30 for (const auto& region : vm_regions_) { 42 for (const auto& region : vm_regions_) {
31 value->BeginDictionary(); 43 value->BeginDictionary();
32 44
33 value->SetString("sa", StringPrintf(kHexFmt, region.start_address)); 45 value->SetString("sa", StringPrintf(kHexFmt, region.start_address));
34 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes)); 46 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes));
35 value->SetInteger("pf", region.protection_flags); 47 value->SetInteger("pf", region.protection_flags);
36 value->SetString("mf", region.mapped_file); 48 value->SetString("mf", region.mapped_file);
37 49
38 value->BeginDictionary("bs"); // byte stats 50 value->BeginDictionary("bs"); // byte stats
39 value->SetString( 51 value->SetString(
40 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident)); 52 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident));
41 value->SetString("prv", 53 value->SetString(
42 StringPrintf(kHexFmt, region.byte_stats_private_resident)); 54 "pd", StringPrintf(kHexFmt, region.byte_stats_private_dirty_resident));
43 value->SetString("shr", 55 value->SetString(
44 StringPrintf(kHexFmt, region.byte_stats_shared_resident)); 56 "pc", StringPrintf(kHexFmt, region.byte_stats_private_clean_resident));
57 value->SetString(
58 "sd", StringPrintf(kHexFmt, region.byte_stats_shared_dirty_resident));
59 value->SetString(
60 "sc", StringPrintf(kHexFmt, region.byte_stats_shared_clean_resident));
61 value->SetString("sw", StringPrintf(kHexFmt, region.byte_stats_swapped));
45 value->EndDictionary(); 62 value->EndDictionary();
46 63
47 value->EndDictionary(); 64 value->EndDictionary();
48 } 65 }
49 value->EndArray(); 66 value->EndArray();
50 } 67 }
51 68
69 void ProcessMemoryMaps::Clear() {
70 vm_regions_.clear();
71 }
72
52 } // namespace trace_event 73 } // namespace trace_event
53 } // namespace base 74 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/process_memory_maps.h ('k') | base/trace_event/process_memory_maps_dump_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698