- Implementing functions for the GRP preprocessor to retrieve DA output files from...
[u/mrichter/AliRoot.git] / SHUTTLE / DCSClient / macros / TestClientDP.C
CommitLineData
4b4eb769 1void GetValues(const char* host, Int_t port, const char* request,
2 Long_t startTime, Long_t endTime)
3{
4
5 AliDCSClient client(host, port, 10000, 5);
6
7 Int_t result;
8
9 TTimeStamp currentTime;
10 TMap values;
eba76848 11 values.SetOwner(1);
4b4eb769 12
13 TString rString(request);
14
15 TObjArray* requests = rString.Tokenize(",");
16
17 cout<<"Requests: "<<requests->GetEntries()<<endl;
18
19 TStopwatch sw;
20 sw.Start();
21
22 if (requests->GetEntries() > 1) {
23
24 TIter iter(requests);
25 TObjString* aString;
26 while ((aString = (TObjString*) iter.Next())) {
eba76848 27 TObjArray* valueSet = new TObjArray();
28 valueSet->SetOwner(1);
29
30 result = client.GetDPValues(request, startTime,
31 endTime, valueSet);
32 values.Add(new TObjString(request), valueSet);
33 }
34
4b4eb769 35
36 } else {
37 TObjArray* valueSet = new TObjArray();
38 valueSet->SetOwner(1);
39
4b4eb769 40
41 result = client.GetDPValues(request, startTime,
eba76848 42 endTime, valueSet);
43 values.Add(new TObjString(request), valueSet);
4b4eb769 44 }
45
46 if (result < 0) {
47 cout<<"Communication failure: "<<
48 AliDCSClient::GetErrorString(result)<<endl;
49
50 if (result == AliDCSClient::fgkServerError) {
51 cout<<"Server error code: "<<
52 client.GetServerErrorCode()<<endl;
53 cout<<client.GetServerError()<<endl;
54 }
55 }
56
57 sw.Stop();
58 cout<<"Elapsed time: "<<sw.RealTime()<<endl;
59 if (result > 0) {
60 cout<<"Time per value: "<<sw.RealTime()/result<<endl;
61 }
62 cout<<"Received values: "<<result<<endl;
63
64 TIter iter(&values);
65 TObjString* aRequest;
66 while ((aRequest = (TObjString*) iter.Next())) {
67
68 TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest);
69
70 cout<<" '"<<aRequest->String()<<"' values: "
71 <<valueSet->GetEntriesFast()<<endl;
72
73 TIter valIter(valueSet);
74 AliDCSValue* aValue;
75 while ((aValue = (AliDCSValue*) valIter.Next())) {
76 cout<<aValue->ToString()<<endl;
77 }
78 }
79
eba76848 80
81
82 TFile file("DCSMap.root", "UPDATE");
4b4eb769 83 file.cd();
eba76848 84 values.Write("DCSMap",TObject::kSingleKey);
4b4eb769 85 file.Close();
eba76848 86
4b4eb769 87
88 values.DeleteAll();
89 delete requests;
90
91 cout<<"All values returned in runrange: "<<endl;
92 cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl;
93 cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl;
94}
95
96void TestClientDP(const char* host, Int_t port, const char* request,
97 UInt_t startShift, UInt_t endShift) {
98
2c15234c 99 gSystem->Load("$ALICE_ROOT/SHUTTLE/DCSClient/AliDCSClient");
4b4eb769 100
101// AliLog::EnableDebug(kFALSE);
102// AliLog::SetGlobalDebugLevel(3);
103
104 TTimeStamp currentTime;
105
106 GetValues(host, port, request,
107 currentTime.GetSec() - startShift,
108 currentTime.GetSec() - endShift);
109
110 cout<<"Client done"<<endl;
111}