00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "FWCore/MessageLogger/interface/JobReport.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 #include "FWCore/Utilities/interface/EDMException.h"
00027
00028 #include <iostream>
00029 #include <sstream>
00030
00031
00032
00033 namespace edm
00034 {
00035
00036
00037
00038
00039
00040 template <typename S>
00041 S&
00042 print (S& os, JobReport::InputFile const& f) {
00043
00044 os << "\n<InputFile>";
00045 formatFile(f, os);
00046 os << "\n<InputSourceClass>" << f.inputSourceClassName
00047 << "</InputSourceClass>";
00048 os << "\n<EventsRead>" << f.numEventsRead << "</EventsRead>";
00049 return os;
00050 }
00051
00052
00053 template <typename S>
00054 S&
00055 print (S& os, JobReport::OutputFile const& f) {
00056 formatFile(f, os);
00057 os << "\n<OutputModuleClass>"
00058 << f.outputModuleClassName
00059 << "</OutputModuleClass>";
00060 os << "\n<TotalEvents>"
00061 << f.numEventsWritten
00062 << "</TotalEvents>\n";
00063 os << "\n<DataType>"
00064 << f.dataType
00065 << "</DataType>\n";
00066 os << "\n<BranchHash>"
00067 << f.branchHash
00068 << "</BranchHash>\n";
00069
00070 return os;
00071 }
00072
00073 template <typename S>
00074 S&
00075 print (S& os,
00076 JobReport::RunReport const& rep){
00077 os << "\n<Run ID=\""
00078 <<rep.runNumber
00079 << "\">\n";
00080
00081 std::set<unsigned int>::iterator il;
00082 for (il = rep.lumiSections.begin(); il != rep.lumiSections.end();
00083 ++il){
00084 os << " <LumiSection ID=\"" << *il << "\"/>\n";
00085
00086 }
00087
00088 os << "</Run>\n";
00089
00090
00091 return os;
00092 }
00093
00094 std::ostream& operator<< (std::ostream& os, JobReport::InputFile const& f) {
00095 return print(os,f);
00096 }
00097 std::ostream& operator<< (std::ostream& os, JobReport::OutputFile const& f){
00098 return print(os,f);
00099 }
00100
00101 std::ostream& operator<< (std::ostream& os, JobReport::RunReport const& f){
00102 return print(os,f);
00103 }
00104
00105
00106 edm::MessageSender& operator<< (edm::MessageSender& os, JobReport::InputFile const& f) {
00107 return print(os,f);
00108 }
00109 edm::MessageSender& operator<< (edm::MessageSender& os, JobReport::OutputFile const& f){
00110 return print(os,f);
00111 }
00112 edm::MessageSender& operator<< (edm::MessageSender& os, JobReport::RunReport const& f){
00113 return print(os,f);
00114 }
00115
00116
00117
00118
00119
00120
00121 JobReport::InputFile& JobReport::JobReportImpl::getInputFileForToken(JobReport::Token t) {
00122 if (t >= inputFiles_.size() ) {
00123 throw edm::Exception(edm::errors::LogicError)
00124 << "Access reported for input file with token "
00125 << t
00126 << " but no matching input file is found\n";
00127 }
00128
00129 if (inputFiles_[t].fileHasBeenClosed) {
00130 throw edm::Exception(edm::errors::LogicError)
00131 << "Access reported for input file with token "
00132 << t
00133 << " after this file has been closed.\n"
00134 << "File record follows:\n"
00135 << inputFiles_[t]
00136 << '\n';
00137 }
00138
00139 return inputFiles_[t];
00140 }
00141
00142 JobReport::OutputFile& JobReport::JobReportImpl::getOutputFileForToken(JobReport::Token t) {
00143 if (t >= outputFiles_.size() ) {
00144 throw edm::Exception(edm::errors::LogicError)
00145 << "Access reported for output file with token "
00146 << t
00147 << " but no matching output file is found\n";
00148 }
00149 if (outputFiles_[t].fileHasBeenClosed) {
00150 throw edm::Exception(edm::errors::LogicError)
00151 << "Access reported for output file with token "
00152 << t
00153 << " after this file has been closed.\n"
00154 << "File record follows:\n"
00155 << outputFiles_[t]
00156 << '\n';
00157 }
00158 return outputFiles_[t];
00159 }
00160
00161
00162
00163
00164
00165
00166
00167 void JobReport::JobReportImpl::insertInputForOutputs(JobReport::Token t) {
00168 std::vector<JobReport::OutputFile>::iterator outFile;
00169 for (outFile = outputFiles_.begin();
00170 outFile != outputFiles_.end();
00171 outFile++){
00172 outFile->contributingInputs.push_back(t);
00173 }
00174 }
00175
00176
00177
00178
00179
00180
00181 std::vector<JobReport::Token> JobReport::JobReportImpl::openInputFiles(void) {
00182 std::vector<JobReport::Token> result;
00183 for (unsigned int i = 0; i < inputFiles_.size(); ++i) {
00184 JobReport::InputFile inFile = inputFiles_[i];
00185 if ( inFile.fileHasBeenClosed == false){
00186 result.push_back(i);
00187 }
00188 }
00189 return result;
00190 }
00191
00192
00193
00194
00195
00196
00197 std::vector<JobReport::Token> JobReport::JobReportImpl::openOutputFiles(void) {
00198 std::vector<JobReport::Token> result;
00199 for (unsigned int i = 0; i < outputFiles_.size(); ++i) {
00200 JobReport::OutputFile outFile = outputFiles_[i];
00201 if ( outFile.fileHasBeenClosed == false){
00202 result.push_back(i);
00203 }
00204 }
00205 return result;
00206 }
00207
00208
00209
00210
00211
00212
00213 void JobReport::JobReportImpl::writeInputFile(JobReport::InputFile const& f){
00214 if(ost_) {
00215 *ost_ <<f ;
00216 *ost_ << "\n<Runs>";
00217 std::map<JobReport::RunNumber, JobReport::RunReport>::const_iterator iRun;
00218 for (iRun = f.runReports.begin();
00219 iRun != f.runReports.end(); iRun++){
00220 *ost_ << iRun->second;
00221 }
00222 *ost_ << "\n</Runs>\n";
00223
00224 *ost_ << "</InputFile>\n";
00225
00226
00227 *ost_ << std::flush;
00228 }
00229
00230 }
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 void JobReport::JobReportImpl::writeOutputFile(JobReport::OutputFile const& f) {
00247 if (ost_) {
00248 *ost_ << "\n<File>";
00249 *ost_ <<f;
00250
00251 *ost_ << "\n<Runs>";
00252 std::map<JobReport::RunNumber, JobReport::RunReport>::const_iterator iRun;
00253 for (iRun = f.runReports.begin();
00254 iRun != f.runReports.end(); iRun++){
00255 *ost_ << iRun->second;
00256 }
00257 *ost_ << "\n</Runs>\n";
00258
00259 *ost_ << "\n<Inputs>";
00260 std::vector<JobReport::Token>::const_iterator iInput;
00261 for (iInput = f.contributingInputs.begin();
00262 iInput != f.contributingInputs.end(); iInput++) {
00263 JobReport::InputFile inpFile = inputFiles_[*iInput];
00264 *ost_ <<"\n<Input>";
00265 *ost_ <<"\n <LFN>" << inpFile.logicalFileName << "</LFN>";
00266 *ost_ <<"\n <PFN>" << inpFile.physicalFileName << "</PFN>";
00267 *ost_ <<"\n</Input>";
00268 }
00269 *ost_ << "\n</Inputs>";
00270 *ost_ << "\n</File>";
00271 }
00272 }
00273
00274
00275
00276
00277
00278 void JobReport::JobReportImpl::flushFiles(void) {
00279 std::vector<JobReport::InputFile>::iterator ipos;
00280 std::vector<JobReport::OutputFile>::iterator opos;
00281 for (ipos = inputFiles_.begin(); ipos != inputFiles_.end(); ++ipos) {
00282 if (!(ipos->fileHasBeenClosed)) {
00283 writeInputFile(*ipos);
00284 }
00285 }
00286 for (opos = outputFiles_.begin(); opos != outputFiles_.end(); ++opos) {
00287 if (!(opos->fileHasBeenClosed)) {
00288 writeOutputFile(*opos);
00289 }
00290 }
00291 }
00292
00293 void JobReport::JobReportImpl::addGeneratorInfo(std::string const& name,
00294 std::string const& value){
00295
00296 generatorInfo_[name] = value;
00297 }
00298
00299 void JobReport::JobReportImpl::writeGeneratorInfo(void){
00300 if(ost_) {
00301 *ost_ << "\n<GeneratorInfo>\n";
00302 std::map<std::string, std::string>::iterator pos;
00303 for (pos = generatorInfo_.begin(); pos != generatorInfo_.end(); ++pos){
00304 std::ostringstream msg;
00305 msg << "\n<Data Name=\"" << pos->first
00306 << "\" Value=\"" << pos->second << "\"/>";
00307 *ost_ << msg.str();
00308 }
00309 *ost_ << "</GeneratorInfo>\n";
00310 }
00311 }
00312
00313 void JobReport::JobReportImpl::associateRun(unsigned int runNumber){
00314 std::vector<Token> openFiles = openOutputFiles();
00315 std::vector<Token>::iterator iToken;
00316 for (iToken = openFiles.begin(); iToken != openFiles.end(); iToken++){
00317 JobReport::OutputFile & theFile = outputFiles_[*iToken];
00318
00319
00320
00321
00322 if (theFile.runReports.count(runNumber) == 0){
00323 JobReport::RunReport newReport = JobReport::RunReport();
00324 newReport.runNumber = runNumber;
00325 theFile.runReports.insert(
00326 std::make_pair(runNumber, newReport)
00327 );
00328 }
00329
00330 }
00331 }
00332
00333 void JobReport::JobReportImpl::associateInputRun(unsigned int runNumber){
00334 std::vector<Token> openFiles = openInputFiles();
00335 std::vector<Token>::iterator iToken;
00336 for (iToken = openFiles.begin(); iToken != openFiles.end(); iToken++){
00337 JobReport::InputFile & theFile = inputFiles_[*iToken];
00338
00339
00340
00341
00342
00343 if (theFile.runReports.count(runNumber) == 0){
00344 JobReport::RunReport newReport = JobReport::RunReport();
00345 newReport.runNumber = runNumber;
00346 theFile.runReports.insert(
00347 std::make_pair(runNumber, newReport)
00348 );
00349 }
00350
00351
00352 }
00353 }
00354
00355
00356 void JobReport::JobReportImpl::associateLumiSection(unsigned int runNumber, unsigned int lumiSect){
00357 std::vector<Token> openFiles = openOutputFiles();
00358 std::vector<Token>::iterator iToken;
00359 for (iToken = openFiles.begin(); iToken != openFiles.end(); iToken++){
00360
00361
00362
00363 JobReport::OutputFile & theFile = outputFiles_[*iToken];
00364
00365
00366
00367
00368
00369
00370 if (theFile.runReports.count(runNumber) == 0){
00371 JobReport::RunReport newReport = JobReport::RunReport();
00372 newReport.runNumber = runNumber;
00373 theFile.runReports.insert(
00374 std::make_pair(runNumber, newReport)
00375 );
00376 }
00377
00378
00379
00380
00381 std::map<JobReport::RunNumber, JobReport::RunReport>::iterator finder;
00382 finder = theFile.runReports.find(runNumber);
00383
00384
00385
00386
00387 (finder->second).lumiSections.insert(lumiSect);
00388 }
00389 }
00390
00391
00392 void JobReport::JobReportImpl::associateInputLumiSection(unsigned int runNumber, unsigned int lumiSect){
00393 std::vector<Token> openFiles = openInputFiles();
00394 std::vector<Token>::iterator iToken;
00395 for (iToken = openFiles.begin(); iToken != openFiles.end(); iToken++){
00396
00397
00398
00399 JobReport::InputFile & theFile = inputFiles_[*iToken];
00400
00401
00402
00403
00404 if (theFile.runReports.count(runNumber) == 0){
00405 JobReport::RunReport newReport = JobReport::RunReport();
00406 newReport.runNumber = runNumber;
00407 theFile.runReports.insert(
00408 std::make_pair(runNumber, newReport)
00409 );
00410 }
00411
00412
00413
00414
00415 std::map<JobReport::RunNumber, JobReport::RunReport>::iterator finder;
00416 finder = theFile.runReports.find(runNumber);
00417
00418
00419
00420
00421 (finder->second).lumiSections.insert(lumiSect);
00422 }
00423 }
00424 JobReport::~JobReport() {
00425 impl_->writeGeneratorInfo();
00426 impl_->flushFiles();
00427 if(impl_->ost_) {
00428 *(impl_->ost_)<<"</FrameworkJobReport>\n"<<std::flush;
00429 }
00430 }
00431
00432 JobReport::JobReport() :
00433 impl_(new JobReportImpl(0)) {
00434 }
00435
00436 JobReport::JobReport(std::ostream* iOstream) :
00437 impl_(new JobReportImpl(iOstream) ) {
00438 if(impl_->ost_) {
00439 *(impl_->ost_)<<"<FrameworkJobReport>\n";
00440 }
00441 }
00442
00443 JobReport::Token
00444 JobReport::inputFileOpened(std::string const& physicalFileName,
00445 std::string const& logicalFileName,
00446 std::string const& catalog,
00447 std::string const& inputSourceClassName,
00448 std::string const& moduleLabel,
00449 std::string const& guid,
00450 std::vector<std::string> const& branchNames)
00451 {
00452
00453
00454 impl_->inputFiles_.push_back(JobReport::InputFile());
00455 JobReport::InputFile& r = impl_->inputFiles_.back();
00456
00457 r.logicalFileName = logicalFileName;
00458 r.physicalFileName = physicalFileName;
00459 r.catalog = catalog;
00460 r.inputSourceClassName = inputSourceClassName;
00461 r.moduleLabel = moduleLabel;
00462 r.guid = guid;
00463
00464 r.numEventsRead = 0;
00465 r.branchNames = branchNames;
00466 r.fileHasBeenClosed = false;
00467
00468 JobReport::Token newToken = impl_->inputFiles_.size()-1;
00469
00470
00471
00472 impl_->insertInputForOutputs(newToken);
00473 return newToken;
00474 }
00475
00476 JobReport::Token
00477 JobReport::inputFileOpened(std::string const& physicalFileName,
00478 std::string const& logicalFileName,
00479 std::string const& catalog,
00480 std::string const& inputSourceClassName,
00481 std::string const& moduleLabel,
00482 std::vector<std::string> const& branchNames)
00483 {
00484 return this->inputFileOpened(physicalFileName,
00485 logicalFileName,
00486 catalog,
00487 inputSourceClassName,
00488 moduleLabel,
00489 "",
00490 branchNames);
00491 }
00492
00493 void
00494 JobReport::eventReadFromFile(JobReport::Token fileToken, unsigned int run, unsigned int)
00495 {
00496 JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
00497 f.numEventsRead++;
00498
00499 }
00500
00501 void
00502 JobReport::reportDataType(Token fileToken, std::string const& dataType)
00503 {
00504 JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
00505 f.dataType = dataType;
00506 }
00507
00508 void
00509 JobReport::inputFileClosed(JobReport::Token fileToken)
00510 {
00511 JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
00512
00513
00514
00515
00516 f.fileHasBeenClosed = true;
00517 impl_->writeInputFile(f);
00518 }
00519
00520 JobReport::Token
00521 JobReport::outputFileOpened(std::string const& physicalFileName,
00522 std::string const& logicalFileName,
00523 std::string const& catalog,
00524 std::string const& outputModuleClassName,
00525 std::string const& moduleLabel,
00526 std::string const& guid,
00527 std::string const& dataType,
00528 std::string const& branchHash,
00529 std::vector<std::string> const& branchNames)
00530 {
00531 impl_->outputFiles_.push_back(JobReport::OutputFile());
00532 JobReport::OutputFile& r = impl_->outputFiles_.back();
00533
00534 r.logicalFileName = logicalFileName;
00535 r.physicalFileName = physicalFileName;
00536 r.catalog = catalog;
00537 r.outputModuleClassName = outputModuleClassName;
00538 r.moduleLabel = moduleLabel;
00539 r.guid = guid;
00540 r.dataType = dataType;
00541 r.branchHash = branchHash;
00542
00543 r.numEventsWritten = 0;
00544 r.branchNames = branchNames;
00545 r.fileHasBeenClosed = false;
00546
00547
00548
00549 r.contributingInputs = std::vector<JobReport::Token>(impl_->openInputFiles());
00550 return impl_->outputFiles_.size()-1;
00551 }
00552
00553 JobReport::Token
00554 JobReport::outputFileOpened(std::string const& physicalFileName,
00555 std::string const& logicalFileName,
00556 std::string const& catalog,
00557 std::string const& outputModuleClassName,
00558 std::string const& moduleLabel,
00559 std::string const& guid,
00560 std::string const& dataType,
00561 std::vector<std::string> const& branchNames)
00562 {
00563 return this->outputFileOpened(physicalFileName,
00564 logicalFileName,
00565 catalog,
00566 outputModuleClassName,
00567 moduleLabel,
00568 guid,
00569 "",
00570 "NO_BRANCH_HASH",
00571 branchNames);
00572
00573
00574 }
00575
00576 JobReport::Token
00577 JobReport::outputFileOpened(std::string const& physicalFileName,
00578 std::string const& logicalFileName,
00579 std::string const& catalog,
00580 std::string const& outputModuleClassName,
00581 std::string const& moduleLabel,
00582 std::string const& guid,
00583 std::vector<std::string> const& branchNames)
00584 {
00585 return this->outputFileOpened(physicalFileName,
00586 logicalFileName,
00587 catalog,
00588 outputModuleClassName,
00589 moduleLabel,
00590 guid,
00591 "",
00592 branchNames);
00593
00594 }
00595
00596
00597
00598 JobReport::Token
00599 JobReport::outputFileOpened(std::string const& physicalFileName,
00600 std::string const& logicalFileName,
00601 std::string const& catalog,
00602 std::string const& outputModuleClassName,
00603 std::string const& moduleLabel,
00604 std::vector<std::string> const& branchNames)
00605 {
00606
00607 return this->outputFileOpened(physicalFileName,
00608 logicalFileName,
00609 catalog,
00610 outputModuleClassName,
00611 moduleLabel,
00612 "",
00613 "",
00614 branchNames);
00615 }
00616
00617
00618
00619 void
00620 JobReport::eventWrittenToFile(JobReport::Token fileToken, unsigned int run, unsigned int)
00621 {
00622 JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
00623 f.numEventsWritten++;
00624
00625 }
00626
00627
00628 void
00629 JobReport::outputFileClosed(JobReport::Token fileToken)
00630 {
00631 JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
00632
00633
00634
00635
00636 f.fileHasBeenClosed = true;
00637 impl_->writeOutputFile(f);
00638
00639 }
00640
00641 void
00642 JobReport::overrideEventsWritten(Token fileToken, const int eventsWritten)
00643 {
00644
00645 JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
00646
00647 f.numEventsWritten = eventsWritten;
00648
00649 }
00650
00651 void
00652 JobReport::overrideEventsRead(Token fileToken, const int eventsRead)
00653 {
00654
00655 JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
00656
00657 f.numEventsRead = eventsRead;
00658
00659 }
00660
00661 void
00662 JobReport::overrideContributingInputs(Token outputToken,
00663 std::vector<Token> const& inputTokens)
00664 {
00665
00666 JobReport::OutputFile& f = impl_->getOutputFileForToken(outputToken);
00667
00668 f.contributingInputs = inputTokens;
00669 }
00670
00671 void
00672 JobReport::reportSkippedEvent(unsigned int run, unsigned int event)
00673 {
00674 if(impl_->ost_) {
00675 std::ostream& msg = *(impl_->ost_);
00676 msg << "<SkippedEvent Run=\"" << run << "\"";
00677 msg << " Event=\"" << event << "\" />\n";
00678 msg <<std::flush;
00679
00680 }
00681 }
00682
00683 void
00684 JobReport::reportLumiSection(unsigned int run, unsigned int lumiSectId){
00685 impl_->associateLumiSection(run, lumiSectId);
00686 }
00687 void
00688 JobReport::reportInputLumiSection(unsigned int run, unsigned int lumiSectId){
00689 impl_->associateInputLumiSection(run, lumiSectId);
00690 }
00691
00692 void
00693 JobReport::reportRunNumber(unsigned int run){
00694 impl_->associateRun(run);
00695 }
00696 void
00697 JobReport::reportInputRunNumber(unsigned int run){
00698 impl_->associateInputRun(run);
00699 }
00700
00701
00702 void
00703 JobReport::reportError(std::string const& shortDesc,
00704 std::string const& longDesc)
00705 {
00706 if(impl_->ost_) {
00707 std::ostream& msg =*(impl_->ost_);
00708 msg << "<FrameworkError ExitStatus=\"1\" Type=\"" << shortDesc <<"\" >\n";
00709 msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
00710 msg << "</FrameworkError>\n";
00711
00712 msg << std::flush;
00713 }
00714 }
00715
00716
00717 void
00718 JobReport::reportAnalysisFile(std::string const& fileName, std::map<std::string, std::string> const& fileData) {
00719
00720 if(impl_->ost_) {
00721 std::ostream& msg = *(impl_->ost_);
00722
00723 msg << "<AnalysisFile>\n"
00724 << " <FileName>" << fileName <<"</FileName>\n";
00725
00726 std::map<std::string, std::string>::const_iterator pos;
00727 for (pos = fileData.begin(); pos != fileData.end(); ++pos){
00728 msg << " <" << pos->first
00729 << " Value=\"" << pos->second << "\" />"
00730 << "\n";
00731 }
00732
00733 msg << "</AnalysisFile>\n";
00734
00735 msg <<std::flush;
00736 }
00737
00738
00739 }
00740
00741
00742 void
00743 JobReport::reportError(std::string const& shortDesc,
00744 std::string const& longDesc,
00745 int const& exitCode)
00746 {
00747 if(impl_->ost_) {
00748 std::ostream& msg = *(impl_->ost_);
00749
00750 msg << "<FrameworkError ExitStatus=\""<< exitCode
00751 <<"\" Type=\"" << shortDesc <<"\" >\n";
00752 msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
00753 msg << "</FrameworkError>\n";
00754
00755 msg <<std::flush;
00756 }
00757 }
00758
00759 void
00760 JobReport::reportSkippedFile(std::string const& pfn,
00761 std::string const& lfn) {
00762
00763 if(impl_->ost_) {
00764 std::ostream& msg = *(impl_->ost_);
00765 msg << "<SkippedFile Pfn=\"" << pfn << "\"";
00766 msg << " Lfn=\"" << lfn << "\" />\n";
00767 msg <<std::flush;
00768
00769
00770 }
00771 }
00772
00773 void
00774 JobReport::reportTimingInfo(std::map<std::string, double> const& timingData){
00775
00776 if(impl_->ost_) {
00777 std::ostream& msg=*(impl_->ost_);
00778 msg << "<TimingService>\n";
00779 std::map<std::string, double>::const_iterator pos;
00780 for (pos = timingData.begin(); pos != timingData.end(); ++pos){
00781 msg << " <" << pos->first
00782 << " Value=\"" << pos->second << "\" />"
00783 << "\n";
00784 }
00785 msg << "</TimingService>\n";
00786
00787 msg << std::flush;
00788 }
00789 }
00790
00791 void
00792 JobReport::reportMemoryInfo(std::map<std::string, double> const& memoryData){
00793
00794 if(impl_->ost_) {
00795 std::ostream& msg=*(impl_->ost_);
00796 msg << "<MemoryService>\n";
00797 std::map<std::string, double>::const_iterator pos;
00798 for (pos = memoryData.begin(); pos != memoryData.end(); ++pos){
00799 msg << " <" << pos->first
00800 << " Value=\"" << pos->second << "\" />"
00801 << "\n";
00802 }
00803 msg << "</MemoryService>\n";
00804 msg << std::flush;
00805 }
00806 }
00807
00808 void
00809 JobReport::reportMemoryInfo(std::vector<std::string> const& memoryData){
00810
00811 if(impl_->ost_) {
00812 std::ostream& msg=*(impl_->ost_);
00813 msg << "<MemoryService>\n";
00814
00815 std::vector<std::string>::const_iterator pos;
00816 for (pos = memoryData.begin(); pos != memoryData.end(); ++pos){
00817 msg << *pos << "\n";
00818 }
00819 msg << "</MemoryService>\n";
00820 msg << std::flush;
00821 }
00822 }
00823
00824 void
00825 JobReport::reportMessageInfo(std::map<std::string, double> const& messageData){
00826
00827 if(impl_->ost_) {
00828 std::ostream& msg=*(impl_->ost_);
00829 msg << "<MessageSummary>\n";
00830 std::map<std::string, double>::const_iterator pos;
00831 for (pos = messageData.begin(); pos != messageData.end(); ++pos){
00832 msg << " <" << pos->first
00833 << " Value=\"" << pos->second << "\" />"
00834 << "\n";
00835 }
00836 msg << "</MessageSummary>\n";
00837 msg << std::flush;
00838 }
00839 }
00840
00841 void
00842 JobReport::reportStorageStats(std::string const& data)
00843 {
00844 if(impl_->ost_) {
00845 std::ostream& msg = *(impl_->ost_);
00846 msg << "<StorageStatistics>\n"
00847 << data << "\n"
00848 << "</StorageStatistics>\n";
00849
00850 msg << std::flush;
00851 }
00852 }
00853 void
00854 JobReport::reportGeneratorInfo(std::string const& name, std::string const& value)
00855 {
00856
00857 impl_->addGeneratorInfo(name, value);
00858 }
00859
00860
00861 void JobReport::reportRandomStateFile(std::string const& name)
00862 {
00863 if(impl_->ost_) {
00864 std::ostream& msg = *(impl_->ost_);
00865 msg << "<RandomServiceStateFile>\n"
00866 << name << "\n"
00867 << "</RandomServiceStateFile>\n";
00868
00869 msg << std::flush;
00870 }
00871 }
00872
00873 void
00874 JobReport::reportPSetHash(std::string const& hashValue)
00875 {
00876 if(impl_->ost_){
00877 std::ostream& msg =*(impl_->ost_);
00878 msg << "<PSetHash>"
00879 << hashValue
00880 << "</PSetHash>\n";
00881
00882 msg << std::flush;
00883 }
00884 }
00885
00886
00887 void
00888 JobReport::reportPerformanceSummary(std::string const& metricClass,
00889 std::map<std::string, std::string> const& metrics)
00890 {
00891 if(impl_->ost_){
00892 std::ostream& msg =*(impl_->ost_);
00893 msg << "<PerformanceReport>\n"
00894 << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
00895
00896 std::map<std::string, std::string>::const_iterator iter;
00897 for( iter = metrics.begin(); iter != metrics.end(); ++iter ) {
00898 msg << " <Metric Name=\"" << iter->first << "\" "
00899 <<"Value=\"" << iter->second << "\"/>\n";
00900 }
00901
00902 msg << " </PerformanceSummary>\n"
00903 << "</PerformanceReport>\n";
00904 msg << std::flush;
00905
00906 }
00907 }
00908
00909 void
00910 JobReport::reportPerformanceForModule(std::string const& metricClass,
00911 std::string const& moduleName,
00912 std::map<std::string, std::string> const& metrics)
00913 {
00914 if(impl_->ost_){
00915 std::ostream& msg =*(impl_->ost_);
00916 msg << "<PerformanceReport>\n"
00917 << " <PerformanceModule Metric=\"" << metricClass << "\" "
00918 << " Module=\""<< moduleName << "\" >\n";
00919
00920 std::map<std::string, std::string>::const_iterator iter;
00921 for( iter = metrics.begin(); iter != metrics.end(); ++iter ) {
00922 msg << " <Metric Name=\"" << iter->first << "\" "
00923 <<"Value=\"" << iter->second << "\"/>\n";
00924 }
00925
00926 msg << " </PerformanceModule>\n"
00927 << "</PerformanceReport>\n";
00928 msg << std::flush;
00929
00930 }
00931 }
00932
00933
00934 std::string
00935 JobReport::dumpFiles(void){
00936
00937 std::ostringstream msg;
00938
00939 std::vector<JobReport::OutputFile>::iterator f;
00940
00941 for (f = impl_->outputFiles_.begin();
00942 f != impl_->outputFiles_.end(); f++){
00943
00944 msg << "\n<File>";
00945 msg << *f;
00946
00947 msg << "\n<LumiSections>";
00948
00949
00950
00951
00952
00953
00954 msg << "\n<Inputs>";
00955 std::vector<JobReport::Token>::iterator iInput;
00956 for (iInput = f->contributingInputs.begin();
00957 iInput != f->contributingInputs.end(); iInput++) {
00958 JobReport::InputFile inpFile = impl_->inputFiles_[*iInput];
00959 msg <<"\n<Input>";
00960 msg <<"\n <LFN>" << inpFile.logicalFileName << "</LFN>";
00961 msg <<"\n <PFN>" << inpFile.physicalFileName << "</PFN>";
00962 msg <<"\n</Input>";
00963 }
00964 msg << "\n</Inputs>";
00965 msg << "\n</File>";
00966
00967 }
00968
00969 return msg.str();
00970
00971 }
00972
00973
00974 }