Revision 3223,
1.4 KB
checked in by mattausch, 16 years ago
(diff) |
worked on stats
|
Line | |
---|
1 | #ifndef _STATSWRITER_H__
|
---|
2 | #define _STATSWRITER_H__
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include <fstream>
|
---|
6 | #include "Vector3.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | namespace CHCDemoEngine
|
---|
10 | {
|
---|
11 |
|
---|
12 | struct FrameStats
|
---|
13 | {
|
---|
14 | FrameStats():
|
---|
15 | mFrame(0), mFPS(0), mTime(.0f), mNodes(0), mTriangles(0), mObjects(0)
|
---|
16 | {}
|
---|
17 |
|
---|
18 |
|
---|
19 | FrameStats(int frame, int fps, float time, int nodes, int triangles, int objects):
|
---|
20 | mFrame(frame), mFPS(fps), mTime(time), mNodes(nodes), mTriangles(triangles), mObjects(objects)
|
---|
21 | {}
|
---|
22 |
|
---|
23 |
|
---|
24 | friend std::ostream& operator<< (std::ostream &s, const FrameStats &A);
|
---|
25 |
|
---|
26 |
|
---|
27 | ////////////////
|
---|
28 |
|
---|
29 | int mFrame;
|
---|
30 | int mFPS;
|
---|
31 | float mTime;
|
---|
32 | int mNodes;
|
---|
33 | int mTriangles;
|
---|
34 | int mObjects;
|
---|
35 | };
|
---|
36 |
|
---|
37 |
|
---|
38 | /// Overload << operator for C++-style output
|
---|
39 | inline std::ostream& operator<< (std::ostream &s, const FrameStats &A)
|
---|
40 | {
|
---|
41 | s << "#FRAME" << "\n" << A.mFrame << std::endl;
|
---|
42 | s << "#FPS" << "\n" << A.mFPS << std::endl;
|
---|
43 | s << "#TIME" << "\n" << A.mTime << std::endl;
|
---|
44 | s << "#NODES" << "\n" << A.mNodes << std::endl;
|
---|
45 | s << "#TRIANGLES" << "\n" << A.mTriangles << std::endl;
|
---|
46 | s << "#OBJECTS" << "\n" << A.mObjects << std::endl;
|
---|
47 |
|
---|
48 | return s;
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | /** Writes out stats
|
---|
53 | */
|
---|
54 | class StatsWriter
|
---|
55 | {
|
---|
56 | public:
|
---|
57 |
|
---|
58 | StatsWriter(const std::string &filename);
|
---|
59 |
|
---|
60 | ~StatsWriter();
|
---|
61 | /** Writes current data
|
---|
62 | */
|
---|
63 | void WriteFrameStats(const FrameStats &stats);
|
---|
64 |
|
---|
65 |
|
---|
66 | protected:
|
---|
67 |
|
---|
68 | std::ofstream mFile;
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 | } // _STATSWRITER_H__
|
---|
73 |
|
---|
74 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.