OPAL (Object Oriented Parallel Accelerator Library) 2024.2
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#include <cstring>
33
35// constructor: Initialize all the ippl-specific statistics objects,
36// and add them to our list of stats
37IpplStats::IpplStats() : StatList(), Time(),
38 MessagesSent(StatList, "Messages sent"),
39 MessagesSentToOthers(StatList, "Messages sent to other nodes"),
40 MessagesSentToSelf(StatList, "Messages sent to our own node"),
41 MessagesReceived(StatList, "Messages received"),
42 MessagesReceivedFromNetwork(StatList, "Messages received from network"),
43 MessagesReceivedFromQueue(StatList, "Messages received from queue"),
44 MessageReceiveChecks(StatList, "Message receive polls"),
45 MessageReceiveChecksFailed(StatList, "Message receive polls which failed"),
46 BytesSent(StatList, "Message total bytes sent"),
47 BytesReceived(StatList, "Message total bytes received"),
48 Barriers(StatList, "Barriers performed"),
49 Reductions(StatList, "General reductions performed"),
50 Scatters(StatList, "General scatters performed"),
51
52 BareFields(StatList, "BareField objects created"),
53 LFields(StatList, "LField objects created"),
54 LFieldBytes(StatList, "LField bytes of storage allocated"),
55 FieldLayouts(StatList, "FieldLayout objects created"),
56 Repartitions(StatList, "BareField objects repartitioned"),
57 Expressions(StatList, "BareField expressions evaluated"),
58 BFEqualsExpression(StatList, "BF=Expression expressions evaluated"),
59 IBFEqualsExpression(StatList, "IBF=Expression expressions evaluated"),
60 ParensEqualsExpression(StatList, "Parens=Expression expressions evaluated"),
61 BFEqualsBF(StatList, "General BF=BF expressions evaluated"),
62 IBFEqualsIBF(StatList, "General IBF=IBF expressions evaluated"),
63 SubEqualsExpression(StatList, "SubField=Expression expressions evaluated"),
64 FFTs(StatList, "FFTs performed"),
65 GuardCellFills(StatList, "Number of times guard cells were filled"),
66 BoundaryConditions(StatList, "Number of times boundary conditions applied"),
67 Compresses(StatList, "Number of LFields compressed"),
68 Decompresses(StatList, "Number of LFields decompressed"),
69 CompressionCompares(StatList, "Number of compression comparisons"),
70 CompressionCompareMax(StatList, "Maximum possible compression comparisons"),
71 BareFieldIterators(StatList, "BareField Iterators created"),
72 DefaultBareFieldIterators(StatList, "Default BareField Iterators created"),
73 BeginScalarCodes(StatList, "Number of scalar code section initializations"),
74 EndScalarCodes(StatList, "Number of scalar code section finalizes"),
75
76 ParticleAttribs(StatList, "ParticleAttrib objects created"),
77 IpplParticleBases(StatList, "IpplParticleBase objects created"),
78 ParticleUpdates(StatList, "Particle object updates"),
79 ParticleExpressions(StatList, "Particle expressions evaluted"),
80 ParticleGathers(StatList, "Particle/Field gather operations"),
81 ParticleScatters(StatList, "Particle/Field scatter operations"),
82 ParticlesCreated(StatList, "Particles created"),
83 ParticlesDestroyed(StatList, "Particles destroyed"),
84 ParticlesSwapped(StatList, "Particles swapped to another node")
85
86{
87 // start the timer
88 Time.stop();
89 Time.clear();
90 Time.start();
91}
92
93
95// destructor: delete all the necessary StatData's
97 for (unsigned int i=0; i < StatList.size(); ++i) {
98 if (StatList[i]->NeedDelete)
99 delete (StatList[i]);
100 }
101}
102
103
105// print out the statistics to the given Inform object
107
108 // if we have no stats, just return
109 if (StatList.size() == 0)
110 return;
111
112 // for each statistic, print out the description, a set of ...'s, and
113 // the stat, right-justified to 10 places
114 o << "Runtime statistics summary:" << endl;
115 for (unsigned int i=0; i < StatList.size(); ++i) {
116 o << StatList[i]->Name << " ";
117 int numperiods = 48 - std::strlen(StatList[i]->Name.c_str());
118 if (numperiods < 2)
119 numperiods = 2;
120 for (int j=0; j < numperiods; ++j)
121 o << ".";
122 o << " " << std::setw(12) << StatList[i]->Value << endl;
123 }
124}
125
126
127/***************************************************************************
128 * $RCSfile: IpplStats.cpp,v $ $Author: adelmann $
129 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
130 * IPPL_VERSION_ID: $Id: IpplStats.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
131 ***************************************************************************/
132
Inform & endl(Inform &inf)
Definition Inform.cpp:42
Representation objects and parsers for attribute expressions.
Definition Expressions.h:64
char * Name
Definition Inform.h:117
std::vector< StatData * > StatList
Definition IpplStats.h:176
void print(Inform &)
Timer Time
Definition IpplStats.h:180
void start()
Definition Timer.cpp:32
void stop()
Definition Timer.cpp:37
void clear()
Definition Timer.cpp:27