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

Side by Side Diff: cc/memory_history.h

Issue 12149004: [cc] Show GPU memory usage and overage below FPS counter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_impl.cc ('k') | cc/memory_history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 #ifndef CC_MEMORY_HISTORY_H_
6 #define CC_MEMORY_HISTORY_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h"
11 #include "cc/ring_buffer.h"
12
13 namespace cc {
14
15 // Maintains a history of memory for each frame
16 class MemoryHistory {
17 public:
18 static scoped_ptr<MemoryHistory> create();
19
20 size_t HistorySize() const { return ring_buffer_.BufferSize(); }
21
22 struct Entry {
23 Entry()
24 : bytes_allocated(0),
25 bytes_over(0) { }
26
27 size_t bytes_allocated;
28 size_t bytes_unreleasable;
29 size_t bytes_over;
30 size_t bytes_total() const {
31 return bytes_allocated +
32 bytes_unreleasable +
33 bytes_over;
34 }
35 };
36
37 // n = 0 returns the oldest and
38 // n = HistorySize() - 1 the most recent paint time.
39 Entry GetEntry(const size_t& n) const;
40
41 void SaveEntry(const Entry& entry);
42 void GetMinAndMax(size_t* min, size_t* max) const;
43
44 private:
45 MemoryHistory();
46
47 RingBuffer<Entry, 80> ring_buffer_;
48
49 DISALLOW_COPY_AND_ASSIGN(MemoryHistory);
50 };
51
52 } // namespace cc
53
54 #endif // CC_MEMORY_HISTORY_H_
OLDNEW
« no previous file with comments | « cc/layer_tree_impl.cc ('k') | cc/memory_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698