Go to the documentation of this file.00001 #include "DetectorDescription/RegressionTest/src/ddstats.h"
00002 #include "DetectorDescription/Core/interface/DDCompactView.h"
00003 #include "DetectorDescription/Core/interface/DDMaterial.h"
00004 #include "DetectorDescription/Core/interface/DDSolid.h"
00005 #include "DetectorDescription/Core/interface/DDTransform.h"
00006 #include "DetectorDescription/Core/interface/DDExpandedView.h"
00007 void ddstats(std::ostream & os)
00008 {
00009
00010 os << "DDD in memory stats:" << std::endl
00011 << "====================" << std::endl << std::endl;
00012 DDCompactView cpv;
00013
00014
00015
00016
00017 int noEdges(0);
00018 int noNodes(0);
00019 int noExpNodes(1);
00020
00021
00022 int noLog(0), noSol(0), noMat(0), noRot(0);
00023
00024
00025 int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
00026
00027 int noSolidP(0);
00028
00029
00030 const DDCompactView::graph_type & g = cpv.graph();
00031
00032 DDExpandedView exv(cpv);
00033 while (exv.next()) ++noExpNodes;
00034
00035
00036 DDCompactView::graph_type::const_adj_iterator it = g.begin();
00037 for(; it != g.end(); ++it) {
00038 ++noNodes;
00039 noEdges += it->size();
00040 }
00041
00042 typedef DDLogicalPart::StoreT::value_type lpst_type;
00043 lpst_type & lpst = DDLogicalPart::StoreT::instance();
00044 lpst_type::iterator lpstit = lpst.begin();
00045 for(; lpstit != lpst.end(); ++lpstit) {
00046 noCLog += lpstit->first.name().size();
00047 ++noLog;
00048 }
00049
00050 typedef DDMaterial::StoreT::value_type mast_type;
00051 mast_type & mast = DDMaterial::StoreT::instance();
00052 mast_type::iterator mastit = mast.begin();
00053 for(; mastit != mast.end(); ++mastit) {
00054 noCMat += mastit->first.name().size();
00055 ++noMat;
00056 }
00057
00058 typedef DDSolid::StoreT::value_type sost_type;
00059 sost_type & sost = DDSolid::StoreT::instance();
00060 sost_type::iterator sostit = sost.begin();
00061 for(; sostit != sost.end(); ++sostit) {
00062 noCSol += sostit->first.name().size();
00063 DDSolid s(sostit->first);
00064 noSolidP += s.parameters().size();
00065 ++noSol;
00066 }
00067
00068 typedef DDRotation::StoreT::value_type rost_type;
00069 rost_type & rost = DDRotation::StoreT::instance();
00070 rost_type::iterator rostit = rost.begin();
00071 for(; rostit != rost.end(); ++rostit) {
00072 noCRot += rostit->first.name().size();
00073 ++noRot;
00074 }
00075
00076
00077 std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
00078 std::cout << "sizeof(DDLogicalPart)="<<sizeof(DDLogicalPart)<<std::endl;
00079 std::cout << "sizeof(DDTranslation)="<< sizeof(DDTranslation)<<std::endl;
00080 std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix)<<std::endl;
00081 int store = 4*sizeof(void*);
00082 int byRot = noRot * (sizeof(DDRotationMatrix) + store);
00083 int bySol = noSolidP * sizeof(double) + noSol*store;
00084 int byMat = noMat * (5*sizeof(double) + store);
00085 int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
00086 int byNam = noCLog + noCSol + noCMat + noCRot;
00087 int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store);
00088 int byGra = (noEdges + noNodes)*store;
00089 int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
00090 bytes += noNodes*sizeof(DDLogicalPart) + noEdges*sizeof(DDPosData*);
00091 double mb = 1024.*1024.;
00092
00093 os << "noNodes=" << noNodes << std::endl
00094 << "noEdges=" << noEdges << std::endl
00095 << "noExNod=" << noExpNodes << std::endl << std::endl;
00096 os << "noLog=" << noLog << std::endl
00097 << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
00098 << "noMat=" << noMat << std::endl
00099 << "noRot=" << noRot << std::endl << std::endl;
00100 os << "noCLog=" << noCLog << std::endl
00101 << "noCSol=" << noCSol << std::endl
00102 << "noCMat=" << noCMat << std::endl
00103 << "noCRot=" << noCRot << std::endl
00104 << " --------" << std::endl
00105 << " " << byNam
00106 << " chars used for naming." << std::endl << std::endl;
00107 os << "byLog = " << byLog/mb << " logicalparts " << std::endl
00108 << "byNam = " << byNam/mb << " string for names " << std::endl
00109 << "byRot = " << byRot/mb << " rotations " << std::endl
00110 << "bySol = " << bySol/mb << " solids " << std::endl
00111 << "byMat = " << byMat/mb << " materials " << std::endl
00112 << "byPos = " << byPos/mb << " posparts " << std::endl
00113 << "byGra = " << byGra/mb << " graph-struct " << std::endl
00114 << "-----------------------" << std::endl
00115 << "OVERALL: " << bytes / mb << " MByte" << std::endl;
00116
00117 }