aboutsummaryrefslogtreecommitdiffstats
path: root/src/stats.hpp
blob: ef89fef0dbdcda74a64c688024c08f546296fd33 (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
76
77
78
79
80
81
82
83
84
// Copyright (C) 2020 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 3 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

#pragma once

#include "system.hpp"

#include <string>

class Config;
struct Context;

// Statistics fields in storage order.
enum stats {
  STATS_NONE = 0,
  STATS_STDOUT = 1,
  STATS_STATUS = 2,
  STATS_ERROR = 3,
  STATS_CACHEMISS = 4,
  STATS_PREPROCESSOR = 5,
  STATS_COMPILER = 6,
  STATS_MISSING = 7,
  STATS_CACHEHIT_CPP = 8,
  STATS_ARGS = 9,
  STATS_LINK = 10,
  STATS_NUMFILES = 11,
  STATS_TOTALSIZE = 12,
  STATS_OBSOLETE_MAXFILES = 13,
  STATS_OBSOLETE_MAXSIZE = 14,
  STATS_SOURCELANG = 15,
  STATS_BADOUTPUTFILE = 16,
  STATS_NOINPUT = 17,
  STATS_MULTIPLE = 18,
  STATS_CONFTEST = 19,
  STATS_UNSUPPORTED_OPTION = 20,
  STATS_OUTSTDOUT = 21,
  STATS_CACHEHIT_DIR = 22,
  STATS_NOOUTPUT = 23,
  STATS_EMPTYOUTPUT = 24,
  STATS_BADEXTRAFILE = 25,
  STATS_COMPCHECK = 26,
  STATS_CANTUSEPCH = 27,
  STATS_PREPROCESSING = 28,
  STATS_NUMCLEANUPS = 29,
  STATS_UNSUPPORTED_DIRECTIVE = 30,
  STATS_ZEROTIMESTAMP = 31,
  STATS_CANTUSEMODULES = 32,

  STATS_END
};

void stats_update(Context& ctx, enum stats stat);
void stats_flush(void* context);
unsigned stats_get_pending(Context& ctx, enum stats stat);
void stats_zero(const Config& config);
void stats_summary(const Config& config);
void stats_print(const Config& config);
void stats_update_size(Context& ctx,
                       const std::string& sfile,
                       int64_t size,
                       int files);
void stats_get_obsolete_limits(const char* dir,
                               unsigned* maxfiles,
                               uint64_t* maxsize);
void stats_set_sizes(const char* dir, unsigned num_files, uint64_t total_size);
void stats_add_cleanup(const char* dir, unsigned count);
void stats_timestamp(time_t time, struct counters* counters);
void stats_read(const std::string& path, struct counters* counters);
void stats_write(const std::string& path, struct counters* counters);