| 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 "components/tracing/common/process_metrics_memory_dump_provider.h" | 5 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 
| 6 | 6 | 
| 7 #include <fcntl.h> | 7 #include <fcntl.h> | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <map> | 10 #include <map> | 
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 291       is_rss_peak_resettable_ = false; | 291       is_rss_peak_resettable_ = false; | 
| 292     } | 292     } | 
| 293     close(clear_refs_fd); | 293     close(clear_refs_fd); | 
| 294   } | 294   } | 
| 295 #elif defined(MACOSX) | 295 #elif defined(MACOSX) | 
| 296   size_t private_bytes; | 296   size_t private_bytes; | 
| 297   bool res = process_metrics_->GetMemoryBytes(&private_bytes, | 297   bool res = process_metrics_->GetMemoryBytes(&private_bytes, | 
| 298                                               nullptr /* shared_bytes */); | 298                                               nullptr /* shared_bytes */); | 
| 299   if (res) | 299   if (res) | 
| 300     pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 300     pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 
| 301 #endif  // defined(OS_LINUX) || defined(OS_ANDROID) | 301 #elif defined(OS_WIN) | 
|  | 302   if (args.level_of_detail == | 
|  | 303       base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { | 
|  | 304     uint64_t pss_bytes = 0; | 
|  | 305     bool res = process_metrics_->GetProportionalSetSizeBytes(&pss_bytes); | 
|  | 306     if (res) { | 
|  | 307       base::trace_event::ProcessMemoryMaps::VMRegion region; | 
|  | 308       region.byte_stats_proportional_resident = pss_bytes; | 
|  | 309       pmd->process_mmaps()->AddVMRegion(region); | 
|  | 310       pmd->set_has_process_mmaps(); | 
|  | 311     } | 
|  | 312   } | 
|  | 313 | 
|  | 314 #endif | 
| 302 #endif  // !defined(OS_IOS) | 315 #endif  // !defined(OS_IOS) | 
| 303 | 316 | 
| 304   pmd->process_totals()->set_resident_set_bytes(rss_bytes); | 317   pmd->process_totals()->set_resident_set_bytes(rss_bytes); | 
| 305   pmd->set_has_process_totals(); | 318   pmd->set_has_process_totals(); | 
| 306   pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); | 319   pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); | 
| 307 | 320 | 
| 308   // Returns true even if other metrics failed, since rss is reported. | 321   // Returns true even if other metrics failed, since rss is reported. | 
| 309   return true; | 322   return true; | 
| 310 } | 323 } | 
| 311 | 324 | 
| 312 }  // namespace tracing | 325 }  // namespace tracing | 
| OLD | NEW | 
|---|