Anonymous avatar Anonymous committed bd4ebd5

added a python wrapper around the Reflex-dict + added PerfMon::File and its friends

Comments (0)

Files changed (24)

 2007-04-05  Sebastien Binet  <binet@lblbox>
 
+	* tagging PerfMonEvent-00-00-06
+	* added a python wrapper around the Reflex-dict
+	* added a PerfMon::File and all the Data/Header classes
+
 	* tagging PerfMonEvent-00-00-05
 	* added streamers for all classes
 	* TODO: introduce a PerfMon::File and break up Data/Header classes

PerfMonEvent/PerfMonCpuData.h

 // STL includes
 #include <iosfwd>
 #include <vector>
-#include <string>
 
 // Forward declaration
 namespace PerfMon { class CpuSvc; }
+namespace PerfMon { class CpuHdr; }
 
 namespace PerfMon {
 
   // Public typedefs: 
   /////////////////////////////////////////////////////////////////// 
  public: 
-  typedef std::vector<std::string> Tags_t;
-  typedef std::vector<float>       Timings_t;
+  typedef std::vector<float> Timings_t;
 
   /////////////////////////////////////////////////////////////////// 
   // Public methods: 
   CpuData& operator=( const CpuData& rhs ); 
 
   /// Constructor with parameters: 
+  CpuData( const CpuHdr& hdr );
 
   /// Destructor: 
   ~CpuData(); 
   // Const methods: 
   ///////////////////////////////////////////////////////////////////
 
-  /// retrieve PerfMonCpuData header informations for the whole 'run'
-  std::ostream& header( std::ostream& out ) const;
-
   /// retrieve the total (user) time spent for this event
   const float utime() const;
 
-  /// retrieve the tag names for all events
-  const Tags_t& tags() const;
-
   /// retrieve the timings for this event
   const Timings_t& timings() const;
 
   /// set the total (user) time spent for this event
   void setUtime( const float utime );
 
-  /// set the tag names to save for all events (won't be reset by ::clear())
-  void setTags( const Tags_t& tags );
-
   /// set the timings for this event
   void setTimings( const Timings_t& timings );
 
-  /// reset internal state (does NOT reset the tag names !!)
-  void clear();
-
   /////////////////////////////////////////////////////////////////// 
-  // Private CpuData: 
+  // Private data: 
   /////////////////////////////////////////////////////////////////// 
  private: 
 
-  /// list of chrono-tags to save
-  std::vector<std::string> m_tags;
-
   /// list of timings for each of the above tags
   std::vector<float> m_timings;
 
 inline const float CpuData::utime() const
 { return m_utime; }
 
-inline const CpuData::Tags_t& CpuData::tags() const
-{ return m_tags; }
-
 inline const CpuData::Timings_t& CpuData::timings() const
 { return m_timings; }
 
 inline void CpuData::setUtime( const float utime )
 { m_utime = utime; }
 
-inline void CpuData::setTags( const CpuData::Tags_t& tags )
-{ 
-  m_tags = tags; 
-  m_timings.resize( m_tags.size() );
-}
-
 inline void CpuData::setTimings( const CpuData::Timings_t& timings )
 { m_timings = timings; }
 
-inline void CpuData::clear()
-{ 
-  setUtime( -1. );
-  m_timings.assign( m_tags.size(), -1. );
-}
-
 } //> end namespace PerfMon
 
 #endif //> PERFMONEVENT_PERFMONCPUDATA_H

PerfMonEvent/PerfMonCpuHdr.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonCpuHdr.h 
+// Header file for class PerfMon::CpuHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONCPUHDR_H 
+#define PERFMONEVENT_PERFMONCPUHDR_H 
+
+// STL includes
+#include <iosfwd>
+#include <vector>
+#include <string>
+
+// PerfMonEvent includes
+
+// Forward declaration
+
+namespace PerfMon {
+
+class CpuHdr
+{ 
+
+  /// Insertion and extraction operators
+  friend std::istream& operator>>(std::istream& in,        PerfMon::CpuHdr& o);
+  friend std::ostream& operator<<(std::ostream& out, const PerfMon::CpuHdr& o);
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public typedefs: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+  typedef std::vector<std::string> Tags_t;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  /// Default constructor: 
+  CpuHdr();
+
+  /// Copy constructor: 
+  CpuHdr( const CpuHdr& rhs );
+
+  /// Assignment operator: 
+  CpuHdr& operator=( const CpuHdr& rhs ); 
+
+  /// Constructor with parameters: 
+
+  /// Destructor: 
+  ~CpuHdr(); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /// retrieve the tag names
+  const Tags_t& tags() const;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /// set the tag names to save
+  void setTags( const Tags_t& tags );
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// list of chrono-tags to save
+  std::vector<std::string> m_tags;
+
+}; 
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+inline const CpuHdr::Tags_t& CpuHdr::tags() const
+{ return m_tags; }
+
+inline void CpuHdr::setTags( const CpuHdr::Tags_t& tags )
+{ m_tags = tags; }
+
+} //> end namespace PerfMon
+
+#endif //> PERFMONEVENT_PERFMONCPUHDR_H

PerfMonEvent/PerfMonData.h

 
 // Forward declaration
 class PerfMonSvc;
+namespace PerfMon { class Header; }
 
 namespace PerfMon {
 
   Data& operator=( const Data& rhs ); 
 
   /// Constructor with parameters: 
+  Data( const Header& hdr );
 
   /// Destructor: 
   ~Data(); 
   // Const methods: 
   ///////////////////////////////////////////////////////////////////
 
-  /// retrieve PerfMonData header informations for the whole 'run'
-  std::ostream& header( std::ostream& out ) const;
-
   /// retrieve the unique identification informations for this event
   const EventID& eventID() const;
 
   /// set the I/O-related informations for this event
   void setIoData( const IoData& io );
 
-  /// reset internal state
-  void clear();
-
   /////////////////////////////////////////////////////////////////// 
   // Private data: 
   /////////////////////////////////////////////////////////////////// 
 inline void Data::setIoData( const IoData& io )
 { m_io = io; }
 
-inline void Data::clear()
-{ 
-  m_evtID.set_run_number  ( 0 );
-  m_evtID.set_event_number( 0 );
-  m_evtID.set_time_stamp  ( 0 ); 
-  m_evtID.set_time_stamp_ns_offset( 0 );
-  m_evtID.set_lumi_block  ( 0 );
-  m_evtID.set_bunch_crossing_id   ( 0 );
-
-  m_mem.clear();
-  m_cpu.clear();
-  m_io. clear();
-}
-
 } //> end namespace PerfMon
 
 #endif //> PERFMONEVENT_PERFMONDATA_H

PerfMonEvent/PerfMonEventDict.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonEventDict.h 
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONEVENTDICT_H 
+#define PERFMONEVENT_PERFMONEVENTDICT_H 
+
+#include <istream>
+#include <ostream>
+#include <sstream>
+#include <vector>
+
+#include "PerfMonEvent/PerfMonFile.h"
+
+#include "PerfMonEvent/PerfMonHeader.h"
+#include "PerfMonEvent/PerfMonCpuHdr.h"
+#include "PerfMonEvent/PerfMonIoHdr.h"
+#include "PerfMonEvent/PerfMonMemHdr.h"
+
+#include "PerfMonEvent/PerfMonData.h"
+#include "PerfMonEvent/PerfMonCpuData.h"
+#include "PerfMonEvent/PerfMonIoData.h"
+#include "PerfMonEvent/PerfMonMemData.h"
+
+namespace PerfMonEventDict {
+  struct tmp {
+    std::vector<float> m_floats;
+    std::vector<PerfMon::Data> m_vectOfPerfMonData;
+
+  };
+
+  std::string __repr__( const PerfMon::File& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::File& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::Header& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::Header& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::CpuHdr& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::CpuHdr& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::IoHdr& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::IoHdr& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::MemHdr& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::MemHdr& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::Data& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::Data& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::CpuData& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::CpuData& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::IoData& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::IoData& o )
+  { return in >> o; }
+
+  std::string __repr__( const PerfMon::MemData& o ) 
+  { std::ostringstream buf; buf << o; return buf.str(); }
+  std::istream& __rshift__( std::istream& in, PerfMon::MemData& o )
+  { return in >> o; }
+
+} //> end namespace PerfMonEventDict
+
+#endif // PERFMONEVENT_PERFMONEVENTDICT_H

PerfMonEvent/PerfMonFile.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonFile.h 
+// Header file for class PerfMon::File
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONFILE_H 
+#define PERFMONEVENT_PERFMONFILE_H 
+
+// STL includes
+#include <iosfwd>
+#include <string>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonHeader.h"
+#include "PerfMonEvent/PerfMonData.h"
+
+// Forward declaration
+class PerfMonSvc;
+
+namespace PerfMon {
+
+class File
+{ 
+  /// make the PerfMonSvc our friend for efficiency
+  friend class PerfMonSvc;
+
+  /// Insertion and extraction operators
+  friend std::istream& operator>>( std::istream& in,        PerfMon::File& o );
+  friend std::ostream& operator<<( std::ostream& out, const PerfMon::File& o );
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  /// Default constructor: 
+  File();
+
+  /// Constructor with parameters
+  File( const std::string& fileName,
+	std::ios_base::openmode mode = std::ios_base::in );
+
+  /// Destructor: 
+  ~File(); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /// name of the underlying file
+  const std::string& name() const;
+
+  /// retrieve the performance monitoring header informations
+  const PerfMon::Header& dataHeader() const;
+
+  /// retrieve the last performance data entered
+  const PerfMon::Data& data() const;
+
+  /// retrieve the last performance data entered
+  PerfMon::Data& operator>>( PerfMon::Data& o ) const;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /// open the monitoring file
+  void open( const std::string& fileName,
+	     std::ios_base::openmode mode = std::ios_base::in );
+
+  /// setup the performance monitoring header informations
+  void setDataHeader( const PerfMon::Header& hdr );
+
+  /// fill 'initialize' PerfMon::Data
+  void setInitializeData( const PerfMon::Data& o );
+
+  /// fill 'execute' PerfMon::Data
+  const PerfMon::Data& operator<<( const PerfMon::Data& o );
+
+  /// fill 'finalize' PerfMon::Data
+  void setFinalizeData( const PerfMon::Data& o );
+
+  /// close performance monitoring file
+  bool close();
+
+  /// load PerfMon::Data from file
+  std::vector<PerfMon::Data> loadData();
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private methods: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Copy constructor: 
+  File( const File& rhs );
+
+  /// Assignment operator: 
+  File& operator=( const File& rhs ); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// switch to know if file has already been closed
+  bool m_closed;
+
+  /// file handle (I/0)
+  std::fstream* m_hdl;
+
+  /// open mode of the underlying file handle
+  std::ios_base::openmode m_mode;
+
+  /// name of the performance monitoring file
+  std::string m_fileName;
+
+  /// header informations
+  Header m_hdr;
+
+  /// performance monitoring data
+  Data m_data;
+
+}; 
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+inline const std::string& File::name() const
+{ return m_fileName; }
+
+inline const PerfMon::Header& File::dataHeader() const
+{ return m_hdr; }
+
+inline const PerfMon::Data&   File::data() const
+{ return m_data; }
+
+} //> end namespace PerfMon
+
+#endif //> PERFMONEVENT_PERFMONFILE_H

PerfMonEvent/PerfMonHeader.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonHeader.h 
+// Header file for class PerfMon::Header
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONHEADER_H 
+#define PERFMONEVENT_PERFMONHEADER_H 
+
+// STL includes
+#include <iosfwd>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonCpuHdr.h"
+#include "PerfMonEvent/PerfMonIoHdr.h"
+#include "PerfMonEvent/PerfMonMemHdr.h"
+
+// Forward declaration
+class PerfMonSvc;
+
+namespace PerfMon {
+
+class Header
+{ 
+  /// make the PerfMonSvc our friend for efficiency
+  friend class PerfMonSvc;
+
+  /// Insertion and extraction operators
+  friend std::istream& operator>>(std::istream& in,        PerfMon::Header& o);
+  friend std::ostream& operator<<(std::ostream& out, const PerfMon::Header& o);
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  /// Default constructor: 
+  Header();
+
+  /// Copy constructor: 
+  Header( const Header& rhs );
+
+  /// Assignment operator: 
+  Header& operator=( const Header& rhs ); 
+
+  /// Constructor with parameters: 
+
+  /// Destructor: 
+  ~Header(); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /// retrieve the number of entries
+  const unsigned int nEntries() const;
+
+  /// retrieve the CPU-related header data
+  const PerfMon::CpuHdr& cpu() const;
+
+  /// retrieve the I/O-related header data
+  const PerfMon::IoHdr&  io() const;
+
+  /// retrieve the memory-related header data
+  const PerfMon::MemHdr& mem() const;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /// increment the number of entries
+  void increment();
+
+  /// set the number of entries
+  void setEntries( const unsigned int entries );
+
+  /// set the CPU-related header data
+  void setCpuHdr( const PerfMon::CpuHdr& cpu );
+
+  /// set the I/O-related header data
+  void setIoHdr ( const PerfMon::IoHdr& io );
+
+  /// set the memory-related header data
+  void setMemHdr( const PerfMon::MemHdr& mem );
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// number of entries
+  unsigned int m_nEntries;
+
+  /// Header informations for CPU-related data
+  CpuHdr m_cpu;
+
+  /// Header informations for I/O-related data
+  IoHdr  m_io;
+
+  /// Header informations for Memory-related data
+  MemHdr m_mem;
+}; 
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+inline const unsigned int Header::nEntries() const
+{ return m_nEntries; }
+
+inline const PerfMon::CpuHdr& Header::cpu() const
+{ return m_cpu; }
+
+inline const PerfMon::IoHdr&  Header::io() const
+{ return m_io; }
+
+inline const PerfMon::MemHdr& Header::mem() const
+{ return m_mem; }
+
+inline void Header::increment()
+{ m_nEntries += 1; }
+
+inline void Header::setEntries( const unsigned int entries )
+{ m_nEntries = entries; }
+
+inline void Header::setCpuHdr( const PerfMon::CpuHdr& cpu )
+{ m_cpu = cpu; }
+
+inline void Header::setIoHdr( const PerfMon::IoHdr& io )
+{ m_io = io; }
+
+inline void Header::setMemHdr( const PerfMon::MemHdr& mem )
+{ m_mem = mem; }
+
+} //> end namespace PerfMon
+
+#endif //> PERFMONEVENT_PERFMONHEADER_H

PerfMonEvent/PerfMonIoData.h

 // STL includes
 #include <iosfwd>
 #include <vector>
-#include <string>
 
 // Gaudi includes
 
 // Forward declaration
 namespace PerfMon { class IoSvc; }
+namespace PerfMon { class IoHdr; }
 
 namespace PerfMon {
 
   // Public typedefs: 
   /////////////////////////////////////////////////////////////////// 
  public: 
-  typedef std::vector<std::string> Tags_t;
-  typedef std::vector<float>       Timings_t;
-
-  /////////////////////////////////////////////////////////////////// 
-  // Public types: 
-  /////////////////////////////////////////////////////////////////// 
- public: 
-  struct ReadTag  {};
-  struct WriteTag {};
+  typedef std::vector<float> Timings_t;
 
   /////////////////////////////////////////////////////////////////// 
   // Public methods: 
   IoData& operator=( const IoData& rhs ); 
 
   /// Constructor with parameters: 
+  IoData( const IoHdr& hdr );
 
   /// Destructor: 
   ~IoData(); 
   /// retrieve the commit output time for this event
   const float commitTime() const;
 
-  /// retrieve the tag names for all events
-  const Tags_t& tags() const;
+  /// retrieve the [read] timings for this event
+  const Timings_t& readTimings() const;
 
-  /// retrieve the timings for this event
-  template< class TagType >
-  const Timings_t& timings() const;
+  /// retrieve the [write] timings for this event
+  const Timings_t& writeTimings() const;
 
   /////////////////////////////////////////////////////////////////// 
   // Non-const methods: 
   /////////////////////////////////////////////////////////////////// 
 
-  /// retrieve PerfMonIoData header informations for the whole 'run'
-  std::ostream& header( std::ostream& out ) const;
-
   /// set the commit output time for this event
   void setCommitTime( const float time );
 
-  /// set the tag names to save for all events (won't be reset by ::clear())
-  void setTags( const Tags_t& tags );
+  /// set the [read] timings for this event
+  void setReadTimings( const Timings_t& timings );
 
-  /// set the timings for this event
-  template< class TagType >
-  void setTimings( const Timings_t& timings );
-
-  /// reset internal state (does NOT reset the tag names !!)
-  void clear();
+  /// set the [write] timings for this event
+  void setWriteTimings( const Timings_t& timings );
 
   /////////////////////////////////////////////////////////////////// 
-  // Private IoData: 
+  // Private data: 
   /////////////////////////////////////////////////////////////////// 
  private: 
 
-  /// list of chrono-tags to save
-  std::vector<std::string> m_tags;
-
   /// list of [read] timings for each of the above tags
   std::vector<float> m_readTimings;
 
 inline const float IoData::commitTime() const
 { return m_commitOutput; }
 
-inline const IoData::Tags_t& IoData::tags() const
-{ return m_tags; }
-
-template <class TagType>
-inline const IoData::Timings_t& IoData::timings() const
-{ return m_writeTimings; }
-
-template <>
-inline const IoData::Timings_t& IoData::timings<IoData::ReadTag>() const
+inline const IoData::Timings_t& IoData::readTimings() const
 { return m_readTimings; }
 
-template <>
-inline const IoData::Timings_t& IoData::timings<IoData::WriteTag>() const
+inline const IoData::Timings_t& IoData::writeTimings() const
 { return m_writeTimings; }
 
 inline void IoData::setCommitTime( const float time )
 { m_commitOutput = time; }
 
-inline void IoData::setTags( const IoData::Tags_t& tags )
-{ 
-  m_tags = tags; 
-  m_readTimings. resize( m_tags.size() );
-  m_writeTimings.resize( m_tags.size() );
-}
-
-template <class TagType>
-inline void IoData::setTimings( const IoData::Timings_t& timings )
-{ m_writeTimings = timings; }
-
-template <>
 inline void 
-IoData::setTimings<IoData::ReadTag>( const IoData::Timings_t& timings )
+IoData::setReadTimings( const IoData::Timings_t& timings )
 { m_readTimings = timings; }
 
-template <>
 inline void 
-IoData::setTimings<IoData::WriteTag>( const IoData::Timings_t& timings )
+IoData::setWriteTimings( const IoData::Timings_t& timings )
 { m_writeTimings = timings; }
 
-inline void IoData::clear()
-{ 
-  m_readTimings. assign( m_tags.size(), -1. );
-  m_writeTimings.assign( m_tags.size(), -1. );
-  m_commitOutput = -1.;
-}
-
 } //> end namespace PerfMon
 
 #endif //> PERFMONEVENT_PERFMONIODATA_H

PerfMonEvent/PerfMonIoHdr.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonIoHdr.h 
+// Header file for class PerfMon::IoHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONIOHDR_H 
+#define PERFMONEVENT_PERFMONIOHDR_H 
+
+// STL includes
+#include <iosfwd>
+#include <vector>
+#include <string>
+
+// PerfMonEvent includes
+
+// Forward declaration
+
+namespace PerfMon {
+
+class IoHdr
+{ 
+
+  /// Insertion and extraction operators
+  friend std::istream& operator>>(std::istream& in,        PerfMon::IoHdr& o);
+  friend std::ostream& operator<<(std::ostream& out, const PerfMon::IoHdr& o);
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public typedefs: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+  typedef std::vector<std::string> Tags_t;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  /// Default constructor: 
+  IoHdr();
+
+  /// Copy constructor: 
+  IoHdr( const IoHdr& rhs );
+
+  /// Assignment operator: 
+  IoHdr& operator=( const IoHdr& rhs ); 
+
+  /// Constructor with parameters: 
+
+  /// Destructor: 
+  ~IoHdr(); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /// retrieve the tag names
+  const Tags_t& tags() const;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /// set the tag names to save
+  void setTags( const Tags_t& tags );
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// list of chrono-tags to save
+  std::vector<std::string> m_tags;
+
+}; 
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+inline const IoHdr::Tags_t& IoHdr::tags() const
+{ return m_tags; }
+
+inline void IoHdr::setTags( const IoHdr::Tags_t& tags )
+{ m_tags = tags; }
+
+} //> end namespace PerfMon
+
+#endif //> PERFMONEVENT_PERFMONIOHDR_H

PerfMonEvent/PerfMonMemData.h

 #include <iosfwd>
 
 // Forward declaration
+namespace PerfMon { class MemHdr; }
 
 namespace PerfMon {
 
 class MemData
 { 
-
   /// Insertion and extraction operators
   friend std::istream& operator>>( std::istream& in,        MemData& o );
   friend std::ostream& operator<<( std::ostream& out, const MemData& o );
   MemData& operator=( const MemData& rhs ); 
 
   /// Constructor with parameters: 
+  MemData( const MemHdr& hdr );
 
   /// Destructor: 
   ~MemData(); 
   // Const methods: 
   ///////////////////////////////////////////////////////////////////
 
-  /// retrieve PerfMonMemData header informations for the whole 'run'
-  std::ostream& header( std::ostream& out ) const;
-
   /// retrieve the virtual memory size for this event
   const float vsize() const;
 
   /// set the RSS for this event
   void setRSS( const float rss );
 
-  /// reset internal state
-  void clear();
-
   /////////////////////////////////////////////////////////////////// 
-  // Private MemData: 
+  // Private data: 
   /////////////////////////////////////////////////////////////////// 
  private: 
 
 inline void MemData::setRSS( const float rss )
 { m_rss = rss; }
 
-inline void MemData::clear()
-{ 
-  setVSize( -1. );
-  setRSS  ( -1. );
-}
-
 } //> end namespace PerfMon
 
 #endif //> PERFMONEVENT_PERFMONMEMDATA_H

PerfMonEvent/PerfMonMemHdr.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonMemHdr.h 
+// Header file for class PerfMon::MemHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef PERFMONEVENT_PERFMONMEMHDR_H 
+#define PERFMONEVENT_PERFMONMEMHDR_H 
+
+// STL includes
+#include <iosfwd>
+
+// PerfMonEvent includes
+
+// Forward declaration
+
+namespace PerfMon {
+
+class MemHdr
+{ 
+
+  /// Insertion and extraction operators
+  friend std::istream& operator>>(std::istream& in,        PerfMon::MemHdr& o);
+  friend std::ostream& operator<<(std::ostream& out, const PerfMon::MemHdr& o);
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  /// Default constructor: 
+  MemHdr();
+
+  /// Copy constructor: 
+  MemHdr( const MemHdr& rhs );
+
+  /// Assignment operator: 
+  MemHdr& operator=( const MemHdr& rhs ); 
+
+  /// Constructor with parameters: 
+
+  /// Destructor: 
+  ~MemHdr(); 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /// retrieve the page-size
+  const int pageSize() const;
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /// set the page-size
+  void setPageSize( const int pageSize );
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Page size
+  int m_pageSize;
+}; 
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+inline const int MemHdr::pageSize() const
+{ return m_pageSize; }
+
+inline void MemHdr::setPageSize( const int pageSize )
+{ m_pageSize = pageSize; }
+
+} //> end namespace PerfMon
+
+#endif //> PERFMONEVENT_PERFMONMEMHDR_H

PerfMonEvent/selection.xml

+<lcgdict>
+
+  <class name="std::vector<float>" />
+  <class name="PerfMon::File" />
+
+  <class name="PerfMon::Header" />
+  <class name="PerfMon::CpuHdr" />
+  <class name="PerfMon::IoHdr" />
+  <class name="PerfMon::MemHdr" />
+
+  <class name="PerfMon::Data" />
+  <class name="PerfMon::CpuData" />
+  <class name="PerfMon::IoData" />
+  <class name="PerfMon::MemData" />
+
+  <class name="std::vector<PerfMon::Data>" />
+
+  <function pattern="PerfMonEventDict::*" />
+
+</lcgdict>
 
 library PerfMonEvent *.cxx
 apply_pattern installed_library
+
+apply_pattern declare_python_modules files="*.py"
+
+#########################
+# Dictionary generation #
+#########################
+private
+use AtlasSEAL      AtlasSEAL-00-*      External -no_auto_imports
+
+apply_pattern lcgdict dict=PerfMonEvent selectionfile=selection.xml \
+        headerfiles=" ../PerfMonEvent/PerfMonEventDict.h"
+end_private

python/PerfMon.py

+# @author: Sebastien Binet <binet@cern.ch>
+# @date:   April 2007
+#
+#
+
+__version__ = "$Revision: 1.1 $"
+__author__  = "Sebastien Binet <binet@cern.ch>"
+
+__all__ = [ 'File',
+            'Header', 'CpuHdr',  'IoHdr',  'MemHdr',
+            'Data',   'CpuData', 'IoData', 'MemData'
+            ]
+
+import ROOT
+import PyCintex
+
+PyCintex.Cintex.Enable()
+PyCintex.loadDictionary( 'libPerfMonEventDict' )
+
+PerfMon = PyCintex.makeNamespace( 'PerfMon' )
+
+_File = PerfMon.File
+
+Header = PerfMon.Header
+CpuHdr = PerfMon.CpuHdr
+IoHdr  = PerfMon.IoHdr
+MemHdr = PerfMon.MemHdr
+
+Data    = PerfMon.Data
+CpuData = PerfMon.CpuData
+IoData  = PerfMon.IoData
+MemData = PerfMon.MemData
+
+class File( _File ):
+    class std:
+        class ios_base:
+            class openmode:
+                app   = 1L <<  0
+                ate   = 1L <<  1
+                bin   = 1L <<  2
+                in_   = 1L <<  3
+                out   = 1L <<  4
+                trunc = 1L <<  5
+                end   = 1L << 16
+    def __init__(self, fileName, mode = 'r'):
+        """pythonize the '__init__' method"""
+        ## poor man pythonization of opening files (will raise the right excp)
+        f = open(fileName, mode)
+        f.close()
+        if   mode.count('r') > 0: mode = File.std.ios_base.openmode.in_
+        elif mode.count('w') > 0: mode = File.std.ios_base.openmode.out
+        else:
+            raise ValueError, "unknown openmode [%r]" % mode
+        _File.__init__(self, fileName, mode)
+        
+    def open(self, fileName, mode = "r"):
+        """pythonize the 'open' method"""
+        ## poor man pythonization of opening files (will raise the right excp)
+        f = open(fileName, mode)
+        f.close()
+        if   mode.count('r') > 0: mode = File.std.ios_base.openmode.in_
+        elif mode.count('w') > 0: mode = File.std.ios_base.openmode.out
+        else:
+            raise ValueError, "unknown openmode [%r]" % mode
+        _File.open(self, fileName, mode)
+        return
+
+##     def loadData(self):
+##         cppData = _File.loadData(self)
+##         #return [ cppData[i] for i in range(cppData.size()) ]
+##         return cppData
+    
+    pass # class File
+
+def _cnvVect( fct ):
+    cppVect = fct()
+    pyVect  = [ cppVect[i] for i in range( cppVect.size() ) ]
+    del cppVect
+    return pyVect
+
+CpuHdr._tags = CpuHdr.tags
+CpuHdr.tags  = lambda x: _cnvVect(x._tags)
+IoHdr._tags  = IoHdr.tags
+IoHdr.tags   = lambda x: _cnvVect(x._tags)
+
+CpuData._timings = CpuData.timings
+CpuData.timings  = lambda x: _cnvVect(x._timings)
+
+IoData._wtimings    = IoData.writeTimings
+IoData.writeTimings = lambda x: _cnvVect(x._wtimings)
+IoData._rtimings    = IoData.readTimings
+IoData.readTimings  = lambda x: _cnvVect(x._rtimings)
+
+## def _perfMonRepr(self):
+##     _dict = PyCintex.makeNamespace( 'PerfMonEventDict' )
+##     print "typeof:",type(self)
+##     return _dict.__repr__(self)
+
+## #Data.__repr__ = _perfMonRepr
+
+## del _perfMonRepr
+
+if __name__ == '__main__':
+    import PyCintex
+    from PerfMonEvent import PerfMon
+    f = PerfMon.File( 'perfmon.dat', 'r' )
+
+    name = f.name()
+    print "name:",name,type(name)
+    print "entries:",f.dataHeader().nEntries()
+    print "loading PerfMon::Data from file..."
+    data = f.loadData()
+    print "data:",data.size(),type(data)
+
+    d = data[0]
+    print "user time:",d.cpu().utime()
+    print "cpuTimings",d.cpu().timings()
+    print "vsize:",d.mem().vsize()
+    print "rss:  ",d.mem().rss()
+    print "commit:",d.io().commitTime()
+    print "writeTimings:",d.io().writeTimings()
+    print "readTimings: ",d.io().readTimings()
+    

python/__init__.py

+## hook for the PerfMonEvent py-module

src/PerfMonCpuData.cxx

 #include <iterator>
 
 // PerfMonEvent includes
+#include "PerfMonEvent/PerfMonCpuHdr.h"
 #include "PerfMonEvent/PerfMonCpuData.h"
 
 namespace PerfMon {
 /////////////////////////////////////////////////////////////////// 
 
 CpuData::CpuData() :
-  m_tags   ( ),
   m_timings( ),
   m_utime  ( -1. )
 {}
 
+CpuData::CpuData( const CpuHdr& hdr ) :
+  m_timings( hdr.tags().size() ),
+  m_utime  ( -1. )
+{}
+
 CpuData::CpuData( const CpuData& rhs ) :
-  m_tags   ( rhs.m_tags    ),
   m_timings( rhs.m_timings ),
   m_utime  ( rhs.m_utime   )
 {}
 CpuData& CpuData::operator=( const CpuData& rhs )
 {
   if ( this != &rhs ) {
-    m_tags    = rhs.m_tags;
     m_timings = rhs.m_timings;
     m_utime   = rhs.m_utime;
   }
 // Const methods: 
 ///////////////////////////////////////////////////////////////////
 
-std::ostream& CpuData::header( std::ostream& out ) const
-{
-  out << m_tags.size() << ": ";
-  std::copy( m_tags.begin(), m_tags.end(),
-	     std::ostream_iterator<std::string>( out, " " ) );
-  return out;
-}
-
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 std::istream& operator>>( std::istream& in, PerfMon::CpuData& o )
 {
+  const std::size_t n = o.timings().size();
+  for ( std::size_t i = 0; i != n; ++i ) {
+    in >> o.m_timings[i];
+  }
+  in >> o.m_utime;
+
   return in;
 }
 

src/PerfMonCpuHdr.cxx

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonCpuHdr.cxx 
+// Implementation file for class PerfMon::CpuHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+
+// STL includes
+#include <istream>
+#include <ostream>
+#include <iterator>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonCpuHdr.h"
+
+namespace PerfMon {
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+CpuHdr::CpuHdr() :
+  m_tags( )
+{}
+
+CpuHdr::CpuHdr( const CpuHdr& rhs ) :
+  m_tags( rhs.m_tags )
+{}
+
+CpuHdr& CpuHdr::operator=( const CpuHdr& rhs )
+{
+  if ( this != &rhs ) {
+    m_tags = rhs.m_tags;
+  }
+  return *this;
+}
+
+CpuHdr::~CpuHdr()
+{}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+std::ostream& operator<<( std::ostream& out, const PerfMon::CpuHdr& o )
+{
+  out << o.tags().size() << " ";
+  std::copy( o.tags().begin(), o.tags().end(),
+	     std::ostream_iterator<std::string>( out, " " ) );
+  return out;
+}
+
+std::istream& operator>>( std::istream& in, PerfMon::CpuHdr& o )
+{
+  std::size_t n = 0;
+  in >> n;
+
+  o.m_tags.resize( n );
+  for ( std::size_t i = 0; i != n; ++i ) {
+    in >> o.m_tags[i];
+  }
+
+  return in;
+}
+
+} //> end namespace PerfMon
+

src/PerfMonData.cxx

 #include <sstream>
 
 // PerfMonEvent includes
+#include "PerfMonEvent/PerfMonHeader.h"
 #include "PerfMonEvent/PerfMonData.h"
 
 namespace PerfMon {
 
 /////////////////////////////////////////////////////////////////// 
-// Static variables: 
-/////////////////////////////////////////////////////////////////// 
-std::string makeLine( const std::string& val, const std::size_t n )
-{
-  std::ostringstream l;
-  for ( std::size_t i = 0; i != n; ++i ) {
-    l << val;
-  }
-  return l.str();
-}
-
-static std::string evtLine = makeLine( "-", 80 );
-static std::string hdrLine = makeLine( "=", 80 );
-
-/////////////////////////////////////////////////////////////////// 
 // Public methods: 
 /////////////////////////////////////////////////////////////////// 
 
   m_io   ( )
 {}
 
+Data::Data( const Header& hdr ) :
+  m_evtID( ),
+  m_mem  ( hdr.mem() ),
+  m_cpu  ( hdr.cpu() ),
+  m_io   ( hdr.io()  )
+{}
+
 Data::Data( const Data& rhs ) :
   m_evtID( rhs.m_evtID ),
   m_mem  ( rhs.m_mem ),
 /////////////////////////////////////////////////////////////////// 
 // Const methods: 
 ///////////////////////////////////////////////////////////////////
-std::ostream& Data::header( std::ostream& out ) const
-{
-  out << PerfMon::hdrLine << "\n"
-      << "evt: ";
-  out << "\nmem: "; m_mem.header( out );
-  out << "\ncpu: "; m_cpu.header( out );
-  out << "\nio : "; m_io. header( out );
-
-  return out << "\n" << PerfMon::hdrLine << std::endl;
-}
 
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 
 std::ostream& operator<<( std::ostream& out, const PerfMon::Data& o )
 {
-  out << PerfMon::evtLine << "\n"
-      << "evt: " << o.eventID() << "\n"
+  out << "evt: "
+      << "[R,E,L,T,BC]= " 
+      << o.eventID().run_number()           << " "
+      << o.eventID().event_number()         << " "
+      << o.eventID().lumi_block()           << " "
+      << o.eventID().time_stamp()           << " "
+      << o.eventID().time_stamp_ns_offset() << " "
+      << o.eventID().bunch_crossing_id()    << "\n"
       << "mem: " << o.mem()
       << "cpu: " << o.cpu()
-      << "io : " << o.io ()
+      << "io:  " << o.io ()
     ;
   return out;
 }
 std::istream& operator>>( std::istream& in, PerfMon::Data& o )
 {
   std::string s;
-  in >> s
+  in >> s 
      >> s >> o.m_evtID
      >> s >> o.m_mem
      >> s >> o.m_cpu
-     >> s >> o.m_io
-    ;
+     >> s >> o.m_io;
   return in;
 }
 

src/PerfMonFile.cxx

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonFile.cxx 
+// Implementation file for class PerfMon::File
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+
+// STL includes
+#include <istream>
+#include <ostream>
+#include <fstream>
+#include <sstream>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonFile.h"
+
+namespace PerfMon {
+
+/////////////////////////////////////////////////////////////////// 
+// Static variables: 
+/////////////////////////////////////////////////////////////////// 
+std::string makeLine( const std::string& val, const std::size_t n )
+{
+  std::ostringstream l;
+  for ( std::size_t i = 0; i != n; ++i ) {
+    l << val;
+  }
+  return l.str();
+}
+
+static std::string hdrLine  = makeLine( "=", 80 );
+static std::string dataLine = makeLine( "-", 80 );
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+File::File() :
+  m_closed  ( false ),
+  m_hdl     ( 0 ),
+  m_mode    ( std::ios_base::in ),
+  m_fileName( "perfmon.dat" ),
+  m_hdr     (   ),
+  m_data    (   )
+{}
+
+File::File( const std::string& fileName, std::ios_base::openmode mode ) :
+  m_closed  ( false    ),
+  m_hdl     ( 0        ),
+  m_mode    ( mode     ),
+  m_fileName( fileName ),
+  m_hdr     (          ),
+  m_data    (          )
+{
+  open( fileName, mode );
+}
+
+File::File( const File& rhs ) :
+  m_closed  ( rhs.m_closed      ),
+  m_hdl     ( rhs.m_hdl         ),
+  m_mode    ( std::ios_base::in ),
+  m_fileName( rhs.m_fileName    ),
+  m_hdr     ( rhs.m_hdr         ),
+  m_data    ( rhs.m_data        )
+{}
+
+File& File::operator=( const File& rhs )
+{
+  if ( this != &rhs ) {
+    m_closed   = rhs.m_closed;
+    m_hdl      = rhs.m_hdl;
+    m_mode     = rhs.m_mode;
+    m_fileName = rhs.m_fileName;
+    m_hdr      = rhs.m_hdr;
+    m_data     = rhs.m_data;
+  }
+  return *this;
+}
+
+File::~File()
+{
+  close();
+  delete m_hdl;
+  m_hdl = 0;
+}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+void File::open( const std::string& fileName,
+		 std::ios_base::openmode mode )
+{
+  m_fileName = fileName;
+  m_mode     = mode;
+
+  delete m_hdl;
+  m_hdl = new std::fstream( fileName.c_str(), m_mode );
+
+  if ( m_mode & std::ios_base::in ) {
+    std::string tmpHdrLine;
+    (*m_hdl) >> tmpHdrLine
+	     >> m_hdr
+	     >> tmpHdrLine;
+  }
+
+  return;
+}
+
+void File::setDataHeader( const PerfMon::Header& hdr )
+{ 
+  m_hdr = hdr;
+
+  if ( m_mode & std::ios_base::out ) {
+    (*m_hdl) << PerfMon::hdrLine << "\n"
+	     << m_hdr            << "\n"
+	     << PerfMon::hdrLine << "\n";
+  }
+
+  return;
+}
+
+void File::setInitializeData( const PerfMon::Data& o )
+{
+  (*m_hdl) << PerfMon::dataLine << "\n"
+	   << o;
+  return;
+}
+
+const PerfMon::Data& File::operator<<( const PerfMon::Data& o )
+{
+  m_hdr.increment();
+  m_data = o;
+  (*m_hdl) << PerfMon::dataLine << "\n"
+	   << o;
+  return o;
+}
+
+void File::setFinalizeData( const PerfMon::Data& o )
+{
+  (*m_hdl) << PerfMon::dataLine << "\n"
+	   << o;
+  return;
+}
+
+bool File::close()
+{
+  if ( m_closed ) {
+    return true;
+  }
+
+  m_closed = true;
+
+  if ( m_mode & std::ios_base::out ) {
+    // update Header information in output file...
+    const std::ofstream::pos_type pos = m_hdl->tellp();
+    m_hdl->seekp( 0 );
+    (*m_hdl) << PerfMon::hdrLine << "\n"
+	     << m_hdr            << "\n"
+	     << PerfMon::hdrLine << "\n";
+    m_hdl->seekp( pos );
+  }
+
+  return true;
+}
+
+std::vector<PerfMon::Data> File::loadData()
+{
+  m_hdl->seekp( 0 );
+  std::string tmpHdrLine;
+  (*m_hdl) >> tmpHdrLine
+	   >> m_hdr
+	   >> tmpHdrLine;
+
+  std::string tmpDataLine;
+  const std::size_t n = m_hdr.nEntries();
+  std::vector<PerfMon::Data> data; 
+  data.reserve( n );
+
+  for ( std::size_t i = 0; i != n; ++i ) {
+    data.push_back( Data( m_hdr ) );
+    (*m_hdl) >> tmpDataLine
+	     >> data[i];
+  }
+
+  return data;
+}
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+std::ostream& operator<<( std::ostream& out, const PerfMon::File& o )
+{
+  return out << o.m_fileName << "\n"
+	     << o.m_hdr      << "\n"
+	     << o.m_data     << "\n"
+	     << std::flush;
+}
+
+std::istream& operator>>( std::istream& in, PerfMon::File& o )
+{
+  in >> o.m_fileName
+     >> o.m_hdr
+     >> o.m_data;
+  return in;
+}
+
+} //> end namespace PerfMon
+

src/PerfMonHeader.cxx

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonHeader.cxx 
+// Implementation file for class PerfMon::Header
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+
+// STL includes
+#include <istream>
+#include <ostream>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonHeader.h"
+
+namespace PerfMon {
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+Header::Header() :
+  m_nEntries( 0 ),
+  m_cpu     (   ),
+  m_io      (   ),
+  m_mem     (   )
+{}
+
+Header::Header( const Header& rhs ) :
+  m_nEntries( rhs.m_nEntries ),
+  m_cpu     ( rhs.m_cpu      ),
+  m_io      ( rhs.m_io       ),
+  m_mem     ( rhs.m_mem      )
+{}
+
+Header& Header::operator=( const Header& rhs )
+{
+  if ( this != &rhs ) {
+    m_nEntries = rhs.m_nEntries;
+    m_cpu      = rhs.m_cpu;
+    m_io       = rhs.m_io;
+    m_mem      = rhs.m_mem;
+  }
+  return *this;
+}
+
+Header::~Header()
+{}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+std::ostream& operator<<( std::ostream& out, const PerfMon::Header& o )
+{
+  out << o.m_nEntries << "\n"
+      << o.m_cpu      << "\n"
+      << o.m_io       << "\n"
+      << o.m_mem
+    ;
+  return out;
+}
+
+std::istream& operator>>( std::istream& in, PerfMon::Header& o )
+{
+  in >> o.m_nEntries
+     >> o.m_cpu
+     >> o.m_io
+     >> o.m_mem;
+
+  return in;
+}
+
+} //> end namespace PerfMon
+

src/PerfMonIoData.cxx

 #include <iterator>
 
 // PerfMonEvent includes
+#include "PerfMonEvent/PerfMonIoHdr.h"
 #include "PerfMonEvent/PerfMonIoData.h"
 
 namespace PerfMon {
 /////////////////////////////////////////////////////////////////// 
 
 IoData::IoData() :
-  m_tags         (     ),
   m_readTimings  (     ),
   m_writeTimings (     ),
   m_commitOutput ( -1. )
 {}
 
+IoData::IoData( const IoHdr& hdr ) :
+  m_readTimings  ( hdr.tags().size() ),
+  m_writeTimings ( hdr.tags().size() ),
+  m_commitOutput ( -1. )
+{}
+
 IoData::IoData( const IoData& rhs ) :
-  m_tags         ( rhs.m_tags         ),
   m_readTimings  ( rhs.m_readTimings  ),
   m_writeTimings ( rhs.m_writeTimings ),
   m_commitOutput ( rhs.m_commitOutput )
 IoData& IoData::operator=( const IoData& rhs )
 {
   if ( this != &rhs ) {
-    m_tags         = rhs.m_tags;
     m_readTimings  = rhs.m_readTimings;
     m_writeTimings = rhs.m_writeTimings;
     m_commitOutput = rhs.m_commitOutput;
 // Const methods: 
 ///////////////////////////////////////////////////////////////////
 
-std::ostream& IoData::header( std::ostream& out ) const
-{
-  out << m_tags.size() << ": ";
-  std::copy( m_tags.begin(), m_tags.end(),
-	     std::ostream_iterator<std::string>( out, " " ) );
-  return out;
-}
-
-
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
 std::istream& operator>>( std::istream& in, PerfMon::IoData& o )
 {
+  in >> o.m_commitOutput;
+
+  const std::size_t n = o.readTimings().size();
+  for ( std::size_t i = 0; i != n; ++i ) {
+    in >> o.m_readTimings[i];
+  }
+
+  for ( std::size_t i = 0; i != n; ++i ) {
+    in >> o.m_writeTimings[i];
+  }
+
   return in;
 }
 
   buf << std::setw( 16 ) << o.commitTime() << "\n";
   
   for ( PerfMon::IoData::Timings_t::const_iterator 
-	  itr  = o.timings<PerfMon::IoData::ReadTag>().begin(),
-	  iEnd = o.timings<PerfMon::IoData::ReadTag>().end();
+	  itr  = o.readTimings().begin(),
+	  iEnd = o.readTimings().end();
 	itr != iEnd;
 	++itr ) {
     buf << std::setw( 16 ) << *itr;
   buf << "\n";
 
   for ( PerfMon::IoData::Timings_t::const_iterator 
-	  itr  = o.timings<PerfMon::IoData::WriteTag>().begin(),
-	  iEnd = o.timings<PerfMon::IoData::WriteTag>().end();
+	  itr  = o.writeTimings().begin(),
+	  iEnd = o.writeTimings().end();
 	itr != iEnd;
 	++itr ) {
     buf << std::setw( 16 ) << *itr;

src/PerfMonIoHdr.cxx

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonIoHdr.cxx 
+// Implementation file for class PerfMon::IoHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+
+// STL includes
+#include <istream>
+#include <ostream>
+#include <iterator>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonIoHdr.h"
+
+namespace PerfMon {
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+IoHdr::IoHdr() :
+  m_tags( )
+{}
+
+IoHdr::IoHdr( const IoHdr& rhs ) :
+  m_tags( rhs.m_tags )
+{}
+
+IoHdr& IoHdr::operator=( const IoHdr& rhs )
+{
+  if ( this != &rhs ) {
+    m_tags = rhs.m_tags;
+  }
+  return *this;
+}
+
+IoHdr::~IoHdr()
+{}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+std::ostream& operator<<( std::ostream& out, const PerfMon::IoHdr& o )
+{
+  out << o.tags().size() << " ";
+  std::copy( o.tags().begin(), o.tags().end(),
+	     std::ostream_iterator<std::string>( out, " " ) );
+  return out;
+}
+
+std::istream& operator>>( std::istream& in, PerfMon::IoHdr& o )
+{
+  std::size_t n = 0;
+  in >> n;
+
+  o.m_tags.resize( n );
+  for ( std::size_t i = 0; i != n; ++i ) {
+    in >> o.m_tags[i];
+  }
+
+  return in;
+}
+
+} //> end namespace PerfMon
+

src/PerfMonMemData.cxx

 // STL includes
 #include <istream>
 #include <ostream>
-#include <unistd.h>
 
 // PerfMonEvent includes
+#include "PerfMonEvent/PerfMonMemHdr.h"
 #include "PerfMonEvent/PerfMonMemData.h"
 
 namespace PerfMon {
   m_rss  ( -1. )
 {}
 
+MemData::MemData( const MemHdr& /*hdr*/ ) :
+  m_vSize( -1. ),
+  m_rss  ( -1. )
+{}
+
 MemData::MemData( const MemData& rhs ) :
   m_vSize( rhs.m_vSize ),
   m_rss  ( rhs.m_rss   )
 // Const methods: 
 ///////////////////////////////////////////////////////////////////
 
-std::ostream& MemData::header( std::ostream& out ) const
-{
-  out << getpagesize();
-  return out;
-}
-
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 

src/PerfMonMemHdr.cxx

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PerfMonMemHdr.cxx 
+// Implementation file for class PerfMon::MemHdr
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+
+
+// STL includes
+#include <istream>
+#include <ostream>
+#include <sstream>
+#include <unistd.h>
+
+// PerfMonEvent includes
+#include "PerfMonEvent/PerfMonMemHdr.h"
+
+namespace PerfMon {
+
+/////////////////////////////////////////////////////////////////// 
+// Public methods: 
+/////////////////////////////////////////////////////////////////// 
+
+MemHdr::MemHdr() :
+  m_pageSize( getpagesize() )
+{}
+
+MemHdr::MemHdr( const MemHdr& rhs ) :
+  m_pageSize( rhs.m_pageSize )
+{}
+
+MemHdr& MemHdr::operator=( const MemHdr& rhs )
+{
+  if ( this != &rhs ) {
+    m_pageSize = rhs.m_pageSize;
+  }
+  return *this;
+}
+
+MemHdr::~MemHdr()
+{}
+
+/////////////////////////////////////////////////////////////////// 
+// Const methods: 
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Non-const methods: 
+/////////////////////////////////////////////////////////////////// 
+
+/////////////////////////////////////////////////////////////////// 
+// Protected methods: 
+/////////////////////////////////////////////////////////////////// 
+
+std::ostream& operator<<( std::ostream& out, const PerfMon::MemHdr& o )
+{
+  out << o.pageSize();
+  return out;
+}
+
+std::istream& operator>>( std::istream& in, PerfMon::MemHdr& o )
+{
+  in >> o.m_pageSize;
+  return in;
+}
+
+} //> end namespace PerfMon
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.