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

Side by Side Diff: third_party/WebKit/Source/web/WebMemoryStatistics.cpp

Issue 2391423004: Add UMA for PurgeAndSuspend. (Closed)
Patch Set: Created 4 years, 2 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "public/web/WebMemoryStatistics.h"
6
7 #include "platform/heap/Heap.h"
8 #include "wtf/allocator/Partitions.h"
9
10 namespace blink {
11
12 namespace {
13
14 class LightPartitionStatsDumperImpl : public WTF::PartitionStatsDumper {
15 public:
16 LightPartitionStatsDumperImpl() : m_totalActiveBytes(0) {}
17
18 void partitionDumpTotals(const char* partitionName,
19 const WTF::PartitionMemoryStats*) override;
20 void partitionsDumpBucketStats(
21 const char* partitionName,
22 const WTF::PartitionBucketMemoryStats*) override {}
23
24 size_t totalActiveBytes() const { return m_totalActiveBytes; }
25
26 private:
27 size_t m_totalActiveBytes;
28 };
29
30 void LightPartitionStatsDumperImpl::partitionDumpTotals(
haraken 2016/10/06 08:03:17 Nit: Inline this method into the class.
tasak 2016/10/06 09:47:40 Done.
31 const char* partitionName,
32 const WTF::PartitionMemoryStats* memoryStats) {
33 m_totalActiveBytes += memoryStats->totalActiveBytes;
34 }
35 }
36
37 WebMemoryStatistics WebMemoryStatistics::Get() {
38 LightPartitionStatsDumperImpl dumper;
39 WebMemoryStatistics statistics;
40
41 WTF::Partitions::dumpMemoryStats(true, &dumper);
42 statistics.partitionAllocTotalAllocatedBytes = dumper.totalActiveBytes();
43
44 statistics.blinkGCTotalAllocatedBytes =
45 ProcessHeap::totalAllocatedObjectSize() +
46 ProcessHeap::totalMarkedObjectSize();
47 return statistics;
48 }
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698