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

Side by Side Diff: components/tracing/common/process_metrics_memory_dump_provider.cc

Issue 2549803003: Add function to compute proportional set size for OS_WIN (Closed)
Patch Set: More encapsulation of code, better comment. Created 4 years 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 "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
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 #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;
Primiano Tucci (use gerrit) 2016/12/06 17:47:57 If I read the code correctly now within this funct
chengx 2016/12/06 19:40:09 My understanding is that line 268 calls GetWorking
Primiano Tucci (use gerrit) 2016/12/08 16:36:01 Ahh you are right. I confused GetWorkingSetSize()
308 region.byte_stats_proportional_resident = pss_bytes;
309 pmd->process_mmaps()->AddVMRegion(region);
310 }
311 }
312
301 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 313 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
Primiano Tucci (use gerrit) 2016/12/06 17:47:57 plz can you remove the comment from this #endif as
chengx 2016/12/06 19:40:09 Done.
302 #endif // !defined(OS_IOS) 314 #endif // !defined(OS_IOS)
303 315
304 pmd->process_totals()->set_resident_set_bytes(rss_bytes); 316 pmd->process_totals()->set_resident_set_bytes(rss_bytes);
305 pmd->set_has_process_totals(); 317 pmd->set_has_process_totals();
306 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); 318 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes);
307 319
308 // Returns true even if other metrics failed, since rss is reported. 320 // Returns true even if other metrics failed, since rss is reported.
309 return true; 321 return true;
310 } 322 }
311 323
312 } // namespace tracing 324 } // namespace tracing
OLDNEW
« base/process/process_metrics_win.cc ('K') | « base/process/process_metrics_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698