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

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

Issue 2869073002: Adding PE TimeStamp to chrome trace to ease retrieving debug information (Closed)
Patch Set: Created 3 years, 7 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_t ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4; 15 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsRead = 4;
16 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2; 16 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite = 2;
17 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1; 17 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsExec = 1;
18 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsMayshare = 128; 18 const uint32_t ProcessMemoryMaps::VMRegion::kProtectionFlagsMayshare = 128;
19 19
20 ProcessMemoryMaps::VMRegion::VMRegion() 20 ProcessMemoryMaps::VMRegion::VMRegion()
21 : start_address(0), 21 : start_address(0),
22 size_in_bytes(0), 22 size_in_bytes(0),
23 timestamp(0),
23 protection_flags(0), 24 protection_flags(0),
24 byte_stats_private_dirty_resident(0), 25 byte_stats_private_dirty_resident(0),
25 byte_stats_private_clean_resident(0), 26 byte_stats_private_clean_resident(0),
26 byte_stats_shared_dirty_resident(0), 27 byte_stats_shared_dirty_resident(0),
27 byte_stats_shared_clean_resident(0), 28 byte_stats_shared_clean_resident(0),
28 byte_stats_swapped(0), 29 byte_stats_swapped(0),
29 byte_stats_proportional_resident(0) { 30 byte_stats_proportional_resident(0) {
30 } 31 }
31 32
32 ProcessMemoryMaps::VMRegion::VMRegion(const VMRegion& other) = default; 33 ProcessMemoryMaps::VMRegion::VMRegion(const VMRegion& other) = default;
33 34
34 ProcessMemoryMaps::ProcessMemoryMaps() { 35 ProcessMemoryMaps::ProcessMemoryMaps() {
35 } 36 }
36 37
37 ProcessMemoryMaps::~ProcessMemoryMaps() { 38 ProcessMemoryMaps::~ProcessMemoryMaps() {
38 } 39 }
39 40
40 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const { 41 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const {
41 static const char kHexFmt[] = "%" PRIx64; 42 static const char kHexFmt[] = "%" PRIx64;
42 43
43 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields. 44 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields.
44 value->BeginArray("vm_regions"); 45 value->BeginArray("vm_regions");
45 for (const auto& region : vm_regions_) { 46 for (const auto& region : vm_regions_) {
46 value->BeginDictionary(); 47 value->BeginDictionary();
47 48
48 value->SetString("sa", StringPrintf(kHexFmt, region.start_address)); 49 value->SetString("sa", StringPrintf(kHexFmt, region.start_address));
49 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes)); 50 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes));
51 if (region.timestamp)
52 value->SetString("ts", StringPrintf(kHexFmt, region.timestamp));
50 value->SetInteger("pf", region.protection_flags); 53 value->SetInteger("pf", region.protection_flags);
51 value->SetString("mf", region.mapped_file); 54 value->SetString("mf", region.mapped_file);
52 55
53 value->BeginDictionary("bs"); // byte stats 56 value->BeginDictionary("bs"); // byte stats
54 value->SetString( 57 value->SetString(
55 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident)); 58 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident));
56 value->SetString( 59 value->SetString(
57 "pd", StringPrintf(kHexFmt, region.byte_stats_private_dirty_resident)); 60 "pd", StringPrintf(kHexFmt, region.byte_stats_private_dirty_resident));
58 value->SetString( 61 value->SetString(
59 "pc", StringPrintf(kHexFmt, region.byte_stats_private_clean_resident)); 62 "pc", StringPrintf(kHexFmt, region.byte_stats_private_clean_resident));
60 value->SetString( 63 value->SetString(
61 "sd", StringPrintf(kHexFmt, region.byte_stats_shared_dirty_resident)); 64 "sd", StringPrintf(kHexFmt, region.byte_stats_shared_dirty_resident));
62 value->SetString( 65 value->SetString(
63 "sc", StringPrintf(kHexFmt, region.byte_stats_shared_clean_resident)); 66 "sc", StringPrintf(kHexFmt, region.byte_stats_shared_clean_resident));
64 value->SetString("sw", StringPrintf(kHexFmt, region.byte_stats_swapped)); 67 value->SetString("sw", StringPrintf(kHexFmt, region.byte_stats_swapped));
65 value->EndDictionary(); 68 value->EndDictionary();
66 69
67 value->EndDictionary(); 70 value->EndDictionary();
68 } 71 }
69 value->EndArray(); 72 value->EndArray();
70 } 73 }
71 74
72 void ProcessMemoryMaps::Clear() { 75 void ProcessMemoryMaps::Clear() {
73 vm_regions_.clear(); 76 vm_regions_.clear();
74 } 77 }
75 78
76 } // namespace trace_event 79 } // namespace trace_event
77 } // namespace base 80 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698