CMS 3D CMS Logo

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

Generated on Tue Jun 9 17:36:39 2009 for CMSSW by  doxygen 1.5.4