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

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

Issue 2838913002: memory-infra: Add SUMMARY_ONLY MemoryDumpType (Closed)
Patch Set: fix for rebase 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 | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('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/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 // The results struct to fill. 736 // The results struct to fill.
737 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 737 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
738 base::Optional<MemoryDumpCallbackResult> result; 738 base::Optional<MemoryDumpCallbackResult> result;
739 739
740 bool dump_successful = pmd_async_state->dump_successful; 740 bool dump_successful = pmd_async_state->dump_successful;
741 741
742 for (const auto& kv : pmd_async_state->process_dumps) { 742 for (const auto& kv : pmd_async_state->process_dumps) {
743 ProcessId pid = kv.first; // kNullProcessId for the current process. 743 ProcessId pid = kv.first; // kNullProcessId for the current process.
744 ProcessMemoryDump* process_memory_dump = kv.second.get(); 744 ProcessMemoryDump* process_memory_dump = kv.second.get();
745 745
746 bool added_to_trace = tracing_observer_->AddDumpToTraceIfEnabled( 746 // SUMMARY_ONLY dumps are just return the summarized result in the
747 &pmd_async_state->req_args, pid, process_memory_dump); 747 // ProcessMemoryDumpCallback. These shouldn't be added to the trace to
748 // avoid confusing trace consumers.
749 if (pmd_async_state->req_args.dump_type != MemoryDumpType::SUMMARY_ONLY) {
750 bool added_to_trace = tracing_observer_->AddDumpToTraceIfEnabled(
751 &pmd_async_state->req_args, pid, process_memory_dump);
748 752
749 dump_successful = dump_successful && added_to_trace; 753 dump_successful = dump_successful && added_to_trace;
754 }
750 755
751 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 756 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
752 // Don't try to fill the struct in detailed mode since it is hard to avoid 757 // Don't try to fill the struct in detailed mode since it is hard to avoid
753 // double counting. 758 // double counting.
754 if (pmd_async_state->req_args.level_of_detail == 759 if (pmd_async_state->req_args.level_of_detail ==
755 MemoryDumpLevelOfDetail::DETAILED) 760 MemoryDumpLevelOfDetail::DETAILED)
756 continue; 761 continue;
757 if (!result.has_value()) 762 if (!result.has_value())
758 result = MemoryDumpCallbackResult(); 763 result = MemoryDumpCallbackResult();
759 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 764 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 if (iter == process_dumps.end()) { 941 if (iter == process_dumps.end()) {
937 std::unique_ptr<ProcessMemoryDump> new_pmd( 942 std::unique_ptr<ProcessMemoryDump> new_pmd(
938 new ProcessMemoryDump(session_state, dump_args)); 943 new ProcessMemoryDump(session_state, dump_args));
939 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 944 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
940 } 945 }
941 return iter->second.get(); 946 return iter->second.get();
942 } 947 }
943 948
944 } // namespace trace_event 949 } // namespace trace_event
945 } // namespace base 950 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698