summaryrefslogtreecommitdiffstats
path: root/source/stats.c
blob: 3bd4e2d39d56238ef34480576e9a139b80e03e96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Statistics gathered during emulation in ReGBA
 *
 * Copyright (C) 2013 GBATemp user Nebuleon
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licens e as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
#include "common.h"
#include "stats.h"

struct ReGBA_Stats Stats;

void StatsStopFPS(void)
{
	Stats.RenderedFPS = -1;
	Stats.EmulatedFPS = -1;
	Stats.RenderedFrames = 0;
	Stats.EmulatedFrames = 0;
}

void StatsInit(void)
{
	StatsStopFPS();
}

void StatsInitGame(void)
{
	StatsInit();
#ifndef USE_C_CORE
	uint32_t reason;
	uint32_t area;
	for (area = 0; area < TRANSLATION_REGION_COUNT; area++)
	{
		Stats.TranslationBytesFlushed[area] = 0;
		Stats.TranslationBytesPeak[area] = 0;
		for (reason = 0; reason < CACHE_FLUSH_REASON_COUNT; reason++)
		{
			Stats.TranslationFlushCount[area][reason] = 0;
		}
	}
	for (area = 0; area < METADATA_AREA_COUNT; area++)
	{
		for (reason = 0; reason < METADATA_CLEAR_REASON_COUNT; reason++)
		{
			Stats.MetadataClearCount[area][reason] = 0;
		}
	}
	Stats.PartialFlushCount = 0;
#endif
	Stats.SoundBufferUnderrunCount = 0;
	Stats.InSoundBufferUnderrun = 0;
	Stats.TotalEmulatedFrames = 0;
	Stats.TotalRenderedFrames = 0;
#ifdef PERFORMANCE_IMPACTING_STATISTICS
	Stats.ARMOpcodesDecoded = 0;
	Stats.ThumbOpcodesDecoded = 0;
	Stats.ThumbROMConstants = 0;
	Stats.BlockReuseCount = 0;
	Stats.BlockRecompilationCount = 0;
	Stats.OpcodeReuseCount = 0;
	Stats.OpcodeRecompilationCount = 0;
	Stats.WrongAddressLineCount = 0;
#endif
}