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

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

Issue 1267573004: [tracing] Prevent memory maps dump for light dump requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@light_dumps
Patch Set: Typo. Created 5 years, 4 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 | « no previous file | no next file » | 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_dump_provider.h" 5 #include "base/trace_event/process_memory_maps_dump_provider.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <fstream> 8 #include <fstream>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ProcessMemoryMapsDumpProvider::ProcessMemoryMapsDumpProvider() { 160 ProcessMemoryMapsDumpProvider::ProcessMemoryMapsDumpProvider() {
161 } 161 }
162 162
163 ProcessMemoryMapsDumpProvider::~ProcessMemoryMapsDumpProvider() { 163 ProcessMemoryMapsDumpProvider::~ProcessMemoryMapsDumpProvider() {
164 } 164 }
165 165
166 // Called at trace dump point time. Creates a snapshot of the memory maps for 166 // Called at trace dump point time. Creates a snapshot of the memory maps for
167 // the current process. 167 // the current process.
168 bool ProcessMemoryMapsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, 168 bool ProcessMemoryMapsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
169 ProcessMemoryDump* pmd) { 169 ProcessMemoryDump* pmd) {
170 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested 170 // Snapshot of memory maps is not taken for light dump requests.
171 // (crbug.com/499731). 171 if (args.level_of_detail == MemoryDumpArgs::LEVEL_OF_DETAIL_LOW)
172 return true;
172 173
173 uint32 res = 0; 174 uint32 res = 0;
174 175
175 #if defined(OS_LINUX) || defined(OS_ANDROID) 176 #if defined(OS_LINUX) || defined(OS_ANDROID)
176 if (UNLIKELY(proc_smaps_for_testing)) { 177 if (UNLIKELY(proc_smaps_for_testing)) {
177 res = ReadLinuxProcSmapsFile(proc_smaps_for_testing, pmd->process_mmaps()); 178 res = ReadLinuxProcSmapsFile(proc_smaps_for_testing, pmd->process_mmaps());
178 } else { 179 } else {
179 std::ifstream proc_self_smaps("/proc/self/smaps"); 180 std::ifstream proc_self_smaps("/proc/self/smaps");
180 res = ReadLinuxProcSmapsFile(&proc_self_smaps, pmd->process_mmaps()); 181 res = ReadLinuxProcSmapsFile(&proc_self_smaps, pmd->process_mmaps());
181 } 182 }
182 #else 183 #else
183 LOG(ERROR) << "ProcessMemoryMaps dump provider is supported only on Linux"; 184 LOG(ERROR) << "ProcessMemoryMaps dump provider is supported only on Linux";
184 #endif 185 #endif
185 186
186 if (res > 0) { 187 if (res > 0) {
187 pmd->set_has_process_mmaps(); 188 pmd->set_has_process_mmaps();
188 return true; 189 return true;
189 } 190 }
190 191
191 return false; 192 return false;
192 } 193 }
193 194
194 } // namespace trace_event 195 } // namespace trace_event
195 } // namespace base 196 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698