forked from shekyan/slowhttptest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slowstats_test.cc
37 lines (33 loc) · 1.11 KB
/
slowstats_test.cc
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
// None of the rights are reserved.
// (C) by Victor Agababov ([email protected]) 2011
#include "slowstats.h"
#include <stdio.h>
#include <vector>
#include <string>
using std::string;
using namespace slowhttptest;
using std::vector;
int main() {
vector<StatsDumper*> dumpers;
dumpers.push_back(new HTMLDumper("test.html"));
dumpers.push_back(new CSVDumper("test.csv", "Seconds,Error,Closed,Pending,Connected\n"));
//dumpers.push_back(new CSVDumper("test.csv"));
for (int i = 0; i < dumpers.size(); ++i) {
if (!dumpers[i]->Initialize()) {
fprintf(stderr, "ERROR ERROR ERROR. File cannot be opened");
return 1;
}
}
for (int i = 0; i < dumpers.size(); ++i) {
dumpers[i]->WriteStats("%d,%d,%d,%d,%d", 1, 2, 3, 4, 5, 6);
dumpers[i]->WriteStats("%d,%d,%d,%d,%d", 2, 3, 4, 5, 1, 1);
dumpers[i]->WriteStats("%d,%d,%d,%d,%d", 3, 4, 5, 1, 2, 2);
dumpers[i]->WriteStats("%d,%d,%d,%d,%d", 4, 5, 1, 2, 3, 3);
dumpers[i]->WriteStats("%d,%d,%d,%d,%d", 5, 1, 2, 3, 4, 4);
}
for (int i = 0; i < dumpers.size(); ++i) {
delete dumpers[i];
}
dumpers.clear();
return 0;
}