-
Notifications
You must be signed in to change notification settings - Fork 1
/
stats_test.cpp
64 lines (48 loc) · 1.29 KB
/
stats_test.cpp
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
/**
* @file stats_test.cpp
* @author matthewv
* @date Sept 16, 2020
* @date Copyright 2020
*
* @brief Executable for testing snmp side channel to rocksdb statistics
*/
#include <unistd.h>
#include <stdio.h>
#include "stats_table.h"
#include "rocksdb/statistics.h"
/**
* Start a statistics event loop that snmpd can reach
* @date created 09/16/20
* @author matthewv
*/
int
main(int argc, char ** argv)
{
int ret_val;
const char * progname="stats_test.e";
ret_val=0;
gLogging.Open(NULL, progname, LOG_USER, true);
gLogLevel=LOG_DEBUG;
Logging(LOG_ERR, "%s: %s starting", __func__, *argv);
// command
if (1==argc)
{
bool ret_flag;
StatsTable table(true);
// StatsTable adds its components to SnmpAgent ... and gets refreshed how?
std::shared_ptr<rocksdb::Statistics> stats = rocksdb::CreateDBStatistics();
ret_flag = table.AddTable(stats, 1, "test_stats");
printf("Type any key to continue ...");
getchar();
ret_val=(ret_flag ? 0 : 1);
}
else
{
Logging(LOG_ERR, "%s: Command error: command",
__func__);
ret_val=1;
} // else
Logging(LOG_ERR, "%s: %s exiting [ret_val=%d]",
__func__, *argv, ret_val);
return(ret_val);
} // main