Zero  0.1.0
agglog.h
Go to the documentation of this file.
1 #ifndef __AGGLOG_H
2 #define __AGGLOG_H
3 
4 #include "command.h"
5 #include "handler.h"
6 
7 #include <vector>
8 #include <bitset>
9 
10 class AggLog : public LogScannerCommand {
11 public:
12  void run();
13 
14  void setupOptions();
15 
16  string jsonReply();
17 
18 private:
19  vector<string> typeStrings;
20 
21  string beginType;
22 
23  string endType;
24 
25  string json;
26 
27  int interval;
28 };
29 
30 class AggregateHandler : public Handler {
31 public:
32  AggregateHandler(bitset<logrec_t::t_max_logrec> filter, int interval = 1,
35 
36  virtual void invoke(logrec_t& r);
37 
38  virtual void finalize();
39 
40  string jsonReply();
41 
42 protected:
43  vector<unsigned> counts;
44 
45  bitset<logrec_t::t_max_logrec> filter;
46 
47  const int interval;
48 
49  int currentTick, jsonResultIndex;
50 
51  std::stringstream ssJsonResult[logrec_t::t_max_logrec];
52 
54 
56 
57  bool seenBegin;
58 
59  void dumpCounts();
60 };
61 
62 #endif // __AGGLOG_H
int interval
Definition: agglog.h:27
int jsonResultIndex
Definition: agglog.h:49
void run()
Definition: agglog.cpp:18
void setupOptions()
Definition: agglog.cpp:3
Definition: agglog.h:30
Definition: agglog.h:10
string endType
Definition: agglog.h:23
Represents a transactional log record.
Definition: logrec.h:143
bitset< logrec_t::t_max_logrec > filter
Definition: agglog.h:45
string jsonReply()
Definition: agglog.cpp:73
bool seenBegin
Definition: agglog.h:57
Definition: command.h:70
string beginType
Definition: agglog.h:21
Definition: handler.h:11
vector< string > typeStrings
Definition: agglog.h:19
logrec_t::kind_t begin
Definition: agglog.h:53
vector< unsigned > counts
Definition: agglog.h:43
logrec_t::kind_t end
Definition: agglog.h:55
const int interval
Definition: agglog.h:47
Definition: logrec.h:201
string json
Definition: agglog.h:25
kind_t
Definition: logrec.h:149