CMS 3D CMS Logo

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