GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/utils/perfstat.h Lines: 3 3 100.0 %
Date: 2019-08-19 Branches: 4 4 100.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2018-2019  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef UTILS_PERFSTAT_H
22
#define UTILS_PERFSTAT_H
23
24
#include "const/utils/perfstat.h"
25
26
#include "localconsts.h"
27
28
struct PerfStats final
29
{
30
    PerfStats()
31
121
    {
32

2057
        for (int f = 0; f < 16; f ++)
33
1936
            ticks[f] = -1;
34
    }
35
36
    A_DEFAULT_COPY(PerfStats)
37
38
    int ticks[16];
39
};
40
41
namespace Perf
42
{
43
    void init();
44
    void nextFrame();
45
    void selectWorstFrame();
46
    int getTime(const size_t frameId,
47
                const size_t counterId);
48
    int getWorstTime(const size_t counterId);
49
}  // namespace Perf
50
51
extern PerfStats perfStats[PERFSTAT_MAX];
52
extern size_t perfFrameId;
53
extern size_t prevPerfFrameId;
54
extern int *perfFrame;
55
extern PerfStats worstFrameStats;
56
extern int skipPerfFrames;
57
58
#define PERF_STAT(n) \
59
    perfFrame[n] = tick_time
60
61
#define PERF_NEXTFRAME() \
62
    Perf::nextFrame()
63
64
#endif  // UTILS_PERFSTAT_H