| OLD | NEW |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 wrapped_callback.Reset(); | 96 wrapped_callback.Reset(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void FillOsDumpFromProcessMemoryDump( | 100 void FillOsDumpFromProcessMemoryDump( |
| 101 const ProcessMemoryDump* pmd, | 101 const ProcessMemoryDump* pmd, |
| 102 MemoryDumpCallbackResult::OSMemDump* osDump) { | 102 MemoryDumpCallbackResult::OSMemDump* osDump) { |
| 103 if (pmd->has_process_totals()) { | 103 if (pmd->has_process_totals()) { |
| 104 const ProcessMemoryTotals* totals = pmd->process_totals(); | 104 const ProcessMemoryTotals* totals = pmd->process_totals(); |
| 105 osDump->resident_set_kb = totals->resident_set_bytes() / 1024; | 105 osDump->resident_set_kb = totals->resident_set_bytes() / 1024; |
| 106 osDump->platform_private_footprint = totals->GetPlatformPrivateFootprint(); |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Proxy class which wraps a ConvertableToTraceFormat owned by the | 110 // Proxy class which wraps a ConvertableToTraceFormat owned by the |
| 110 // |session_state| into a proxy object that can be added to the trace event log. | 111 // |session_state| into a proxy object that can be added to the trace event log. |
| 111 // This is to solve the problem that the MemoryDumpSessionState is refcounted | 112 // This is to solve the problem that the MemoryDumpSessionState is refcounted |
| 112 // but the tracing subsystem wants a std::unique_ptr<ConvertableToTraceFormat>. | 113 // but the tracing subsystem wants a std::unique_ptr<ConvertableToTraceFormat>. |
| 113 template <typename T> | 114 template <typename T> |
| 114 struct SessionStateConvertableProxy : public ConvertableToTraceFormat { | 115 struct SessionStateConvertableProxy : public ConvertableToTraceFormat { |
| 115 using GetterFunctPtr = T* (MemoryDumpSessionState::*)() const; | 116 using GetterFunctPtr = T* (MemoryDumpSessionState::*)() const; |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 if (iter == process_dumps.end()) { | 942 if (iter == process_dumps.end()) { |
| 942 std::unique_ptr<ProcessMemoryDump> new_pmd( | 943 std::unique_ptr<ProcessMemoryDump> new_pmd( |
| 943 new ProcessMemoryDump(session_state, dump_args)); | 944 new ProcessMemoryDump(session_state, dump_args)); |
| 944 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 945 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 945 } | 946 } |
| 946 return iter->second.get(); | 947 return iter->second.get(); |
| 947 } | 948 } |
| 948 | 949 |
| 949 } // namespace trace_event | 950 } // namespace trace_event |
| 950 } // namespace base | 951 } // namespace base |
| OLD | NEW |