File: Statistics.hh

package info (click to toggle)
topcom 1.1.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,784 kB
  • sloc: cpp: 37,616; sh: 4,262; makefile: 497; ansic: 49
file content (48 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (2)
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
////////////////////////////////////////////////////////////////////////////////
// 
// Statistics.hh 
//
//    produced: 17 Sep 2021 jr
// last change: 17 Sep 2021 jr
//
////////////////////////////////////////////////////////////////////////////////
#ifndef STATISTICS_HH
#define STATISTICS_HH

#include <stdlib.h>
#include <cstring>
#include <fstream>

#include "Global.hh"
#include "CommandlineOptions.hh"

namespace topcom {

  // statistical data is collected in a purely static class (i.e., a global variable):
  class Statistics {
  private:
    static std::fstream _stats_stream;
    static size_type    _no_of_map_calls;
  public:
    Statistics() {}
    Statistics(const Statistics&) {}
  public:
    // initialization:
    static void init();
    
    // termination:
    static void term();

    // accessors:
    inline static size_type no_of_map_calls()           { return _no_of_map_calls; }
    inline static std::fstream& stats_stream()          { return _stats_stream; }

    // modifiers:
    inline static void new_map_call()                   { ++_no_of_map_calls; }
  };

}; // namespace topcom

#endif

// eof Statistics.hh