Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2012 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 "loldebug.h"
  16. using namespace std;
  17. namespace lol
  18. {
  19. /*
  20. * DebugStats implementation class
  21. */
  22. class DebugStatsData
  23. {
  24. friend class DebugStats;
  25. private:
  26. FILE *fp;
  27. };
  28. /*
  29. * Public DebugStats class
  30. */
  31. DebugStats::DebugStats(char const *path)
  32. : data(new DebugStatsData())
  33. {
  34. data->fp = fopen(path, "w+");
  35. m_gamegroup = GAMEGROUP_AFTER;
  36. }
  37. void DebugStats::TickGame(float seconds)
  38. {
  39. Entity::TickGame(seconds);
  40. fprintf(data->fp, "%i %f %f %f %f\n",
  41. Ticker::GetFrameNum(),
  42. Profiler::GetAvg(Profiler::STAT_TICK_GAME),
  43. Profiler::GetAvg(Profiler::STAT_TICK_DRAW),
  44. Profiler::GetAvg(Profiler::STAT_TICK_BLIT),
  45. Profiler::GetAvg(Profiler::STAT_TICK_FRAME));
  46. }
  47. DebugStats::~DebugStats()
  48. {
  49. fclose(data->fp);
  50. delete data;
  51. }
  52. } /* namespace lol */