source: trunk/src/debugstats.cpp @ 210

Last change on this file since 210 was 210, checked in by sam, 10 years ago

Allow for different priorities in game and draw tick levels.

  • Property svn:keywords set to Id
File size: 962 bytes
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdio>
11
12#include "core.h"
13#include "debugstats.h"
14
15/*
16 * DebugStats implementation class
17 */
18
19class DebugStatsData
20{
21    friend class DebugStats;
22
23private:
24    FILE *fp;
25};
26
27/*
28 * Public DebugStats class
29 */
30
31DebugStats::DebugStats(char const *path)
32{
33    data = new DebugStatsData();
34    data->fp = fopen(path, "w+");
35
36    gamegroup = GAMEGROUP_AFTER;
37}
38
39void DebugStats::TickGame(float deltams)
40{
41    Entity::TickGame(deltams);
42
43    fprintf(data->fp, "%i %f %f %f %f\n",
44            Ticker::GetFrameNum(),
45            Profiler::GetAvg(Profiler::STAT_TICK_GAME),
46            Profiler::GetAvg(Profiler::STAT_TICK_DRAW),
47            Profiler::GetAvg(Profiler::STAT_TICK_BLIT),
48            Profiler::GetAvg(Profiler::STAT_TICK_FRAME));
49}
50
51DebugStats::~DebugStats()
52{
53    fclose(data->fp);
54    delete data;
55}
56
Note: See TracBrowser for help on using the repository browser.