CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/FWCore/Services/src/Profiling.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Services
00004 // Class  :     Timing
00005 //
00006 // Implementation:
00007 //
00008 // Original Author:  Jim Kowalkowski
00009 //
00010 
00011 #include "FWCore/Services/src/Profiling.h"
00012 #include "FWCore/Services/src/SimpleProfiler.h"
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00016 
00017 namespace edm {
00018   namespace service {
00019 
00020     SimpleProfiling::SimpleProfiling(ParameterSet const&,
00021                                      ActivityRegistry&iRegistry) {
00022       iRegistry.watchPostBeginJob(this, &SimpleProfiling::postBeginJob);
00023       iRegistry.watchPostEndJob(this, &SimpleProfiling::postEndJob);
00024     }
00025 
00026 
00027     SimpleProfiling::~SimpleProfiling() {
00028     }
00029 
00030     void SimpleProfiling::fillDescriptions(ConfigurationDescriptions& descriptions) {
00031       ParameterSetDescription desc;
00032       descriptions.add("SimpleProfiling", desc);
00033     }
00034 
00035     void SimpleProfiling::postBeginJob() {
00036       LogInfo("SimpleProfiling")
00037         << "Simple profiling activated.\n";
00038 
00039       SimpleProfiler::instance()->start();
00040     }
00041 
00042     void SimpleProfiling::postEndJob() {
00043       pid_t pid = getpid();
00044 
00045       LogInfo("SimpleProfiling")
00046         << "Simple profiling stopping.\n"
00047         << "You should find three files containing profiling\n"
00048         << "information gathered from program counter\n"
00049         << "samples collected while your job was running.\n"
00050         << "\tA) profdata_" << pid << "_names\n"
00051         << "\tB) profdata_" << pid << "_paths\n"
00052         << "\tC) profdata_" << pid << "_totals\n"
00053         << "\n"
00054         << "A) contains names of function hit count.  You may want\n"
00055         << "   to pass this through c++filt since the name is still mangled\n"
00056         << " columns:\n"
00057         << "\t1) function ID\n"
00058         << "\t2) function address\n"
00059         << "\t3) samples within this function only (leaf count)\n"
00060         << "\t4) samples within this function and children (with recusion)\n"
00061         << "\t5) samples within this function and children\n"
00062         << "\t6) fraction of samples within this function only\n"
00063         << "\t7) fraction of samples within this path (with recusion)\n"
00064         << "\t8) function name (mangled)\n"
00065         << "The file is sorted by column (3) so most-hit functions\n"
00066         << "are at the top\n"
00067         << "\n"
00068         << "B) contains all the unique call paths traversed in this job\n"
00069         << "  columns:\n"
00070         << "\t1) path ID\n"
00071         << "\t2) total times this unique path was observed (samples in leaf)\n"
00072         << "\t3) the path using function IDs (main towards the left)\n"
00073         << "\n"
00074         << "C) contains summary of the total number of samples collected\n"
00075         << "\n";
00076 
00077       SimpleProfiler::instance()->stop();
00078     }
00079   }
00080 }