summaryrefslogtreecommitdiffstats
path: root/cc/rendering_stats.h
blob: 193c98511919e8c0b9e3a6fc1be347343fde23bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_RENDERING_STATS_H_
#define CC_RENDERING_STATS_H_

#include "base/basictypes.h"
#include "base/time.h"
#include "cc/cc_export.h"

namespace cc {

struct CC_EXPORT RenderingStats {
    // FIXME: Rename these to animationFrameCount and screenFrameCount, crbug.com/138641.
    int64 numAnimationFrames;
    int64 numFramesSentToScreen;
    int64 droppedFrameCount;
    base::TimeDelta totalPaintTime;
    base::TimeDelta totalRasterizeTime;
    base::TimeDelta totalRasterizeTimeForNowBinsOnPendingTree;
    base::TimeDelta totalCommitTime;
    int64 totalCommitCount;
    int64 totalPixelsPainted;
    int64 totalPixelsRasterized;
    int64 numImplThreadScrolls;
    int64 numMainThreadScrolls;
    int64 numLayersDrawn;
    int64 numMissingTiles;
    int64 totalDeferredImageDecodeCount;
    int64 totalDeferredImageCacheHitCount;
    int64 totalImageGatheringCount;
    base::TimeDelta totalDeferredImageDecodeTime;
    base::TimeDelta totalImageGatheringTime;
    // Note: when adding new members, please remember to update enumerateFields
    // in rendering_stats.cc.

    RenderingStats();

    // In conjunction with enumerateFields, this allows the embedder to
    // enumerate the values in this structure without
    // having to embed references to its specific member variables. This
    // simplifies the addition of new fields to this type.
    class Enumerator {
    public:
        virtual void AddInt64(const char* name, int64 value) = 0;
        virtual void AddDouble(const char* name, double value) = 0;
        virtual void AddInt(const char* name, int value) = 0;
        virtual void AddTimeDeltaInSecondsF(const char* name,
                                            const base::TimeDelta& value) = 0;

    protected:
        virtual ~Enumerator() { }
    };

    // Outputs the fields in this structure to the provided enumerator.
    void EnumerateFields(Enumerator* enumerator) const;
};

}  // namespace cc

#endif  // CC_RENDERING_STATS_H_