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

Side by Side Diff: cc/memory_history.cc

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/memory_history.h ('k') | cc/ring_buffer.h » ('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 2012 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 "cc/memory_history.h"
6
7 namespace cc {
8
9 // static
10 scoped_ptr<MemoryHistory> MemoryHistory::create() {
11 return make_scoped_ptr(new MemoryHistory());
12 }
13
14 MemoryHistory::MemoryHistory() {
15 }
16
17 MemoryHistory::Entry MemoryHistory::GetEntry(const size_t& n) const {
18 DCHECK(n < ring_buffer_.BufferSize());
19
20 if (ring_buffer_.IsFilledIndex(n))
21 return ring_buffer_.ReadBuffer(n);
22
23 return MemoryHistory::Entry();
24 }
25
26 void MemoryHistory::SaveEntry(const MemoryHistory::Entry& entry) {
27 ring_buffer_.SaveToBuffer(entry);
28 }
29
30 void MemoryHistory::GetMinAndMax(size_t* min, size_t* max) const {
31 *min = std::numeric_limits<size_t>::max();
32 *max = 0;
33
34 for (size_t i = 0; i < ring_buffer_.BufferSize(); i++) {
35 if (!ring_buffer_.IsFilledIndex(i))
36 continue;
37 const Entry entry = ring_buffer_.ReadBuffer(i);
38 size_t bytes_total = entry.bytes_total();
39
40 if (bytes_total < *min)
41 *min = bytes_total;
42 if (bytes_total > *max)
43 *max = bytes_total;
44 }
45
46 if (*min > *max)
47 *min = *max;
48 }
49
50 } // namespace cc
OLDNEW
« no previous file with comments | « cc/memory_history.h ('k') | cc/ring_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698