CMS 3D CMS Logo

Namespaces | Functions | Variables

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/HiggsAnalysis/CombinedLimit/src/ProfilingTools.cc File Reference

#include "../interface/ProfilingTools.h"
#include <stdio.h>
#include <dlfcn.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <boost/unordered_map.hpp>

Go to the source code of this file.

Namespaces

namespace  runtimedef

Functions

int runtimedef::get (const char *name)
int runtimedef::get (const std::string &name)
void igProfDumpNow (int)
void runtimedef::set (const std::string &name, int value)
 set the flag, with a run-time name
bool setupIgProfDumpHook ()

Variables

boost::unordered_map< const
char *, std::pair< int, int > > 
runtimedef::defines_
boost::unordered_map
< std::string, int > 
runtimedef::definesByString_
int igProfDumpNumber_ = 0
void(* igProfRequestDump_ )(const char *)
boost::unordered_map< const
char *, PerfCounter
perfCounters_

Function Documentation

void igProfDumpNow ( int  )

Definition at line 15 of file ProfilingTools.cc.

References igProfDumpNumber_, and igProfRequestDump_.

Referenced by setupIgProfDumpHook().

                        {
    char buff[50];
    igProfDumpNumber_++;
    sprintf(buff,"dump.%d.%d.out.gz", getpid(), igProfDumpNumber_);
    igProfRequestDump_(buff);
    fprintf(stderr, "Dumped to %s\n", buff); fflush(stderr);
}
bool setupIgProfDumpHook ( )

Definition at line 23 of file ProfilingTools.cc.

References igProfDumpNow(), and igProfRequestDump_.

                           {
    if (void *sym = dlsym(0, "igprof_dump_now")) {
        igProfRequestDump_ = __extension__ (void(*)(const char *)) sym;
        fprintf(stderr, "IgProf dump hook enabled. Do kill -USR2 %d to request a dump.\n", int(getpid())); fflush(stderr);
    } else {
        fprintf(stderr, "Not being profiled by IgProf. The command you should use to profile this is:\n"); 
        fprintf(stderr, "  igprof -mp -z -t combine combine datacard [options]\n\n");
        fflush(stderr);
        return false;
    }
    signal(SIGUSR2,igProfDumpNow);
    return true;
}

Variable Documentation

Definition at line 13 of file ProfilingTools.cc.

Referenced by igProfDumpNow().

void(* igProfRequestDump_)(const char *)

Definition at line 12 of file ProfilingTools.cc.

Referenced by igProfDumpNow(), and setupIgProfDumpHook().

boost::unordered_map<const char *, PerfCounter> perfCounters_

Definition at line 38 of file ProfilingTools.cc.

Referenced by PerfCounter::get(), and PerfCounter::printAll().