Commits

bi...@4525493e-7705-40b1-a816-d608a930855b  committed 69da856

added streamers

  • Participants
  • Parent commits fcceb0a

Comments (0)

Files changed (9)

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

File PerfMonEvent/PerfMonCpuData.h

 #include <vector>
 #include <string>
 
-// HepMC / CLHEP includes
-
-// Gaudi includes
-
 // Forward declaration
 namespace PerfMon { class CpuSvc; }
 
 { 
   friend class PerfMon::CpuSvc;
 
+  /// Insertion and extraction operators
+  friend std::istream& operator>>( std::istream& in,        CpuData& o );
+  friend std::ostream& operator<<( std::ostream& out, const CpuData& o );
+
   /////////////////////////////////////////////////////////////////// 
   // Public typedefs: 
   /////////////////////////////////////////////////////////////////// 
   // 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;
 
 
 } //> end namespace PerfMon
 
-/////////////////////////////////////////////////////////////////// 
-// I/O methods: 
-/////////////////////////////////////////////////////////////////// 
-std::ostream& operator<<( std::ostream& out, const PerfMon::CpuData& o );
-
 #endif //> PERFMONEVENT_PERFMONCPUDATA_H

File PerfMonEvent/PerfMonData.h

   /// make the PerfMonSvc our friend for efficiency
   friend class PerfMonSvc;
 
+  /// Insertion and extraction operators
+  friend std::istream& operator>>( std::istream& in,        PerfMon::Data& o );
+  friend std::ostream& operator<<( std::ostream& out, const PerfMon::Data& o );
+
   /////////////////////////////////////////////////////////////////// 
   // Public methods: 
   /////////////////////////////////////////////////////////////////// 
   // 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;
 
 
 } //> end namespace PerfMon
 
-/////////////////////////////////////////////////////////////////// 
-// I/O methods: 
-/////////////////////////////////////////////////////////////////// 
-std::ostream& operator<<( std::ostream& out, const PerfMon::Data& o );
-
 #endif //> PERFMONEVENT_PERFMONDATA_H

File PerfMonEvent/PerfMonIoData.h

 { 
   friend class PerfMon::IoSvc;
 
+  /// Insertion and extraction operators
+  friend std::istream& operator>>( std::istream& in,        IoData& o );
+  friend std::ostream& operator<<( std::ostream& out, const IoData& o );
+
   /////////////////////////////////////////////////////////////////// 
   // Public typedefs: 
   /////////////////////////////////////////////////////////////////// 
   // 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 );
 
 
 } //> end namespace PerfMon
 
-/////////////////////////////////////////////////////////////////// 
-// I/O methods: 
-/////////////////////////////////////////////////////////////////// 
-std::ostream& operator<<( std::ostream& out, const PerfMon::IoData& o );
-
 #endif //> PERFMONEVENT_PERFMONIODATA_H

File PerfMonEvent/PerfMonMemData.h

 // STL includes
 #include <iosfwd>
 
-// HepMC / CLHEP includes
-
-// Gaudi includes
-
 // Forward declaration
 
 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 );
+
   /////////////////////////////////////////////////////////////////// 
   // Public methods: 
   /////////////////////////////////////////////////////////////////// 
   // 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;
 
 
 } //> end namespace PerfMon
 
-/////////////////////////////////////////////////////////////////// 
-// I/O methods: 
-/////////////////////////////////////////////////////////////////// 
-std::ostream& operator<<( std::ostream& out, const PerfMon::MemData& o );
-
 #endif //> PERFMONEVENT_PERFMONMEMDATA_H

File src/PerfMonCpuData.cxx

 
 
 // STL includes
+#include <istream>
+#include <ostream>
+#include <sstream>
 #include <iomanip>
-#include <sstream>
-#include <ostream>
+#include <iterator>
 
 // PerfMonEvent includes
 #include "PerfMonEvent/PerfMonCpuData.h"
 // 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: 
 /////////////////////////////////////////////////////////////////// 
 // Protected methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace PerfMon
+std::istream& operator>>( std::istream& in, PerfMon::CpuData& o )
+{
+  return in;
+}
 
 std::ostream& operator<<( std::ostream& out, const PerfMon::CpuData& o )
 {
 
   return out << buf.str() << "\n";
 }
+
+} //> end namespace PerfMon
+

File src/PerfMonData.cxx

 
 
 // STL includes
+#include <istream>
 #include <ostream>
 #include <sstream>
 
 }
 
 static std::string evtLine = makeLine( "-", 80 );
+static std::string hdrLine = makeLine( "=", 80 );
 
 /////////////////////////////////////////////////////////////////// 
 // Public methods: 
 /////////////////////////////////////////////////////////////////// 
 // 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: 
 // Protected methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace PerfMon
-
 std::ostream& operator<<( std::ostream& out, const PerfMon::Data& o )
 {
   out << PerfMon::evtLine << "\n"
     ;
   return out;
 }
+
+std::istream& operator>>( std::istream& in, PerfMon::Data& o )
+{
+  std::string s;
+  in >> s
+     >> s >> o.m_evtID
+     >> s >> o.m_mem
+     >> s >> o.m_cpu
+     >> s >> o.m_io
+    ;
+  return in;
+}
+
+} //> end namespace PerfMon
+

File src/PerfMonIoData.cxx

 
 
 // STL includes
+#include <istream>
 #include <ostream>
 #include <sstream>
 #include <iomanip>
+#include <iterator>
 
 // PerfMonEvent includes
 #include "PerfMonEvent/PerfMonIoData.h"
 // 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: 
 /////////////////////////////////////////////////////////////////// 
 // Protected methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace PerfMon
+std::istream& operator>>( std::istream& in, PerfMon::IoData& o )
+{
+  return in;
+}
 
 std::ostream& operator<<( std::ostream& out, const PerfMon::IoData& o )
 {
 
   return out << buf.str();
 }
+
+} //> end namespace PerfMon
+

File src/PerfMonMemData.cxx

 
 
 // STL includes
+#include <istream>
 #include <ostream>
+#include <unistd.h>
 
 // PerfMonEvent includes
 #include "PerfMonEvent/PerfMonMemData.h"
 // Const methods: 
 ///////////////////////////////////////////////////////////////////
 
+std::ostream& MemData::header( std::ostream& out ) const
+{
+  out << getpagesize();
+  return out;
+}
+
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 // Protected methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace PerfMon
+std::istream& operator>>( std::istream& in, PerfMon::MemData& o )
+{
+  in >> o.m_vSize >> o.m_rss;
+  return in;
+}
 
 std::ostream& operator<<( std::ostream& out, const PerfMon::MemData& o )
 {
 
   return out;
 }
+
+} //> end namespace PerfMon
+