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

Side by Side Diff: components/browser_watcher/postmortem_report_extractor.cc

Issue 2754483002: Add analyzer support for multiple processes. (Closed)
Patch Set: addressed review comments by manzagop Created 3 years, 8 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/debug/activity_tracker_unittest.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/browser_watcher/postmortem_report_extractor.h" 5 #include "components/browser_watcher/postmortem_report_extractor.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // Create a global analyzer. 210 // Create a global analyzer.
211 std::unique_ptr<GlobalActivityAnalyzer> global_analyzer = 211 std::unique_ptr<GlobalActivityAnalyzer> global_analyzer =
212 GlobalActivityAnalyzer::CreateWithFile(stability_file); 212 GlobalActivityAnalyzer::CreateWithFile(stability_file);
213 if (!global_analyzer) 213 if (!global_analyzer)
214 return ANALYZER_CREATION_FAILED; 214 return ANALYZER_CREATION_FAILED;
215 215
216 // Early exit if there is no data. 216 // Early exit if there is no data.
217 std::vector<std::string> log_messages = global_analyzer->GetLogMessages(); 217 std::vector<std::string> log_messages = global_analyzer->GetLogMessages();
218 ActivityUserData::Snapshot global_data_snapshot = 218 ActivityUserData::Snapshot global_data_snapshot =
219 global_analyzer->GetGlobalUserDataSnapshot(); 219 global_analyzer->GetGlobalDataSnapshot();
220 ThreadActivityAnalyzer* thread_analyzer = global_analyzer->GetFirstAnalyzer(); 220
221 // Extract data for only the first process.
222 // TODO(manzagop): Extend this to all processes.
223 int64_t pid = global_analyzer->GetFirstProcess();
224 ThreadActivityAnalyzer* thread_analyzer =
225 global_analyzer->GetFirstAnalyzer(pid);
221 if (log_messages.empty() && global_data_snapshot.empty() && 226 if (log_messages.empty() && global_data_snapshot.empty() &&
222 !thread_analyzer) { 227 !thread_analyzer) {
223 return DEBUG_FILE_NO_DATA; 228 return DEBUG_FILE_NO_DATA;
224 } 229 }
225 230
226 // Collect log messages. 231 // Collect log messages.
227 for (const std::string& message : log_messages) { 232 for (const std::string& message : log_messages) {
228 report->add_log_messages(message); 233 report->add_log_messages(message);
229 } 234 }
230 235
(...skipping 22 matching lines...) Expand all
253 CollectThread(thread_analyzer->activity_snapshot(), thread_state); 258 CollectThread(thread_analyzer->activity_snapshot(), thread_state);
254 } 259 }
255 260
256 // Collect module information. 261 // Collect module information.
257 CollectModuleInformation(global_analyzer->GetModules(), process_state); 262 CollectModuleInformation(global_analyzer->GetModules(), process_state);
258 263
259 return SUCCESS; 264 return SUCCESS;
260 } 265 }
261 266
262 } // namespace browser_watcher 267 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698