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

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: dcheng comments Created 3 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
« no previous file with comments | « base/trace_event/process_memory_maps.h ('k') | base/win/BUILD.gn » ('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 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 module_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 ProcessMemoryMaps::VMRegion::VMRegion(const VMRegion& other) = default; 32 ProcessMemoryMaps::VMRegion::VMRegion(const VMRegion& other) = default;
33 33
34 ProcessMemoryMaps::ProcessMemoryMaps() { 34 ProcessMemoryMaps::ProcessMemoryMaps() {
35 } 35 }
36 36
37 ProcessMemoryMaps::~ProcessMemoryMaps() { 37 ProcessMemoryMaps::~ProcessMemoryMaps() {
38 } 38 }
39 39
40 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const { 40 void ProcessMemoryMaps::AsValueInto(TracedValue* value) const {
41 static const char kHexFmt[] = "%" PRIx64; 41 static const char kHexFmt[] = "%" PRIx64;
42 42
43 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields. 43 // Refer to the design doc goo.gl/sxfFY8 for the semantic of these fields.
44 value->BeginArray("vm_regions"); 44 value->BeginArray("vm_regions");
45 for (const auto& region : vm_regions_) { 45 for (const auto& region : vm_regions_) {
46 value->BeginDictionary(); 46 value->BeginDictionary();
47 47
48 value->SetString("sa", StringPrintf(kHexFmt, region.start_address)); 48 value->SetString("sa", StringPrintf(kHexFmt, region.start_address));
49 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes)); 49 value->SetString("sz", StringPrintf(kHexFmt, region.size_in_bytes));
50 if (region.module_timestamp)
51 value->SetString("ts", StringPrintf(kHexFmt, region.module_timestamp));
50 value->SetInteger("pf", region.protection_flags); 52 value->SetInteger("pf", region.protection_flags);
51 value->SetString("mf", region.mapped_file); 53 value->SetString("mf", region.mapped_file);
52 54
53 value->BeginDictionary("bs"); // byte stats 55 value->BeginDictionary("bs"); // byte stats
54 value->SetString( 56 value->SetString(
55 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident)); 57 "pss", StringPrintf(kHexFmt, region.byte_stats_proportional_resident));
56 value->SetString( 58 value->SetString(
57 "pd", StringPrintf(kHexFmt, region.byte_stats_private_dirty_resident)); 59 "pd", StringPrintf(kHexFmt, region.byte_stats_private_dirty_resident));
58 value->SetString( 60 value->SetString(
59 "pc", StringPrintf(kHexFmt, region.byte_stats_private_clean_resident)); 61 "pc", StringPrintf(kHexFmt, region.byte_stats_private_clean_resident));
60 value->SetString( 62 value->SetString(
61 "sd", StringPrintf(kHexFmt, region.byte_stats_shared_dirty_resident)); 63 "sd", StringPrintf(kHexFmt, region.byte_stats_shared_dirty_resident));
62 value->SetString( 64 value->SetString(
63 "sc", StringPrintf(kHexFmt, region.byte_stats_shared_clean_resident)); 65 "sc", StringPrintf(kHexFmt, region.byte_stats_shared_clean_resident));
64 value->SetString("sw", StringPrintf(kHexFmt, region.byte_stats_swapped)); 66 value->SetString("sw", StringPrintf(kHexFmt, region.byte_stats_swapped));
65 value->EndDictionary(); 67 value->EndDictionary();
66 68
67 value->EndDictionary(); 69 value->EndDictionary();
68 } 70 }
69 value->EndArray(); 71 value->EndArray();
70 } 72 }
71 73
72 void ProcessMemoryMaps::Clear() { 74 void ProcessMemoryMaps::Clear() {
73 vm_regions_.clear(); 75 vm_regions_.clear();
74 } 76 }
75 77
76 } // namespace trace_event 78 } // namespace trace_event
77 } // namespace base 79 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/process_memory_maps.h ('k') | base/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698