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

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

Issue 2350423003: [Tentaive patch for discussion] Add Purge+Suspend metrics as UMA.
Patch Set: Add v8 heap usage 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()
17 : m_totalActiveBytes(0)
18 , m_totalResidentBytes(0)
19 {
20 }
21
22 void partitionDumpTotals(const char* partitionName, const WTF::Partition MemoryStats*) override;
23 void partitionsDumpBucketStats(const char* partitionName, const WTF::Par titionBucketMemoryStats*) override {}
24
25 size_t totalActiveBytes() const { return m_totalActiveBytes; }
26 size_t totalResidentBytes() const { return m_totalResidentBytes; }
27
28 private:
29 size_t m_totalActiveBytes;
30 size_t m_totalResidentBytes;
31 };
32
33 void LightPartitionStatsDumperImpl::partitionDumpTotals(const char* partitio nName, const WTF::PartitionMemoryStats* memoryStats)
34 {
35 m_totalActiveBytes += memoryStats->totalActiveBytes;
36 m_totalResidentBytes += memoryStats->totalResidentBytes;
37 }
38 }
39
40 WebMemoryStatistics WebMemoryStatistics::Get()
bashi 2016/09/22 23:28:26 (just for note; I understand this is WIP) We migh
41 {
42 LightPartitionStatsDumperImpl dumper;
43 WebMemoryStatistics statistics;
44
45 WTF::Partitions::dumpMemoryStats(true, &dumper);
46 statistics.partitionAllocTotalAllocatedBytes = dumper.totalActiveBytes();
47 statistics.partitionAllocTotalBytes = dumper.totalResidentBytes();
48
49 statistics.blinkGCTotalBytes = ProcessHeap::totalAllocatedSpace();
50 statistics.blinkGCTotalAllocatedBytes = ProcessHeap::totalAllocatedObjectSiz e() + ProcessHeap::totalMarkedObjectSize();
51 return statistics;
52 }
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698