~linaro-graphics-wg/glcompbench/profiler-stat-collection

« back to all changes in this revision

Viewing changes to src/profiler.h

  • Committer: Alexandros Frantzis
  • Date: 2012-05-17 09:26:28 UTC
  • Revision ID: alexandros.frantzis@linaro.org-20120517092628-n9qs2u0fogw810hj
Profiler,CompositeCanvas: Introduce and use StatCollections.

This commit, heavily based on Derek Foreman's substats patch, introduces
the concept of StatCollections. A StatCollection is a collection of
sampling data statistics that can be managed (e.g. reset()) separately from
other collections. This makes it easy to aggregate sampling data over
different periods of time. The user must register and use at least one
StatCollection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
{
36
36
public:
37
37
    typedef int Point;
 
38
    typedef int StatCollection;
38
39
 
39
40
    struct Stats
40
41
    {
85
86
            profiler_.sample_point(end_);
86
87
        }
87
88
 
88
 
        bool get_stats(Profiler::Stats &stats)
 
89
        bool get_stats(Profiler::Stats &stats, StatCollection c)
89
90
        {
90
 
            return profiler_.get_stats(start_, end_, stats);
 
91
            return profiler_.get_stats(start_, end_, c, stats);
91
92
        }
92
93
 
93
94
    private:
128
129
    Point register_point(const std::string &name);
129
130
    Point get_point_by_name(const std::string &name);
130
131
    const std::string &get_name_by_point(Point p);
 
132
 
 
133
    StatCollection register_stat_collection(const std::string &name);
 
134
 
131
135
    bool connect(Point p1, Point p2);
132
136
    bool sample_point(Point p);
133
 
    bool get_stats(Point p1, Point p2, Stats &stats);
134
 
    void reset_point(Point p);
135
 
    void reset(void);
 
137
    bool get_stats(Point p1, Point p2, StatCollection c, Stats &stats);
 
138
    void reset_point(Point p, StatCollection c);
 
139
    void reset(StatCollection c);
136
140
    Point get_num_points() { return points_.size(); }
137
141
 
138
142
    /**
146
150
 
147
151
private:
148
152
    bool is_valid_point(Point p);
 
153
    bool is_valid_stat_collection(StatCollection c);
149
154
    std::vector<ProfilerPoint *> points_;
 
155
    std::vector<std::pair<std::string, bool> > stat_collection_info_;
150
156
};
151
157
 
152
158