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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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"
8 #include "base/strings/stringprintf.h"
7 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
8 10
9 namespace base { 11 namespace base {
10 namespace trace_event { 12 namespace trace_event {
11 13
12 // static 14 // static
13 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4; 15 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4;
14 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2; 16 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2;
15 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1; 17 const uint32 ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1;
16 18
17 ProcessMemoryMaps::ProcessMemoryMaps() { 19 ProcessMemoryMaps::ProcessMemoryMaps() {
18 } 20 }
19 21
20 ProcessMemoryMaps::~ProcessMemoryMaps() { 22 ProcessMemoryMaps::~ProcessMemoryMaps() {
21 } 23 }
22 24
23 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const { 25 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const {
26 static const char kHexFmt[] = "%" PRIx64;
27
28 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields.
24 value->BeginArray("vm_regions"); 29 value->BeginArray("vm_regions");
25 for (const auto& region : vm_regions_) { 30 for (const auto& region : vm_regions_) {
26 value->BeginDictionary(); 31 value->BeginDictionary();
27 32
28 value->SetDouble("start_address", region.start_address); 33 value->SetString("sa", StringPrintf(kHexFmt, region.start_address));
29 value->SetDouble("size_in_bytes", region.size_in_bytes); 34 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes));
30 value->SetInteger("protection_flags", region.protection_flags); 35 value->SetInteger("pf", region.protection_flags);
31 value->SetString("mapped_file", region.mapped_file); 36 value->SetString("mf", region.mapped_file);
32 value->SetDouble("mapped_file_offset", region.mapped_file_offset);
33 37
34 value->BeginDictionary("byte_stats"); 38 value->BeginDictionary("bs"); // byte stats
35 value->SetDouble("resident", region.byte_stats_resident); 39 value->SetString(
36 value->SetDouble("anonymous", region.byte_stats_anonymous); 40 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident));
41 value->SetString("prv",
42 StringPrintf(kHexFmt, region.byte_stats_private_resident));
43 value->SetString("shr",
44 StringPrintf(kHexFmt, region.byte_stats_shared_resident));
37 value->EndDictionary(); 45 value->EndDictionary();
38 46
39 value->EndDictionary(); 47 value->EndDictionary();
40 } 48 }
41 value->EndArray(); 49 value->EndArray();
42 } 50 }
43 51
44 } // namespace trace_event 52 } // namespace trace_event
45 } // namespace base 53 } // 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