00001 void Draw_Slave_Access(TTree *perfstats);
00002
00003 void Draw_Slave_Access(const Char_t* filename,
00004 const Char_t* perfstatsname = "PROOF_PerfStats") {
00005
00006
00007
00008
00009 if(!TString(gSystem->GetLibraries()).Contains("Proof"))
00010 gSystem->Load("libProof.so");
00011
00012 TFile f(filename);
00013 if (f.IsZombie()) {
00014 cout << "Could not open file " << filename << endl;
00015 return;
00016 }
00017
00018 TTree* perfstats = dynamic_cast<TTree*>(f.Get(perfstatsname));
00019 if (perfstats) {
00020 Draw_Slave_Access(perfstats);
00021 } else {
00022 cout << "No Tree named " << perfstatsname
00023 << " found in file " << filename << endl;
00024 }
00025
00026 delete perfstats;
00027 f.Close();
00028 }
00029
00030 void Draw_Slave_Access(TTree *perfstats) {
00031
00032
00033
00034
00035 gROOT->SetStyle("Plain");
00036 gStyle->SetNdivisions(505, "X");
00037 gStyle->SetNdivisions(505, "Y");
00038 gStyle->SetTitleFontSize(0.07);
00039
00040 if(!TString(gSystem->GetLibraries()).Contains("Proof"))
00041 gSystem->Load("libProof.so");
00042
00043 if (!perfstats) {
00044 cout << "Input tree invalid" << endl;
00045 return;
00046 }
00047
00048
00049 if (!perfstats->FindBranch("PerfEvents")) {
00050 cout << "Input tree does not have a PerfEvents branch" << endl;
00051 return;
00052 }
00053
00054 Int_t nentries = perfstats->GetEntries();
00055 TPerfEvent pe;
00056 TPerfEvent* pep = &pe;
00057 perfstats->SetBranchAddress("PerfEvents",&pep);
00058
00059
00060 TGraph* graph = new TGraph(1);
00061 graph->SetName("all");
00062 graph->SetTitle("Global File Access");
00063
00064 graph->SetPoint(0,0,0);
00065
00066 for(Int_t entry=0;entry<nentries;entry++){
00067 perfstats->GetEntry(entry);
00068
00069
00070 if(pe.fType==TVirtualPerfStats::kFile){
00071
00072 Double_t time = (pe.fTimeStamp.GetSec())+
00073 (pe.fTimeStamp.GetNanoSec())*1e-9;
00074 Int_t npoints=graph->GetN();
00075 Double_t y = (graph->GetY())[npoints-1];
00076 graph->SetPoint(npoints,time,y);
00077 if(pe.fIsStart==kTRUE) y++;
00078 else y--;
00079 graph->SetPoint(npoints+1,time,y);
00080
00081 }
00082 }
00083
00084
00085 perfstats->SetBranchAddress("PerfEvents", 0);
00086
00087
00088 TCanvas* canvas = new TCanvas("slave_access",
00089 "Number of Slaves Accessing Nodes vs Time");
00090 canvas->cd();
00091 graph->GetXaxis()->SetTitle("Time [s]");
00092 graph->GetYaxis()->SetTitle("Number of Slaves Accessing Files");
00093 graph->Draw("AL");
00094 gPad->Update();
00095
00096
00097 TPaveText* titlepave =
00098 dynamic_cast<TPaveText*>(gPad->GetListOfPrimitives()->FindObject("title"));
00099 if (titlepave) {
00100 Double_t x1ndc = titlepave->GetX1NDC();
00101 Double_t x2ndc = titlepave->GetX2NDC();
00102 titlepave->SetX1NDC((1.0-x2ndc+x1ndc)/2.);
00103 titlepave->SetX2NDC((1.0+x2ndc-x1ndc)/2.);
00104 titlepave->SetBorderSize(0);
00105 gPad->Update();
00106 }
00107
00108 gPad->Modified();
00109
00110 }