您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

67 行
1.2 KiB

  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. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <cstdio>
  14. #include "core.h"
  15. #include "debugstats.h"
  16. namespace lol
  17. {
  18. /*
  19. * DebugStats implementation class
  20. */
  21. class DebugStatsData
  22. {
  23. friend class DebugStats;
  24. private:
  25. FILE *fp;
  26. };
  27. /*
  28. * Public DebugStats class
  29. */
  30. DebugStats::DebugStats(char const *path)
  31. : data(new DebugStatsData())
  32. {
  33. data->fp = fopen(path, "w+");
  34. gamegroup = GAMEGROUP_AFTER;
  35. }
  36. void DebugStats::TickGame(float deltams)
  37. {
  38. Entity::TickGame(deltams);
  39. fprintf(data->fp, "%i %f %f %f %f\n",
  40. Ticker::GetFrameNum(),
  41. Profiler::GetAvg(Profiler::STAT_TICK_GAME),
  42. Profiler::GetAvg(Profiler::STAT_TICK_DRAW),
  43. Profiler::GetAvg(Profiler::STAT_TICK_BLIT),
  44. Profiler::GetAvg(Profiler::STAT_TICK_FRAME));
  45. }
  46. DebugStats::~DebugStats()
  47. {
  48. fclose(data->fp);
  49. delete data;
  50. }
  51. } /* namespace lol */