]>
Commit | Line | Data |
---|---|---|
4b4eb769 | 1 | Int_t GetValues(const char* host, Int_t port, const char* request, |
2 | Long_t startTime, Long_t endTime) | |
3 | { | |
4 | ||
5 | AliDCSClient client(host, port, 1000, 5); | |
6 | ||
7 | Int_t result; | |
8 | ||
9 | TTimeStamp currentTime; | |
10 | TMap values; | |
11 | ||
12 | TString rString(request); | |
13 | ||
14 | TObjArray* requests = rString.Tokenize(","); | |
15 | ||
16 | cout<<"Requests: "<<requests->GetEntries()<<endl; | |
17 | ||
18 | TStopwatch sw; | |
19 | sw.Start(); | |
20 | ||
21 | if (requests->GetEntries() > 1) { | |
22 | ||
23 | TIter iter(requests); | |
24 | TObjString* aString; | |
25 | while ((aString = (TObjString*) iter.Next())) { | |
26 | values.Add(new TObjString(aString->String()), NULL); | |
27 | } | |
28 | ||
29 | result = client.GetDPValues(startTime, endTime, values); | |
30 | ||
31 | } else { | |
32 | TObjArray* valueSet = new TObjArray(); | |
33 | valueSet->SetOwner(1); | |
34 | ||
35 | values.Add(new TObjString(request), valueSet); | |
36 | ||
37 | result = client.GetAliasValues(request, startTime, | |
38 | endTime, *valueSet); | |
39 | } | |
40 | ||
41 | if (result < 0) { | |
42 | cout<<"Communication failure: "<< | |
43 | AliDCSClient::GetErrorString(result)<<endl; | |
44 | ||
45 | if (result == AliDCSClient::fgkServerError) { | |
46 | cout<<"Server error code: "<< | |
47 | client.GetServerErrorCode()<<endl; | |
48 | cout<<client.GetServerError()<<endl; | |
49 | } | |
50 | } | |
51 | ||
52 | sw.Stop(); | |
53 | cout<<"Elapsed time: "<<sw.RealTime()<<endl; | |
54 | if (result > 0) { | |
55 | cout<<"Time per value: "<<sw.RealTime()/result<<endl; | |
56 | } | |
57 | cout<<"Received values: "<<result<<endl; | |
58 | ||
59 | ||
60 | /* | |
61 | TIter iter(&values); | |
62 | TObjString* aRequest; | |
63 | while ((aRequest = (TObjString*) iter.Next())) { | |
64 | ||
65 | TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest); | |
66 | ||
67 | cout<<" '"<<aRequest->String()<<"' values: " | |
68 | <<valueSet->GetEntriesFast()<<endl; | |
69 | ||
70 | TIter valIter(valueSet); | |
71 | AliDCSValue* aValue; | |
72 | while ((aValue = (AliDCSValue*) valIter.Next())) { | |
73 | cout<<aValue->ToString()<<endl; | |
74 | } | |
75 | } | |
76 | ||
77 | */ | |
78 | /* TFile file("dump.root", "UPDATE"); | |
79 | file.WriteTObject(values, "values"); | |
80 | file.Close(); */ | |
81 | ||
82 | values.DeleteAll(); | |
83 | delete requests; | |
84 | ||
85 | cout<<"All values returned in runrange: "<<endl; | |
86 | cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl; | |
87 | cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl; | |
88 | ||
89 | return result; | |
90 | } | |
91 | ||
92 | void TestClientAlbe(const char* host, Int_t port, const char* request, | |
93 | UInt_t startShift, UInt_t endShift) { | |
94 | ||
95 | gSystem->Load("libSHUTTLE"); | |
96 | ||
97 | // AliLog::EnableDebug(kFALSE); | |
98 | // AliLog::SetGlobalDebugLevel(3); | |
99 | ||
100 | TH1F *histo=new TH1F("h","h",36,-6,25); | |
101 | Int_t result=-1; | |
102 | for(int i=0;i<100;i++){ | |
103 | ||
104 | TTimeStamp currentTime; | |
105 | ||
106 | result=GetValues(host, port, request, | |
107 | currentTime.GetSec() - startShift, | |
108 | currentTime.GetSec() - endShift); | |
109 | if(result != 22) printf("\n\n\n NO 22!!!!!!!! %d\n\n",result); | |
110 | histo->Fill((Float_t)result); | |
111 | if(i != 99)gSystem->Sleep(10000); | |
112 | } | |
113 | ||
114 | cout<<"Client done"<<endl; | |
115 | histo->Draw(); | |
116 | } | |
117 |