File indexing completed on 2023-10-25 09:40:21
0001 #include "DetectorDescription/Core/interface/DDRotationMatrix.h"
0002 #include "DetectorDescription/Core/interface/DDTranslation.h"
0003 #include "DetectorDescription/Core/interface/Store.h"
0004 #include "DetectorDescription/Core/interface/DDBase.h"
0005 #include "DetectorDescription/Core/interface/DDCompactView.h"
0006 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0007 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0008 #include "DetectorDescription/Core/interface/DDMaterial.h"
0009 #include "DetectorDescription/Core/interface/DDName.h"
0010 #include "DetectorDescription/Core/interface/DDSolid.h"
0011 #include "DetectorDescription/Core/interface/DDTransform.h"
0012 #include "DetectorDescription/RegressionTest/src/ddstats.h"
0013 #include "DataFormats/Math/interface/Graph.h"
0014
0015 #include <map>
0016 #include <string>
0017 #include <utility>
0018 #include <vector>
0019
0020 struct DDPosData;
0021
0022 void ddstats(std::ostream& os) {
0023 os << "DDD in memory stats:" << std::endl << "====================" << std::endl << std::endl;
0024 DDCompactView cpv;
0025
0026
0027
0028
0029 int noEdges(0);
0030 int noNodes(0);
0031 int noExpNodes(1);
0032
0033
0034 int noLog(0), noSol(0), noMat(0), noRot(0);
0035
0036
0037 int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
0038
0039 int noSolidP(0);
0040
0041
0042 const auto& g = cpv.graph();
0043
0044 DDExpandedView exv(cpv);
0045 while (exv.next())
0046 ++noExpNodes;
0047
0048
0049 auto it = g.begin();
0050 for (; it != g.end(); ++it) {
0051 ++noNodes;
0052 noEdges += it->size();
0053 }
0054
0055 typedef DDLogicalPart::StoreT::value_type lpst_type;
0056 lpst_type& lpst = DDLogicalPart::StoreT::instance();
0057 lpst_type::iterator lpstit = lpst.begin();
0058 for (; lpstit != lpst.end(); ++lpstit) {
0059 noCLog += lpstit->first.name().size();
0060 ++noLog;
0061 }
0062
0063 typedef DDMaterial::StoreT::value_type mast_type;
0064 mast_type& mast = DDMaterial::StoreT::instance();
0065 mast_type::iterator mastit = mast.begin();
0066 for (; mastit != mast.end(); ++mastit) {
0067 noCMat += mastit->first.name().size();
0068 ++noMat;
0069 }
0070
0071 typedef DDSolid::StoreT::value_type sost_type;
0072 sost_type& sost = DDSolid::StoreT::instance();
0073 sost_type::iterator sostit = sost.begin();
0074 for (; sostit != sost.end(); ++sostit) {
0075 noCSol += sostit->first.name().size();
0076 DDSolid s(sostit->first);
0077 noSolidP += s.parameters().size();
0078 ++noSol;
0079 }
0080
0081 typedef DDRotation::StoreT::value_type rost_type;
0082 rost_type& rost = DDRotation::StoreT::instance();
0083 rost_type::iterator rostit = rost.begin();
0084 for (; rostit != rost.end(); ++rostit) {
0085 noCRot += rostit->first.name().size();
0086 ++noRot;
0087 }
0088
0089
0090 std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
0091 std::cout << "sizeof(DDLogicalPart)=" << sizeof(DDLogicalPart) << std::endl;
0092 std::cout << "sizeof(DDTranslation)=" << sizeof(DDTranslation) << std::endl;
0093 std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix) << std::endl;
0094 int store = 4 * sizeof(void*);
0095 int byRot = noRot * (sizeof(DDRotationMatrix) + store);
0096 int bySol = noSolidP * sizeof(double) + noSol * store;
0097 int byMat = noMat * (5 * sizeof(double) + store);
0098 int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
0099 int byNam = noCLog + noCSol + noCMat + noCRot;
0100 int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store);
0101 int byGra = (noEdges + noNodes) * store;
0102 int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
0103 bytes += noNodes * sizeof(DDLogicalPart) + noEdges * sizeof(DDPosData*);
0104 double mb = 1024. * 1024.;
0105
0106 os << "noNodes=" << noNodes << std::endl
0107 << "noEdges=" << noEdges << std::endl
0108 << "noExNod=" << noExpNodes << std::endl
0109 << std::endl;
0110 os << "noLog=" << noLog << std::endl
0111 << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
0112 << "noMat=" << noMat << std::endl
0113 << "noRot=" << noRot << std::endl
0114 << std::endl;
0115 os << "noCLog=" << noCLog << std::endl
0116 << "noCSol=" << noCSol << std::endl
0117 << "noCMat=" << noCMat << std::endl
0118 << "noCRot=" << noCRot << std::endl
0119 << " --------" << std::endl
0120 << " " << byNam << " chars used for naming." << std::endl
0121 << std::endl;
0122 os << "byLog = " << byLog / mb << " logicalparts " << std::endl
0123 << "byNam = " << byNam / mb << " string for names " << std::endl
0124 << "byRot = " << byRot / mb << " rotations " << std::endl
0125 << "bySol = " << bySol / mb << " solids " << std::endl
0126 << "byMat = " << byMat / mb << " materials " << std::endl
0127 << "byPos = " << byPos / mb << " posparts " << std::endl
0128 << "byGra = " << byGra / mb << " graph-struct " << std::endl
0129 << "-----------------------" << std::endl
0130 << "OVERALL: " << bytes / mb << " MByte" << std::endl;
0131 }