#include <iostream>
#include <boost/program_options.hpp>
#include "TClass.h"
#include "TBufferFile.h"
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "FWCore/Utilities/interface/Exception.h"
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 32 of file storageSize.cc.
References MessageLogger_cfi::cerr, className(), gather_cfg::cout, MillePedeFileConverter_cfg::e, FWLiteEnabler::enable(), relativeConstraints::error, cppFunctionSkipper::exception, cms::Exception::explainSelf(), kClassNameOpt, kHelpCommandOpt, kHelpOpt, AlcaSiPixelAliHarvester0T_cff::options, AlCaHLTBitMon_ParallelJobs::p, findQualityFiles::run, AlCaHLTBitMon_QueryRunRegistry::string, and cms::Exception::what().
35 descString +=
" [options] [--";
37 descString +=
"] class_name" 38 "\n The program dumps information about how much storage space is needed to store the class" 40 boost::program_options::options_description desc(descString);
45 boost::program_options::positional_options_description
p;
48 boost::program_options::variables_map vm;
50 store(boost::program_options::command_line_parser(
argc,
argv).
options(desc).positional(p).
run(),vm);
53 std::cerr <<
"failed to parse command line \n"<<iException.what()<<
"\n";
71 TClass* cls = TClass::GetClass(
className.c_str());
77 void* objInstance = cls->New();
78 if(
nullptr == objInstance) {
83 TBufferFile bf(TBuffer::kWrite);
86 cls->WriteBuffer(bf, objInstance);
89 std::cout <<
"Total amount stored: "<<bf.Length()<<
" bytes"<<std::endl;
90 std::cout<<
"\nNOTE: add 4 bytes for each 'has written' value because of a bug in ROOT's printout of the accounting" 91 <<
"\n Each class (inheriting or as member data) has metadata an overhead of 10 bytes"<<std::endl;
static char const *const kHelpCommandOpt
virtual std::string explainSelf() const
static char const *const kClassNameOpt
static void enable()
enable automatic library loading
static char const *const kHelpOpt
std::string className(const T &t)
char const* const kClassNameOpt = "className" |
|
static |
char const* const kHelpCommandOpt ="help,h" |
|
static |
char const* const kHelpOpt = "help" |
|
static |