00001 #ifndef FWCore_MessageLogger_JobReport_h
00002 #define FWCore_MessageLogger_JobReport_h
00003
00004
00005
00006
00007
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <cstddef>
00030 #include <string>
00031 #include <ostream>
00032 #include <set>
00033 #include <map>
00034 #include <vector>
00035
00036 #include "boost/scoped_ptr.hpp"
00037
00038 namespace edm {
00039
00040 class JobReport {
00041 public:
00042 typedef unsigned int RunNumber;
00043 typedef std::size_t Token;
00044
00054 struct LumiSectionReport {
00055 unsigned int runNumber;
00056 unsigned int lumiSectionId;
00063 };
00064
00065 struct RunReport {
00066 RunNumber runNumber;
00067 std::set<unsigned int> lumiSections;
00068 };
00069
00079 struct InputFile {
00080 typedef std::vector<std::string> StringVector;
00081
00082 std::string logicalFileName;
00083 std::string physicalFileName;
00084 std::string catalog;
00085 std::string inputType;
00086 std::string inputSourceClassName;
00087 std::string moduleLabel;
00088 std::string guid;
00089 size_t numEventsRead;
00090 StringVector branchNames;
00091 std::map<RunNumber, RunReport> runReports;
00092 bool fileHasBeenClosed;
00093 std::set<std::string> fastClonedBranches;
00094 };
00095
00105 struct OutputFile {
00106
00107 typedef InputFile::StringVector StringVector;
00108
00109 std::string logicalFileName;
00110 std::string physicalFileName;
00111 std::string catalog;
00112 std::string outputModuleClassName;
00113 std::string moduleLabel;
00114 std::string guid;
00115 std::string dataType;
00116 std::string branchHash;
00117 size_t numEventsWritten;
00118 StringVector branchNames;
00119 std::vector<Token> contributingInputs;
00120 std::map<std::string, bool> fastCopyingInputs;
00121 std::map<RunNumber, RunReport> runReports;
00122 bool fileHasBeenClosed;
00123 };
00124
00125 struct JobReportImpl {
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 void removeInputFileRecord_(Token t);
00137 void removeOutputFileRecord_(Token t);
00138
00139 InputFile& getInputFileForToken(Token t);
00140 OutputFile& getOutputFileForToken(Token t);
00141
00142
00143
00144
00145
00146
00147 void insertInputForOutputs(Token t);
00148
00149
00150
00151
00152
00153
00154
00155 void openInputFiles(std::vector<Token>& tokens);
00156
00157
00158
00159
00160
00161 void openOutputFiles(std::vector<Token>& tokens);
00162
00163
00164
00165
00166
00167 void associateLumiSection(unsigned int runNumber, unsigned int lumiSection);
00168
00169
00170
00171
00172
00173
00174 void associateInputLumiSection(unsigned int runNumber, unsigned int lumiSection);
00175
00176
00177
00178 void associateRun(unsigned int runNumber);
00179
00180
00181
00182 void associateInputRun(unsigned int runNumber);
00183
00184
00185
00186
00187
00188
00189 void writeInputFile(InputFile const& f);
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204 void writeOutputFile(OutputFile const& f);
00205
00206
00207
00208
00209
00210 void addGeneratorInfo(std::string const& name, std::string const& value);
00211
00212
00213
00214
00215 void writeGeneratorInfo(void);
00216
00217
00218
00219
00220
00221 void flushFiles(void);
00222
00223 JobReportImpl(std::ostream* iOst): ost_(iOst) {}
00224
00225 std::vector<InputFile> inputFiles_;
00226 std::vector<OutputFile> outputFiles_;
00227 std::map<std::string, std::string> generatorInfo_;
00228 std::map<std::string, long long> readBranches_;
00229 std::set<std::string>* fastClonedBranches_;
00230 std::ostream* ost_;
00231 };
00232
00233 JobReport();
00234
00235 JobReport(std::ostream* outputStream);
00236
00237 ~JobReport();
00238
00240 void childAfterFork(std::string const& jobReportFile, unsigned int childIndex, unsigned int numberOfChildren);
00241
00242 void parentBeforeFork(std::string const& jobReportFile, unsigned int numberOfChildren);
00243
00244 void parentAfterFork(std::string const& jobReportFile);
00245
00249 Token inputFileOpened(std::string const& physicalFileName,
00250 std::string const& logicalFileName,
00251 std::string const& catalog,
00252 std::string const& inputType,
00253 std::string const& inputSourceClassName,
00254 std::string const& moduleLabel,
00255 std::string const& guid,
00256 std::vector<std::string> const& branchNames);
00257
00260 void eventReadFromFile(Token fileToken, unsigned int run, unsigned int event);
00261
00266 void reportDataType(Token fileToken, std::string const& dataType);
00267
00268
00272 void inputFileClosed(Token fileToken);
00273
00277 Token outputFileOpened(std::string const& physicalFileName,
00278 std::string const& logicalFileName,
00279 std::string const& catalog,
00280 std::string const& outputModuleClassName,
00281 std::string const& moduleLabel,
00282 std::string const& guid,
00283 std::string const& dataType,
00284 std::string const& branchHash,
00285 std::vector<std::string> const& branchNames);
00286
00289 void eventWrittenToFile(Token fileToken, unsigned int run, unsigned int event);
00290
00294 void outputFileClosed(Token fileToken);
00295
00301 void overrideEventsWritten(Token fileToken, int const eventsWritten);
00307 void overrideEventsRead(Token fileToken, int const eventsRead);
00308
00309 void reportSkippedEvent(unsigned int run, unsigned int event);
00310
00316 void reportLumiSection(unsigned int run, unsigned int lumiSectId);
00322 void reportInputLumiSection(unsigned int run, unsigned int lumiSectId);
00323
00327 void reportRunNumber(unsigned int run);
00331 void reportInputRunNumber(unsigned int run);
00332
00338 void reportError(std::string const& shortDesc,
00339 std::string const& longDesc);
00340
00341 void reportError(std::string const& shortDesc,
00342 std::string const& longDesc,
00343 int const& exitCode);
00344
00350 void reportSkippedFile(std::string const& pfn, std::string const& lfn);
00351
00352 void reportFallbackAttempt(std::string const& pfn, std::string const& lfn, std::string const& err);
00353
00354 void reportAnalysisFile(std::string const& fileName,
00355 std::map<std::string, std::string> const& fileData) ;
00356
00363 void reportMemoryInfo(std::vector<std::string> const& memoryData);
00364
00371 void reportMessageInfo(std::map<std::string, double> const& messageData);
00372
00379 void reportReadBranches();
00380
00382 void reportReadBranch(std::string const& branchName);
00383
00385 void reportFastClonedBranches(std::set<std::string> const& fastClonedBranches, long long nEvents);
00386
00389 void overrideContributingInputs(Token outputToken, std::vector<Token> const& inputTokens);
00390
00394 void reportGeneratorInfo(std::string const& name, std::string const& value);
00395
00399 void reportRandomStateFile(std::string const& name);
00400
00405 void reportPSetHash(std::string const& hashValue);
00406
00407
00408
00409
00410
00411 void reportFastCopyingStatus(Token t, std::string const& inputFileName, bool fastCopying);
00412
00420 void reportPerformanceSummary(std::string const& metricClass,
00421 std::map<std::string, std::string> const& metrics);
00422
00423 void reportPerformanceForModule(std::string const& metricClass,
00424 std::string const& moduleName,
00425 std::map<std::string, std::string> const& metrics);
00426
00428 std::string dumpFiles(void);
00429
00430 protected:
00431 boost::scoped_ptr<JobReportImpl>& impl() {return impl_;}
00432
00433 private:
00434 boost::scoped_ptr<JobReportImpl> impl_;
00435
00436 };
00437
00438 std::ostream& operator<< (std::ostream& os, JobReport::InputFile const& f);
00439 std::ostream& operator<< (std::ostream& os, JobReport::OutputFile const& f);
00440 std::ostream& operator<< (std::ostream& os, JobReport::LumiSectionReport const& rep);
00441
00442 }
00443
00444 #endif