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

Unified Diff: components/browser_watcher/postmortem_report_extractor.cc

Issue 2748823002: Stability file: collect generic activities (Closed)
Patch Set: Update dump_postmortem Created 3 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 side-by-side diff with in-line comments
Download patch
Index: components/browser_watcher/postmortem_report_extractor.cc
diff --git a/components/browser_watcher/postmortem_report_extractor.cc b/components/browser_watcher/postmortem_report_extractor.cc
index e0dd775564952dafeabb54dc45e93a7b04bf3eaf..bd12a9a03b4b87f9892195c6a3806bd1d6fce629 100644
--- a/components/browser_watcher/postmortem_report_extractor.cc
+++ b/components/browser_watcher/postmortem_report_extractor.cc
@@ -140,6 +140,47 @@ void CollectModuleInformation(
}
}
+void CollectActivity(const base::debug::Activity& recorded,
+ Activity* collected) {
+ DCHECK(collected);
+
+ collected->set_time(recorded.time_internal);
+ collected->set_address(recorded.calling_address);
+ collected->set_origin_address(recorded.origin_address);
+
+ // TODO(manzagop): the current collection deals with specific activity types;
+ // consider modifying it to handle the notion of activity categories.
+ switch (recorded.activity_type) {
+ case base::debug::Activity::ACT_TASK_RUN:
+ collected->set_type(Activity::ACT_TASK_RUN);
+ collected->set_task_sequence_id(recorded.data.task.sequence_id);
+ break;
+ case base::debug::Activity::ACT_LOCK_ACQUIRE:
+ collected->set_type(Activity::ACT_LOCK_ACQUIRE);
+ collected->set_lock_address(recorded.data.lock.lock_address);
+ break;
+ case base::debug::Activity::ACT_EVENT_WAIT:
+ collected->set_type(Activity::ACT_EVENT_WAIT);
+ collected->set_event_address(recorded.data.event.event_address);
+ break;
+ case base::debug::Activity::ACT_THREAD_JOIN:
+ collected->set_type(Activity::ACT_THREAD_JOIN);
+ collected->set_thread_id(recorded.data.thread.thread_id);
+ break;
+ case base::debug::Activity::ACT_PROCESS_WAIT:
+ collected->set_type(Activity::ACT_PROCESS_WAIT);
+ collected->set_process_id(recorded.data.process.process_id);
+ break;
+ case base::debug::Activity::ACT_GENERIC:
+ collected->set_type(Activity::ACT_GENERIC);
+ collected->set_generic_id(recorded.data.generic.id);
+ collected->set_generic_data(recorded.data.generic.info);
+ break;
+ default:
+ break;
+ }
+}
+
void CollectThread(
const base::debug::ThreadActivityAnalyzer::Snapshot& snapshot,
ThreadState* thread_state) {
@@ -150,37 +191,9 @@ void CollectThread(
thread_state->set_activity_count(snapshot.activity_stack_depth);
for (size_t i = 0; i < snapshot.activity_stack.size(); ++i) {
- const base::debug::Activity& recorded = snapshot.activity_stack[i];
Activity* collected = thread_state->add_activities();
- // Collect activity.
- switch (recorded.activity_type) {
- case base::debug::Activity::ACT_TASK_RUN:
- collected->set_type(Activity::ACT_TASK_RUN);
- collected->set_origin_address(recorded.origin_address);
- collected->set_task_sequence_id(recorded.data.task.sequence_id);
- break;
- case base::debug::Activity::ACT_LOCK_ACQUIRE:
- collected->set_type(Activity::ACT_LOCK_ACQUIRE);
- collected->set_lock_address(recorded.data.lock.lock_address);
- break;
- case base::debug::Activity::ACT_EVENT_WAIT:
- collected->set_type(Activity::ACT_EVENT_WAIT);
- collected->set_event_address(recorded.data.event.event_address);
- break;
- case base::debug::Activity::ACT_THREAD_JOIN:
- collected->set_type(Activity::ACT_THREAD_JOIN);
- collected->set_thread_id(recorded.data.thread.thread_id);
- break;
- case base::debug::Activity::ACT_PROCESS_WAIT:
- collected->set_type(Activity::ACT_PROCESS_WAIT);
- collected->set_process_id(recorded.data.process.process_id);
- break;
- default:
- break;
- }
-
- // Collect user data.
+ CollectActivity(snapshot.activity_stack[i], collected);
if (i < snapshot.user_data_stack.size()) {
CollectUserData(snapshot.user_data_stack[i],
collected->mutable_user_data(), nullptr);
« no previous file with comments | « components/browser_watcher/postmortem_report_collector_unittest.cc ('k') | components/browser_watcher/stability_report.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698