Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
periodic_perf_report.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
17  */
18 
19 #ifndef MIR_CLIENT_PERIODIC_PERF_REPORT_H_
20 #define MIR_CLIENT_PERIODIC_PERF_REPORT_H_
21 
22 #include "perf_report.h"
23 #include "mir/time/clock.h"
24 #include <chrono>
25 #include <memory>
26 #include <string>
27 #include <unordered_map>
28 
29 namespace mir
30 {
31 namespace client
32 {
33 
35 {
36 public:
38  std::shared_ptr<mir::time::Clock> const& clock);
39  void name_surface(char const*) override;
40  void begin_frame(int buffer_id) override;
41  void end_frame(int buffer_id) override;
42  virtual void display(const char *name, long fps100,
43  long rendertime_usec, long lag_usec,
44  int nbuffers) const = 0;
45 private:
46  typedef mir::time::Duration Duration;
47  typedef mir::time::Timestamp Timestamp;
48  Timestamp current_time() const;
49  std::shared_ptr<mir::time::Clock> const clock;
50  Duration const report_interval;
51  std::string name;
52  Timestamp last_report_time;
53  Timestamp frame_begin_time;
54  Timestamp frame_end_time;
55  Duration render_time_sum = Duration::zero();
56  Duration buffer_queue_latency_sum = Duration::zero();
57  int frame_count = 0;
58  std::unordered_map<int,Timestamp> buffer_end_time;
59 };
60 
61 } // namespace client
62 } // namespace mir
63 
64 #endif // MIR_CLIENT_PERIODIC_PERF_REPORT_H_
All things Mir.
Definition: aging_buffer.h:24
std::chrono::high_resolution_clock::time_point Timestamp
Definition: clock.h:29
Definition: perf_report.h:27
void begin_frame(int buffer_id) override
Definition: periodic_perf_report.cpp:41
std::chrono::high_resolution_clock::duration Duration
Definition: clock.h:30
virtual void display(const char *name, long fps100, long rendertime_usec, long lag_usec, int nbuffers) const =0
void name_surface(char const *) override
Definition: periodic_perf_report.cpp:36
PeriodicPerfReport(mir::time::Duration period, std::shared_ptr< mir::time::Clock > const &clock)
Definition: periodic_perf_report.cpp:23
void end_frame(int buffer_id) override
Definition: periodic_perf_report.cpp:56
Definition: periodic_perf_report.h:34

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014