Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > 8c86774a3e53d77cc119f53a2b94a57a > files > 33

root-tutorial-5.34.14-2.fc18.noarch.rpm

#include <iostream>
#include "TFile.h"
#include "TIterator.h"
#include "TRegexp.h"
#include "TProof.h"


void SavePerfInfo(const Char_t *filename)
{
   // Save PROOF timing information from TPerfStats to file 'filename' 

   if (!gProof) {
      cout << "PROOF must be run to save output performance information" << endl;
      return;
   }
   
   TFile f(filename, "UPDATE");
   if (f.IsZombie()) {
      cout << "Could not open file " << filename << " for writing" << endl;
   } else {
      f.cd();
      
      TIter NextObject(gProof->GetOutputList());
      TObject* obj = 0;
      while (obj = NextObject()) {
         TString objname = obj->GetName();
         if (objname.Contains(TRegexp("^PROOF_"))) {
            // must list the objects since other PROOF_ objects exist
            // besides timing objects
            if (objname == "PROOF_PerfStats" ||
                objname == "PROOF_PacketsHist" ||
                objname == "PROOF_EventsHist" ||
                objname == "PROOF_NodeHist" ||
                objname == "PROOF_LatencyHist" ||
                objname == "PROOF_ProcTimeHist" ||
                objname == "PROOF_CpuTimeHist")
               obj->Write();
         }
      }

      f.Close();
   }

}