source: trunk/src/debugstats.cpp @ 221

Last change on this file since 221 was 221, checked in by sam, 11 years ago

Complete Lol Engine / Deus Hax / Monsterz split.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cstdio>
16
17#include "core.h"
18#include "debugstats.h"
19
20/*
21 * DebugStats implementation class
22 */
23
24class DebugStatsData
25{
26    friend class DebugStats;
27
28private:
29    FILE *fp;
30};
31
32/*
33 * Public DebugStats class
34 */
35
36DebugStats::DebugStats(char const *path)
37{
38    data = new DebugStatsData();
39    data->fp = fopen(path, "w+");
40
41    gamegroup = GAMEGROUP_AFTER;
42}
43
44void DebugStats::TickGame(float deltams)
45{
46    Entity::TickGame(deltams);
47
48    fprintf(data->fp, "%i %f %f %f %f\n",
49            Ticker::GetFrameNum(),
50            Profiler::GetAvg(Profiler::STAT_TICK_GAME),
51            Profiler::GetAvg(Profiler::STAT_TICK_DRAW),
52            Profiler::GetAvg(Profiler::STAT_TICK_BLIT),
53            Profiler::GetAvg(Profiler::STAT_TICK_FRAME));
54}
55
56DebugStats::~DebugStats()
57{
58    fclose(data->fp);
59    delete data;
60}
61
Note: See TracBrowser for help on using the repository browser.