source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h @ 3221

Revision 3221, 1.3 KB checked in by mattausch, 16 years ago (diff)

added some statistics stuff, but ssao slower than before (probably because made ssao width and intensity variable and not hardcoded anymore) from >180 frames to < 130 frames!!!

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