src/Utility/IpplStats.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  * This program was prepared by PSI. 
00007  * All rights in the program are reserved by PSI.
00008  * Neither PSI nor the author(s)
00009  * makes any warranty, express or implied, or assumes any liability or
00010  * responsibility for the use of this software
00011  *
00012  * Visit http://www.acl.lanl.gov/POOMS for more details
00013  *
00014  ***************************************************************************/
00015 
00016 // -*- C++ -*-
00017 /***************************************************************************
00018  *
00019  * The IPPL Framework
00020  * 
00021  *
00022  * Visit http://people.web.psi.ch/adelmann/ for more details
00023  *
00024  ***************************************************************************/
00025 
00026 // include files
00027 #include "Utility/IpplStats.h"
00028 #include "Utility/IpplInfo.h"
00029 #include "Utility/Inform.h"
00030 #include "Utility/Timer.h"
00031 
00032 
00034 // constructor: Initialize all the ippl-specific statistics objects,
00035 // and add them to our list of stats
00036 IpplStats::IpplStats() : StatList(), Time(),
00037   MessagesSent(StatList, "Messages sent"),
00038   MessagesSentToOthers(StatList, "Messages sent to other nodes"),
00039   MessagesSentToSelf(StatList, "Messages sent to our own node"),
00040   MessagesReceived(StatList, "Messages received"),
00041   MessagesReceivedFromNetwork(StatList, "Messages received from network"),
00042   MessagesReceivedFromQueue(StatList, "Messages received from queue"),
00043   MessageReceiveChecks(StatList, "Message receive polls"),
00044   MessageReceiveChecksFailed(StatList, "Message receive polls which failed"),
00045   BytesSent(StatList, "Message total bytes sent"),
00046   BytesReceived(StatList, "Message total bytes received"),
00047   Barriers(StatList, "Barriers performed"),
00048   Reductions(StatList, "General reductions performed"),
00049   Scatters(StatList, "General scatters performed"),
00050 
00051   BareFields(StatList, "BareField objects created"),
00052   LFields(StatList, "LField objects created"),
00053   LFieldBytes(StatList, "LField bytes of storage allocated"),
00054   FieldLayouts(StatList, "FieldLayout objects created"),
00055   Repartitions(StatList, "BareField objects repartitioned"),
00056   Expressions(StatList, "BareField expressions evaluated"),
00057   BFEqualsExpression(StatList, "BF=Expression expressions evaluated"),
00058   IBFEqualsExpression(StatList, "IBF=Expression expressions evaluated"),
00059   ParensEqualsExpression(StatList, "Parens=Expression expressions evaluated"),
00060   BFEqualsBF(StatList, "General BF=BF expressions evaluated"),
00061   IBFEqualsIBF(StatList, "General IBF=IBF expressions evaluated"),
00062   SubEqualsExpression(StatList, "SubField=Expression expressions evaluated"),
00063   FFTs(StatList, "FFTs performed"),
00064   GuardCellFills(StatList, "Number of times guard cells were filled"),
00065   BoundaryConditions(StatList, "Number of times boundary conditions applied"),
00066   Compresses(StatList, "Number of LFields compressed"),
00067   Decompresses(StatList, "Number of LFields decompressed"),
00068   CompressionCompares(StatList, "Number of compression comparisons"),
00069   CompressionCompareMax(StatList, "Maximum possible compression comparisons"),
00070   BareFieldIterators(StatList, "BareField Iterators created"),
00071   DefaultBareFieldIterators(StatList, "Default BareField Iterators created"),
00072   BeginScalarCodes(StatList, "Number of scalar code section initializations"),
00073   EndScalarCodes(StatList, "Number of scalar code section finalizes"),
00074 
00075   ParticleAttribs(StatList, "ParticleAttrib objects created"),
00076   ParticleBases(StatList, "ParticleBase objects created"),
00077   ParticleUpdates(StatList, "Particle object updates"),
00078   ParticleExpressions(StatList, "Particle expressions evaluted"),
00079   ParticleGathers(StatList, "Particle/Field gather operations"),
00080   ParticleScatters(StatList, "Particle/Field scatter operations"),
00081   ParticlesCreated(StatList, "Particles created"),
00082   ParticlesDestroyed(StatList, "Particles destroyed"),
00083   ParticlesSwapped(StatList, "Particles swapped to another node"),
00084 
00085   DiscReads(StatList, "DiscField/Particle reads"),
00086   DiscWrites(StatList, "DiscField/Particle writes"),
00087   DiscFilesetReads(StatList, "DiscField/Particle filesets read"),
00088   DiscFilesetWrites(StatList, "DiscField/Particle filesets written"),
00089   DiscBytesRead(StatList, "DiscField/Particle bytes read"),
00090   DiscBytesWritten(StatList, "DiscField/Particle bytes written")
00091 {
00092   // start the timer
00093   Time.stop();
00094   Time.clear();
00095   Time.start();
00096 }
00097 
00098 
00100 // destructor: delete all the necessary StatData's
00101 IpplStats::~IpplStats() {
00102   for (int i=0; i < StatList.size(); ++i) {
00103     if (StatList[i]->NeedDelete)
00104       delete (StatList[i]);
00105   }
00106 }
00107 
00108 
00110 // print out the statistics to the given Inform object
00111 void IpplStats::print(Inform &o) {
00112   int i,j;
00113 
00114   // if we have no stats, just return
00115   if (StatList.size() == 0)
00116     return;
00117 
00118   // for each statistic, print out the description, a set of ...'s, and
00119   // the stat, right-justified to 10 places
00120   o << "Runtime statistics summary:" << endl;
00121   for (i=0; i < StatList.size(); ++i) {
00122     o << StatList[i]->Name << " ";
00123     int numperiods = 48 - strlen(StatList[i]->Name.c_str());
00124     if (numperiods < 2)
00125       numperiods = 2;
00126     for (j=0; j < numperiods; ++j)
00127       o << ".";
00128     o << " " << setw(12) << StatList[i]->Value << endl;
00129   }
00130 }
00131 
00132 
00133 /***************************************************************************
00134  * $RCSfile: IpplStats.cpp,v $   $Author: adelmann $
00135  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:33 $
00136  * IPPL_VERSION_ID: $Id: IpplStats.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 
00137  ***************************************************************************/
00138 

Generated on Mon Jan 16 13:23:59 2006 for IPPL by  doxygen 1.4.6