CMS 3D CMS Logo

Functions
ddstats.cc File Reference
#include "DetectorDescription/RegressionTest/src/ddstats.h"
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "DetectorDescription/Base/interface/DDRotationMatrix.h"
#include "DetectorDescription/Base/interface/DDTranslation.h"
#include "DetectorDescription/Base/interface/Store.h"
#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/Core/interface/DDExpandedView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDTransform.h"
#include "DetectorDescription/Core/interface/adjgraph.h"

Go to the source code of this file.

Functions

void ddstats (std::ostream &os)
 

Function Documentation

void ddstats ( std::ostream &  os)

Definition at line 23 of file ddstats.cc.

References graph< N, E >::begin(), gather_cfg::cout, graph< N, E >::end(), g, DDCompactView::graph(), DDI::Singleton< I >::instance(), createfilelist::int, DDExpandedView::next(), DDSolid::parameters(), and alignCSCRings::s.

24 {
25 
26  os << "DDD in memory stats:" << std::endl
27  << "====================" << std::endl << std::endl;
28  DDCompactView cpv;
29 
30  // What we will count:
31  // ----------------------
32 
33  int noEdges(0); // number of graph-multi-edges
34  int noNodes(0); // number of graph-nodes
35  int noExpNodes(1); // number of expanded-nodes
36 
37  // number of Logical- and PosParts, Solids, Materials
38  int noLog(0), noSol(0), noMat(0), noRot(0);
39 
40  // accumulative number of name-characters (logparts,solids,rotation,materials)
41  int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
42 
43  int noSolidP(0); // accumulative number of solid-parameters
44 
45  // fetch the acyclic multigraph
46  const DDCompactView::graph_type & g = cpv.graph();
47 
48  DDExpandedView exv(cpv);
49  while (exv.next()) ++noExpNodes;
50 
51  // iterate over the adjacency-list
53  for(; it != g.end(); ++it) {
54  ++noNodes;
55  noEdges += it->size();
56  }
57 
58  typedef DDLogicalPart::StoreT::value_type lpst_type;
59  lpst_type & lpst = DDLogicalPart::StoreT::instance();
60  lpst_type::iterator lpstit = lpst.begin();
61  for(; lpstit != lpst.end(); ++lpstit) {
62  noCLog += lpstit->first.name().size();
63  ++noLog;
64  }
65 
66  typedef DDMaterial::StoreT::value_type mast_type;
67  mast_type & mast = DDMaterial::StoreT::instance();
68  mast_type::iterator mastit = mast.begin();
69  for(; mastit != mast.end(); ++mastit) {
70  noCMat += mastit->first.name().size();
71  ++noMat;
72  }
73 
74  typedef DDSolid::StoreT::value_type sost_type;
75  sost_type & sost = DDSolid::StoreT::instance();
76  sost_type::iterator sostit = sost.begin();
77  for(; sostit != sost.end(); ++sostit) {
78  noCSol += sostit->first.name().size();
79  DDSolid s(sostit->first);
80  noSolidP += s.parameters().size();
81  ++noSol;
82  }
83 
84  typedef DDRotation::StoreT::value_type rost_type;
85  rost_type & rost = DDRotation::StoreT::instance();
86  rost_type::iterator rostit = rost.begin();
87  for(; rostit != rost.end(); ++rostit) {
88  noCRot += rostit->first.name().size();
89  ++noRot;
90  }
91 
92  // derived quantities
93  std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
94  std::cout << "sizeof(DDLogicalPart)="<<sizeof(DDLogicalPart)<<std::endl;
95  std::cout << "sizeof(DDTranslation)="<< sizeof(DDTranslation)<<std::endl;
96  std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix)<<std::endl;
97  int store = 4*sizeof(void*); // overhead for data-management (est.)
98  int byRot = noRot * (sizeof(DDRotationMatrix) + store); // bytes in rotations
99  int bySol = noSolidP * sizeof(double) + noSol*store; // bytes in solids
100  int byMat = noMat * (5*sizeof(double) + store); // bytes in materials
101  int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
102  int byNam = noCLog + noCSol + noCMat + noCRot; // bytes in strings for names
103  int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store); // LogicalPart
104  int byGra = (noEdges + noNodes)*store; // est. graph structure
105  int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
106  bytes += noNodes*sizeof(DDLogicalPart) + noEdges*sizeof(DDPosData*);
107  double mb = 1024.*1024.;
108 
109  os << "noNodes=" << noNodes << std::endl
110  << "noEdges=" << noEdges << std::endl
111  << "noExNod=" << noExpNodes << std::endl << std::endl;
112  os << "noLog=" << noLog << std::endl
113  << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
114  << "noMat=" << noMat << std::endl
115  << "noRot=" << noRot << std::endl << std::endl;
116  os << "noCLog=" << noCLog << std::endl
117  << "noCSol=" << noCSol << std::endl
118  << "noCMat=" << noCMat << std::endl
119  << "noCRot=" << noCRot << std::endl
120  << " --------" << std::endl
121  << " " << byNam
122  << " chars used for naming." << std::endl << std::endl;
123  os << "byLog = " << byLog/mb << " logicalparts " << std::endl
124  << "byNam = " << byNam/mb << " string for names " << std::endl
125  << "byRot = " << byRot/mb << " rotations " << std::endl
126  << "bySol = " << bySol/mb << " solids " << std::endl
127  << "byMat = " << byMat/mb << " materials " << std::endl
128  << "byPos = " << byPos/mb << " posparts " << std::endl
129  << "byGra = " << byGra/mb << " graph-struct " << std::endl
130  << "-----------------------" << std::endl
131  << "OVERALL: " << bytes / mb << " MByte" << std::endl;
132 
133 }
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
type of data representation of DDCompactView
Definition: DDCompactView.h:90
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:125
adj_iterator begin()
Definition: adjgraph.h:197
Provides an exploded view of the detector (tree-view)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
adj_iterator end()
Definition: adjgraph.h:199