OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
IpplStats.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  * This program was prepared by PSI.
7  * All rights in the program are reserved by PSI.
8  * Neither PSI nor the author(s)
9  * makes any warranty, express or implied, or assumes any liability or
10  * responsibility for the use of this software
11  *
12  * Visit www.amas.web.psi for more details
13  *
14  ***************************************************************************/
15 
16 // -*- C++ -*-
17 /***************************************************************************
18  *
19  * The IPPL Framework
20  *
21  *
22  * Visit http://people.web.psi.ch/adelmann/ for more details
23  *
24  ***************************************************************************/
25 
26 // include files
27 #include "Utility/IpplStats.h"
28 #include "Utility/IpplInfo.h"
29 #include "Utility/Inform.h"
30 #include "Utility/Timer.h"
31 
32 
34 // constructor: Initialize all the ippl-specific statistics objects,
35 // and add them to our list of stats
36 IpplStats::IpplStats() : StatList(), Time(),
37  MessagesSent(StatList, "Messages sent"),
38  MessagesSentToOthers(StatList, "Messages sent to other nodes"),
39  MessagesSentToSelf(StatList, "Messages sent to our own node"),
40  MessagesReceived(StatList, "Messages received"),
41  MessagesReceivedFromNetwork(StatList, "Messages received from network"),
42  MessagesReceivedFromQueue(StatList, "Messages received from queue"),
43  MessageReceiveChecks(StatList, "Message receive polls"),
44  MessageReceiveChecksFailed(StatList, "Message receive polls which failed"),
45  BytesSent(StatList, "Message total bytes sent"),
46  BytesReceived(StatList, "Message total bytes received"),
47  Barriers(StatList, "Barriers performed"),
48  Reductions(StatList, "General reductions performed"),
49  Scatters(StatList, "General scatters performed"),
50 
51  BareFields(StatList, "BareField objects created"),
52  LFields(StatList, "LField objects created"),
53  LFieldBytes(StatList, "LField bytes of storage allocated"),
54  FieldLayouts(StatList, "FieldLayout objects created"),
55  Repartitions(StatList, "BareField objects repartitioned"),
56  Expressions(StatList, "BareField expressions evaluated"),
57  BFEqualsExpression(StatList, "BF=Expression expressions evaluated"),
58  IBFEqualsExpression(StatList, "IBF=Expression expressions evaluated"),
59  ParensEqualsExpression(StatList, "Parens=Expression expressions evaluated"),
60  BFEqualsBF(StatList, "General BF=BF expressions evaluated"),
61  IBFEqualsIBF(StatList, "General IBF=IBF expressions evaluated"),
62  SubEqualsExpression(StatList, "SubField=Expression expressions evaluated"),
63  FFTs(StatList, "FFTs performed"),
64  GuardCellFills(StatList, "Number of times guard cells were filled"),
65  BoundaryConditions(StatList, "Number of times boundary conditions applied"),
66  Compresses(StatList, "Number of LFields compressed"),
67  Decompresses(StatList, "Number of LFields decompressed"),
68  CompressionCompares(StatList, "Number of compression comparisons"),
69  CompressionCompareMax(StatList, "Maximum possible compression comparisons"),
70  BareFieldIterators(StatList, "BareField Iterators created"),
71  DefaultBareFieldIterators(StatList, "Default BareField Iterators created"),
72  BeginScalarCodes(StatList, "Number of scalar code section initializations"),
73  EndScalarCodes(StatList, "Number of scalar code section finalizes"),
74 
75  ParticleAttribs(StatList, "ParticleAttrib objects created"),
76  IpplParticleBases(StatList, "IpplParticleBase objects created"),
77  ParticleUpdates(StatList, "Particle object updates"),
78  ParticleExpressions(StatList, "Particle expressions evaluted"),
79  ParticleGathers(StatList, "Particle/Field gather operations"),
80  ParticleScatters(StatList, "Particle/Field scatter operations"),
81  ParticlesCreated(StatList, "Particles created"),
82  ParticlesDestroyed(StatList, "Particles destroyed"),
83  ParticlesSwapped(StatList, "Particles swapped to another node")
84 
85 {
86  // start the timer
87  Time.stop();
88  Time.clear();
89  Time.start();
90 }
91 
92 
94 // destructor: delete all the necessary StatData's
96  for (unsigned int i=0; i < StatList.size(); ++i) {
97  if (StatList[i]->NeedDelete)
98  delete (StatList[i]);
99  }
100 }
101 
102 
104 // print out the statistics to the given Inform object
106 
107  // if we have no stats, just return
108  if (StatList.size() == 0)
109  return;
110 
111  // for each statistic, print out the description, a set of ...'s, and
112  // the stat, right-justified to 10 places
113  o << "Runtime statistics summary:" << endl;
114  for (unsigned int i=0; i < StatList.size(); ++i) {
115  o << StatList[i]->Name << " ";
116  int numperiods = 48 - strlen(StatList[i]->Name.c_str());
117  if (numperiods < 2)
118  numperiods = 2;
119  for (int j=0; j < numperiods; ++j)
120  o << ".";
121  o << " " << std::setw(12) << StatList[i]->Value << endl;
122  }
123 }
124 
125 
126 /***************************************************************************
127  * $RCSfile: IpplStats.cpp,v $ $Author: adelmann $
128  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
129  * IPPL_VERSION_ID: $Id: IpplStats.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
130  ***************************************************************************/
131 
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
Representation objects and parsers for attribute expressions.
Definition: Expressions.h:64
Definition: Inform.h:42
std::vector< StatData * > StatList
Definition: IpplStats.h:176
void print(Inform &)
Definition: IpplStats.cpp:105
Timer Time
Definition: IpplStats.h:180
void start()
Definition: Timer.cpp:34
void stop()
Definition: Timer.cpp:39
void clear()
Definition: Timer.cpp:29