AliDCSClient "multiSplit" option added in the DCS configuration
[u/mrichter/AliRoot.git] / SHUTTLE / DCSClient / macros / TestClientAlias.C
CommitLineData
1d172743 1TMap* GetValues(const char* host, Int_t port, const char* request,
bee83158 2 UInt_t startTime, UInt_t endTime)
4b4eb769 3{
542b6cc8 4 AliDCSClient client(host, port, 1000, 20, 100);
5 // The 5th parameter switches from single alias to multi aliases!
4b4eb769 6
1d172743 7 //Int_t result;
4b4eb769 8
9 TTimeStamp currentTime;
1d172743 10 //TMap values;
4b4eb769 11
12 TString rString(request);
13
14 TObjArray* requests = rString.Tokenize(",");
15
16 cout<<"Requests: "<<requests->GetEntries()<<endl;
17
1d172743 18 TMap* values=0;
19
4b4eb769 20 TStopwatch sw;
21 sw.Start();
1d172743 22
23 if(requests->GetEntries() == 0) return NULL;
24
25// TIter iter(requests);
26// TObjString* aString;
27// TObjArray* valueSet;
28// while ((aString = (TObjString*) iter.Next())) {
29// cout<<" Querying: "<<aString->GetName()<<endl;
30// valueSet = new TObjArray();
31// valueSet->SetOwner(1);
32//
33// result = client.GetAliasValues(aString->GetName(), startTime,
34// endTime, valueSet);
35// values.Add(aString->Clone(), valueSet);
36// }
37
38 values = client.GetAliasValues(requests, startTime, endTime);
39
40 if (!values) {
4b4eb769 41 cout<<"Communication failure: "<<
1d172743 42 client.GetServerError().Data() <<endl;
43 return NULL;
4b4eb769 44 }
45
46 sw.Stop();
47 cout<<"Elapsed time: "<<sw.RealTime()<<endl;
4b4eb769 48
1d172743 49 cout<<"Time per alias: "<<sw.RealTime()/requests->GetEntries()<<endl;
50
51 cout<<"Received values: "<<endl;
52
53 Int_t nValues=0;
54
55 TIter iter(values);
4b4eb769 56 TObjString* aRequest;
57 while ((aRequest = (TObjString*) iter.Next())) {
58
1d172743 59 TObjArray* valueSet = (TObjArray*) values->GetValue(aRequest);
4b4eb769 60
61 cout<<" '"<<aRequest->String()<<"' values: "
62 <<valueSet->GetEntriesFast()<<endl;
63
64 TIter valIter(valueSet);
65 AliDCSValue* aValue;
66 while ((aValue = (AliDCSValue*) valIter.Next())) {
67 cout<<aValue->ToString()<<endl;
1d172743 68 nValues++;
4b4eb769 69 }
70 }
1d172743 71
72 cout<<"Number of received values: "<< nValues <<endl;
73
4b4eb769 74
75/*
76 TFile file("dump.root", "UPDATE");
77 file.cd();
eba76848 78 values.Write("DCSAliasMap", TObject::kSingleKey);
4b4eb769 79 file.Close();
80*/
81
1d172743 82 //values.DeleteAll();
83 //delete requests;
4b4eb769 84
85 cout<<"All values returned in runrange: "<<endl;
86 cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl;
87 cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl;
1d172743 88
89 return values;
4b4eb769 90}
91
1d172743 92TMap* TestClientAlias(const char* host, Int_t port, const char* request,
4b4eb769 93 UInt_t startShift, UInt_t endShift) {
94
2c15234c 95 gSystem->Load("$ALICE_ROOT/SHUTTLE/DCSClient/AliDCSClient");
4b4eb769 96
97// AliLog::EnableDebug(kFALSE);
98// AliLog::SetGlobalDebugLevel(3);
99
100 TTimeStamp currentTime;
101
542b6cc8 102
1d172743 103 TMap* values = GetValues(host, port, request,
4b4eb769 104 currentTime.GetSec() - startShift,
105 currentTime.GetSec() - endShift);
106
542b6cc8 107
108// SHUTTLE query interval
109/*
110 TMap* values = GetValues(host, port, request,
111 1181300060,
112 1181307260);
113*/
1d172743 114 if(values) values->Print();
115
116 cout << endl;
117 cout <<"Client done"<<endl;
118
119 return values;
4b4eb769 120}