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

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

Issue 2838913002: memory-infra: Add SUMMARY_ONLY MemoryDumpType (Closed)
Patch Set: return true if summary only not added to trace 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
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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 // The results struct to fill. 733 // The results struct to fill.
734 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 734 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
735 base::Optional<MemoryDumpCallbackResult> result; 735 base::Optional<MemoryDumpCallbackResult> result;
736 736
737 bool dump_successful = pmd_async_state->dump_successful; 737 bool dump_successful = pmd_async_state->dump_successful;
738 738
739 for (const auto& kv : pmd_async_state->process_dumps) { 739 for (const auto& kv : pmd_async_state->process_dumps) {
740 ProcessId pid = kv.first; // kNullProcessId for the current process. 740 ProcessId pid = kv.first; // kNullProcessId for the current process.
741 ProcessMemoryDump* process_memory_dump = kv.second.get(); 741 ProcessMemoryDump* process_memory_dump = kv.second.get();
742 742
743 bool added_to_trace = tracing_observer_->AddDumpToTraceIfEnabled( 743 // Some dumps are requested just to cacluate the summary. These shouldn't
Primiano Tucci (use gerrit) 2017/04/25 18:02:22 s/some dumps/SUMMARY_ONLY/ s/just to cacluate the
hjd 2017/04/26 11:11:57 Done.
744 &pmd_async_state->req_args, pid, process_memory_dump); 744 // be added to the trace to avoid confusing trace consumers.
745 if (pmd_async_state->req_args.dump_type != MemoryDumpType::SUMMARY_ONLY) {
746 bool added_to_trace = tracing_observer_->AddDumpToTraceIfEnabled(
747 &pmd_async_state->req_args, pid, process_memory_dump);
745 748
746 dump_successful = dump_successful && added_to_trace; 749 dump_successful = dump_successful && added_to_trace;
750 }
747 751
748 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 752 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
749 // Don't try to fill the struct in detailed mode since it is hard to avoid 753 // Don't try to fill the struct in detailed mode since it is hard to avoid
750 // double counting. 754 // double counting.
751 if (pmd_async_state->req_args.level_of_detail == 755 if (pmd_async_state->req_args.level_of_detail ==
752 MemoryDumpLevelOfDetail::DETAILED) 756 MemoryDumpLevelOfDetail::DETAILED)
753 continue; 757 continue;
754 if (!result.has_value()) 758 if (!result.has_value())
755 result = MemoryDumpCallbackResult(); 759 result = MemoryDumpCallbackResult();
756 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203 760 // TODO(hjd): Transitional until we send the full PMD. See crbug.com/704203
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 if (iter == process_dumps.end()) { 936 if (iter == process_dumps.end()) {
933 std::unique_ptr<ProcessMemoryDump> new_pmd( 937 std::unique_ptr<ProcessMemoryDump> new_pmd(
934 new ProcessMemoryDump(session_state, dump_args)); 938 new ProcessMemoryDump(session_state, dump_args));
935 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 939 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
936 } 940 }
937 return iter->second.get(); 941 return iter->second.get();
938 } 942 }
939 943
940 } // namespace trace_event 944 } // namespace trace_event
941 } // namespace base 945 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | base/trace_event/memory_dump_manager_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698