Last change
on this file since 19365 was 11071, checked in by tbretz, 14 years ago |
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <dic.hxx>
|
---|
2 |
|
---|
3 | class Service : public DimInfo
|
---|
4 | {
|
---|
5 | int n_bad;
|
---|
6 | int n_good;
|
---|
7 |
|
---|
8 | void infoHandler()
|
---|
9 | {
|
---|
10 | char *ptr;
|
---|
11 | ptr = (char *)getData();
|
---|
12 | // cout << getName() << " received " << ptr << endl;
|
---|
13 | if(ptr[0] == '-')
|
---|
14 | {
|
---|
15 | n_bad = 1;
|
---|
16 | n_good = 0;
|
---|
17 | }
|
---|
18 | if(ptr[0] == 'h')
|
---|
19 | {
|
---|
20 | n_good = 1;
|
---|
21 | n_bad = 0;
|
---|
22 | }
|
---|
23 | }
|
---|
24 | public :
|
---|
25 | Service(char *name) : DimInfo(name,"--")
|
---|
26 | {n_bad = 0; n_good = 0;}
|
---|
27 | int getNgood() {return n_good;}
|
---|
28 | int getNbad() {return n_bad;}
|
---|
29 | };
|
---|
30 |
|
---|
31 |
|
---|
32 | int main(int argc, char *argv[])
|
---|
33 | {
|
---|
34 | int i, n, msgSize, nServices = 0;
|
---|
35 | Service **services;
|
---|
36 | float mps,tpm;
|
---|
37 | DimBrowser br;
|
---|
38 | char name[132], *format;
|
---|
39 |
|
---|
40 | sscanf(argv[1],"%d",&nServices);
|
---|
41 | services = new Service*[nServices];
|
---|
42 | for(i = 0; i < nServices; i++)
|
---|
43 | {
|
---|
44 | services[i] = 0;
|
---|
45 | }
|
---|
46 | for(i = 0; i < nServices; i++)
|
---|
47 | {
|
---|
48 | sprintf(name,"BENCH_SERVICE_%03d",i);
|
---|
49 | services[i] = new Service(name);
|
---|
50 | }
|
---|
51 | while(1)
|
---|
52 | {
|
---|
53 | sleep(10);
|
---|
54 | n = 0;
|
---|
55 | for(i = 0; i < nServices; i++)
|
---|
56 | {
|
---|
57 | if(services[i])
|
---|
58 | n += services[i]->getNgood();
|
---|
59 | }
|
---|
60 | cout << "N Good = "<< n << endl;
|
---|
61 | n = 0;
|
---|
62 | for(i = 0; i < nServices; i++)
|
---|
63 | {
|
---|
64 | if(services[i])
|
---|
65 | n += services[i]->getNbad();
|
---|
66 | }
|
---|
67 | cout << "N bad = "<< n << endl;
|
---|
68 | }
|
---|
69 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.