From 0bfa77c3a45824eb6cda1a1e852c7aae041694d6 Mon Sep 17 00:00:00 2001
From: wfg <wfg@pc0098504.ornl.gov>
Date: Thu, 9 Mar 2017 17:28:17 -0500
Subject: [PATCH] Adding Profile class and profiling info in Engine/Transports

Changed FD and FP to FileDescriptor and FilePointer, respectively.

Added Profiler class based on chronos header for high resolution time
information in buffering and transport open, write, close
---
 include/core/Engine.h                         |   8 +-
 include/core/Profiler.h                       |  83 +++++++++++
 include/core/Support.h                        |   2 +
 include/core/Transport.h                      |   6 +
 include/engine/bp/BPFileWriter.h              |   3 +-
 include/format/BP1Writer.h                    |   5 -
 .../transport/file/{FD.h => FileDescriptor.h} |  17 +--
 .../transport/file/{FP.h => FilePointer.h}    |  14 +-
 src/core/Engine.cpp                           |   4 +-
 src/core/Transport.cpp                        |  21 +++
 src/engine/bp/BPFileReader.cpp                |   8 +-
 src/engine/bp/BPFileWriter.cpp                | 134 +++++++++++++++---
 src/engine/dataman/DataManReader.cpp          |   4 +-
 src/engine/dataman/DataManWriter.cpp          |   2 -
 src/format/BP1Writer.cpp                      |   4 -
 .../file/{FD.cpp => FileDescriptor.cpp}       |  47 +++++-
 .../file/{FP.cpp => FilePointer.cpp}          |  20 +--
 17 files changed, 302 insertions(+), 80 deletions(-)
 create mode 100644 include/core/Profiler.h
 rename include/transport/file/{FD.h => FileDescriptor.h} (57%)
 rename include/transport/file/{FP.h => FilePointer.h} (75%)
 rename src/transport/file/{FD.cpp => FileDescriptor.cpp} (63%)
 rename src/transport/file/{FP.cpp => FilePointer.cpp} (75%)

diff --git a/include/core/Engine.h b/include/core/Engine.h
index aed47b2c3..985517704 100644
--- a/include/core/Engine.h
+++ b/include/core/Engine.h
@@ -31,7 +31,7 @@
 #include "core/Transform.h"
 #include "core/Transport.h"
 #include "core/Capsule.h"
-
+#include "core/Profiler.h"
 
 namespace adios
 {
@@ -175,11 +175,13 @@ protected:
     unsigned int m_Cores = 1;
     const std::string m_EndMessage; ///< added to exceptions to improve debugging
 
+    Profiler m_Profiler; ///< engine time and bytes profiler
+
     std::set<std::string> m_WrittenVariables; ///< contains the names of the variables that are being written
 
     virtual void Init( ); ///< Initialize m_Capsules and m_Transports, called from constructor
-    virtual void InitCapsules( ); ///< Initialize transports from Method, called from Init in constructor.
-    virtual void InitTransports( ); ///< Initialize transports from Method, called from Init in constructor.
+    virtual void InitParameters( ); ///< Initialize parameters from Method, called from Initi in constructor
+    virtual void InitTransports( ); ///< Initialize transports from Method, called from Init in constructor
 
 
     virtual void Write( Variable<char>& variable,                      const char* values );
diff --git a/include/core/Profiler.h b/include/core/Profiler.h
new file mode 100644
index 000000000..d8888fd9d
--- /dev/null
+++ b/include/core/Profiler.h
@@ -0,0 +1,83 @@
+/*
+ * Profiler.h
+ *
+ *  Created on: Mar 9, 2017
+ *      Author: wfg
+ */
+
+#ifndef PROFILER_H_
+#define PROFILER_H_
+
+#include <chrono>
+
+#include "Support.h"
+
+namespace adios
+{
+
+/**
+ * Utilities for profiling using the chrono header in C++11
+ */
+struct Profiler
+{
+    class Timer
+    {
+
+    public:
+        const std::string Process;
+        unsigned long long int ProcessTime = 0;
+
+        Timer( const std::string process, const Support::Resolutions resolution ):
+            Process{ process },
+            Resolution{ resolution }
+        { }
+
+        void SetInitialTime( )
+        {
+            InitialTime = std::chrono::high_resolution_clock::now();
+        }
+
+        void SetTime( )
+        {
+            ElapsedTime = std::chrono::high_resolution_clock::now();
+            ProcessTime += GetTime( );
+        }
+
+        long long int GetTime( )
+        {
+            if( Resolution == Support::Resolutions::mus )
+                return std::chrono::duration_cast<std::chrono::microseconds>( ElapsedTime - InitialTime ).count();
+
+            else if( Resolution == Support::Resolutions::ms )
+                return std::chrono::duration_cast<std::chrono::milliseconds>( ElapsedTime - InitialTime ).count();
+
+            else if( Resolution == Support::Resolutions::s )
+                return std::chrono::duration_cast<std::chrono::seconds>( ElapsedTime - InitialTime ).count();
+
+            else if( Resolution == Support::Resolutions::m )
+                return std::chrono::duration_cast<std::chrono::minutes>( ElapsedTime - InitialTime ).count();
+
+            else if( Resolution == Support::Resolutions::h )
+                return std::chrono::duration_cast<std::chrono::hours>( ElapsedTime - InitialTime ).count();
+
+            return -1; //failure
+        }
+
+    private:
+
+        const Support::Resolutions Resolution;
+        std::chrono::time_point<std::chrono::high_resolution_clock> InitialTime;
+        std::chrono::time_point<std::chrono::high_resolution_clock> ElapsedTime;
+        bool InitialTimeSet = false;
+    };
+
+    std::vector<Timer> m_Timers;
+    std::vector<unsigned long long int> m_TotalBytes;
+    bool m_IsActive = false;
+};
+
+} //end namespace
+
+
+
+#endif /* PROFILER_H_ */
diff --git a/include/core/Support.h b/include/core/Support.h
index 36f75e80b..f8830a258 100644
--- a/include/core/Support.h
+++ b/include/core/Support.h
@@ -30,6 +30,8 @@ struct Support
     static const std::map<std::string, std::set<std::string> > DatatypesAliases; ///< all supported int aliases, key: C++ type (e.g. int), value: aliases to type in key (e.g. int, integer)
 
     static const std::set<std::string> FileTransports; ///< file I/O transports
+
+    enum class Resolutions { mus, ms, s, m, h };
 };
 
 
diff --git a/include/core/Transport.h b/include/core/Transport.h
index 034744263..532b286fa 100644
--- a/include/core/Transport.h
+++ b/include/core/Transport.h
@@ -19,6 +19,7 @@
   #include <mpi.h>
 #endif
 
+#include "core/Profiler.h"
 
 
 namespace adios
@@ -38,6 +39,7 @@ public:
 
     int m_RankMPI = 0; ///< current MPI rank process
     int m_SizeMPI = 1; ///< current MPI processes size
+    Profiler m_Profiler; ///< collects information about Open and bytes Transport
 
     /**
      * Base constructor that all derived classes pass
@@ -76,10 +78,14 @@ public:
     virtual void Close( ); ///< closes current transport and flushes everything, transport becomes unreachable
 
 
+    virtual void InitProfiler( const Support::Resolutions resolution );
+
 protected:
 
     const bool m_DebugMode = false; ///< if true: additional checks and exceptions
 
+
+
 };
 
 
diff --git a/include/engine/bp/BPFileWriter.h b/include/engine/bp/BPFileWriter.h
index 6b760ee69..7c4f637c7 100644
--- a/include/engine/bp/BPFileWriter.h
+++ b/include/engine/bp/BPFileWriter.h
@@ -8,8 +8,6 @@
 #ifndef BPFILEWRITER_H_
 #define BPFILEWRITER_H_
 
-#include <iostream> //will go away
-
 #include "core/Engine.h"
 #include "format/BP1Writer.h"
 
@@ -60,6 +58,7 @@ private:
     bool m_TransportFlush = false; ///< true: transport flush happened, buffer must be reset
 
     void Init( );
+    void InitParameters( );
     void InitTransports( );
     void InitProcessGroup( );
 
diff --git a/include/format/BP1Writer.h b/include/format/BP1Writer.h
index d54d4212c..f209bcea4 100644
--- a/include/format/BP1Writer.h
+++ b/include/format/BP1Writer.h
@@ -316,11 +316,6 @@ public:
     void WriteVariablePayload( const Variable<T>& variable, capsule::STLVector& buffer, const unsigned int cores = 1 ) const noexcept
     {
         std::size_t payloadSize = variable.PayLoadSize(); //not using const due to memcpy inside Memcpythreads
-//        std::cout << variable.m_Name << "\n";
-//        std::cout << "Payload position: " << buffer.m_DataPosition << "\n";
-//        std::cout << "Payload size: " << payloadSize << "\n\n";
-
-
         //EXPENSIVE part, might want to use threads if large, serial for now
         MemcpyThreads( &buffer.m_Data[buffer.m_DataPosition], variable.m_AppValues, payloadSize, cores );
         //update indices
diff --git a/include/transport/file/FD.h b/include/transport/file/FileDescriptor.h
similarity index 57%
rename from include/transport/file/FD.h
rename to include/transport/file/FileDescriptor.h
index 4c005ccbb..5555c450c 100644
--- a/include/transport/file/FD.h
+++ b/include/transport/file/FileDescriptor.h
@@ -1,12 +1,12 @@
 /*
- * POSIXMPI.h
+ * FileDescriptor.h
  *
  *  Created on: Oct 6, 2016
  *      Author: wfg
  */
 
-#ifndef FD_H_
-#define FD_H_
+#ifndef FILEDESCRIPTOR_H_
+#define FILEDESCRIPTOR_H_
 
 
 #include "core/Transport.h"
@@ -20,14 +20,14 @@ namespace transport
 /**
  * File descriptor transport using the POSIX library
  */
-class FD : public Transport
+class FileDescriptor : public Transport
 {
 
 public:
 
-    FD( MPI_Comm mpiComm, const bool debugMode );
+    FileDescriptor( MPI_Comm mpiComm, const bool debugMode );
 
-    ~FD( );
+    ~FileDescriptor( );
 
     void Open( const std::string name, const std::string accessMode );
 
@@ -38,7 +38,8 @@ public:
 
 private:
 
-    int m_FileDescriptor = -1; ///< POSIX file descriptor
+    int m_FileDescriptor = -1; ///< file descriptor returned by POSIX open
+
 };
 
 
@@ -46,4 +47,4 @@ private:
 
 } //end namespace transport
 } //end namespace
-#endif /* FD_H_ */
+#endif /* FILEDESCRIPTOR_H_ */
diff --git a/include/transport/file/FP.h b/include/transport/file/FilePointer.h
similarity index 75%
rename from include/transport/file/FP.h
rename to include/transport/file/FilePointer.h
index 2ac134587..cbe11ef60 100644
--- a/include/transport/file/FP.h
+++ b/include/transport/file/FilePointer.h
@@ -1,12 +1,12 @@
 /*
- * File.h
+ * FilePointer.h
  *
  *  Created on: Jan 6, 2017
  *      Author: wfg
  */
 
-#ifndef FP_H_
-#define FP_H_
+#ifndef FILEPOINTER_H_
+#define FILEPOINTER_H_
 
 /// \cond EXCLUDE_FROM_DOXYGEN
 #include <stdio.h> // FILE*
@@ -23,14 +23,14 @@ namespace transport
 /**
  * Class that defines a transport method using C file pointer (FP) to streams FILE*
  */
-class FP : public Transport
+class FilePointer : public Transport
 {
 
 public:
 
-    FP( MPI_Comm mpiComm, const bool debugMode );
+    FilePointer( MPI_Comm mpiComm, const bool debugMode );
 
-    ~FP( );
+    ~FilePointer( );
 
     void Open( const std::string name, const std::string accessMode );
 
@@ -56,4 +56,4 @@ private:
 
 
 
-#endif /* FP_H_ */
+#endif /* FILEPOINTER_H_ */
diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp
index fbcd99ded..09d24d3ea 100644
--- a/src/core/Engine.cpp
+++ b/src/core/Engine.cpp
@@ -109,11 +109,9 @@ VariableCompound* Engine::InquireVariableCompound( const std::string name, const
 void Engine::Init( )
 { }
 
-
-void Engine::InitCapsules( )
+void Engine::InitParameters( )
 { }
 
-
 void Engine::InitTransports( )
 { }
 
diff --git a/src/core/Transport.cpp b/src/core/Transport.cpp
index 1b5cec286..81095c229 100644
--- a/src/core/Transport.cpp
+++ b/src/core/Transport.cpp
@@ -37,5 +37,26 @@ void Transport::Close( )
 { }
 
 
+void Transport::InitProfiler( const Support::Resolutions resolution )
+{
+    m_Profiler.m_Timers.emplace_back( "open", Support::Resolutions::mus );
+
+    if( m_AccessMode == "w" || m_AccessMode == "write" )
+        m_Profiler.m_Timers.emplace_back( "write", resolution );
+
+    else if( m_AccessMode == "a" || m_AccessMode == "append" )
+        m_Profiler.m_Timers.emplace_back( "append", resolution );
+
+    else if( m_AccessMode == "r" || m_AccessMode == "read" )
+        m_Profiler.m_Timers.emplace_back( "read", resolution );
+
+    m_Profiler.m_Timers.emplace_back( "close", Support::Resolutions::mus );
+
+    m_Profiler.m_TotalBytes.push_back( 0 );
+    m_Profiler.m_IsActive = true;
+}
+
+
+
 } //end namespace
 
diff --git a/src/engine/bp/BPFileReader.cpp b/src/engine/bp/BPFileReader.cpp
index 6ae61f522..c7cda0efa 100644
--- a/src/engine/bp/BPFileReader.cpp
+++ b/src/engine/bp/BPFileReader.cpp
@@ -9,12 +9,12 @@
 
 #include "engine/bp/BPFileReader.h"
 
+#include "transport/file/FileDescriptor.h" // uses POSIX
+#include "transport/file/FilePointer.h" // uses C FILE*
 #include "core/Support.h"
 #include "functions/adiosFunctions.h" //CSVToVector
 
 //supported transports
-#include "transport/file/FD.h" // uses POSIX
-#include "transport/file/FP.h" // uses C FILE*
 #include "transport/file/FStream.h" // uses C++ fstream
 
 
@@ -134,13 +134,13 @@ void BPFileReader::InitTransports( ) //maybe move this?
             auto itLibrary = parameters.find( "library" );
             if( itLibrary == parameters.end() || itLibrary->second == "POSIX" ) //use default POSIX
             {
-                auto file = std::make_shared<transport::FD>( m_MPIComm, m_DebugMode );
+                auto file = std::make_shared<transport::FileDescriptor>( m_MPIComm, m_DebugMode );
                 //m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
                 m_Transports.push_back( std::move( file ) );
             }
             else if( itLibrary->second == "FILE*" || itLibrary->second == "stdio.h" )
             {
-                auto file = std::make_shared<transport::FP>( m_MPIComm, m_DebugMode );
+                auto file = std::make_shared<transport::FilePointer>( m_MPIComm, m_DebugMode );
                 //m_BP1Reader.OpenRankFiles( m_Name, m_AccessMode, *file );
                 m_Transports.push_back( std::move( file ) );
 
diff --git a/src/engine/bp/BPFileWriter.cpp b/src/engine/bp/BPFileWriter.cpp
index 2cbde1306..8be5a0249 100644
--- a/src/engine/bp/BPFileWriter.cpp
+++ b/src/engine/bp/BPFileWriter.cpp
@@ -9,11 +9,10 @@
 #include "ADIOS.h"
 
 //supported transports
-#include "transport/file/FD.h"
-#include "transport/file/FP.h"
+#include "transport/file/FileDescriptor.h"
+#include "transport/file/FilePointer.h"
 #include "transport/file/FStream.h"
 
-
 namespace adios
 {
 
@@ -34,21 +33,6 @@ BPFileWriter::~BPFileWriter( )
 
 void BPFileWriter::Init( )
 {
-    auto itGrowthFactor = m_Method.m_Parameters.find( "buffer_growth" );
-    if( itGrowthFactor != m_Method.m_Parameters.end() )
-    {
-        m_GrowthFactor = std::stof( itGrowthFactor->second ); //float
-        m_BP1Writer.m_GrowthFactor = m_GrowthFactor;
-    }
-
-    auto itMaxBufferSize = m_Method.m_Parameters.find( "max_size_MB" );
-    if( itMaxBufferSize != m_Method.m_Parameters.end() )
-        m_MaxBufferSize = std::stoul( itGrowthFactor->second ) * 1000000; //convert to bytes
-
-    auto itVerbosity = m_Method.m_Parameters.find( "verbose" );
-    if( itVerbosity != m_Method.m_Parameters.end() )
-        m_BP1Writer.m_Verbosity = std::stoi( itVerbosity->second );
-
     InitTransports( );
     InitProcessGroup( );
 }
@@ -180,6 +164,74 @@ void BPFileWriter::Close( const int transportIndex )
 
 
 //PRIVATE FUNCTIONS
+void BPFileWriter::InitParameters( )
+{
+    auto itGrowthFactor = m_Method.m_Parameters.find( "buffer_growth" );
+    if( itGrowthFactor != m_Method.m_Parameters.end() )
+    {
+        const float growthFactor = std::stof( itGrowthFactor->second );
+        if( m_DebugMode == true )
+        {
+            if( growthFactor == 1.f )
+                throw std::invalid_argument( "ERROR: buffer_growth argument can't be less of equal than 1, in " + m_EndMessage + "\n" );
+        }
+
+        m_BP1Writer.m_GrowthFactor = growthFactor;
+        m_GrowthFactor = growthFactor; //float
+    }
+
+    auto itMaxBufferSize = m_Method.m_Parameters.find( "max_size_MB" );
+    if( itMaxBufferSize != m_Method.m_Parameters.end() )
+    {
+        if( m_DebugMode == true )
+        {
+            if( m_GrowthFactor <= 1.f )
+                throw std::invalid_argument( "ERROR: Method buffer_growth argument can't be less of equal than 1, in " + m_EndMessage + "\n" );
+        }
+
+        m_MaxBufferSize = std::stoul( itMaxBufferSize->second ) * 1048576; //convert to bytes
+    }
+
+    auto itVerbosity = m_Method.m_Parameters.find( "verbose" );
+    if( itVerbosity != m_Method.m_Parameters.end() )
+    {
+        int verbosity = std::stoi( itVerbosity->second );
+        if( m_DebugMode == true )
+        {
+            if( verbosity < 0 || verbosity > 5 )
+                throw std::invalid_argument( "ERROR: Method verbose argument must be an integer in the range [0,5], in call to Open or Engine constructor\n" );
+        }
+        m_BP1Writer.m_Verbosity = verbosity;
+    }
+
+    auto itProfile = m_Method.m_Parameters.find( "profile_buffering_units" );
+    if( itProfile != m_Method.m_Parameters.end() )
+    {
+        if( itProfile->second == "mus" || itProfile->second == "microseconds" )
+            m_Profiler.m_Timers.emplace_back( "Buffering", Support::Resolutions::mus );
+
+        else if( itProfile->second == "ms" || itProfile->second == "milliseconds" )
+            m_Profiler.m_Timers.emplace_back( "Buffering", Support::Resolutions::ms );
+
+        else if( itProfile->second == "s" || itProfile->second == "seconds" )
+            m_Profiler.m_Timers.emplace_back( "Buffering", Support::Resolutions::s );
+
+        else if( itProfile->second == "min" || itProfile->second == "minutes" )
+            m_Profiler.m_Timers.emplace_back( "Buffering", Support::Resolutions::m );
+
+        else if( itProfile->second == "h" || itProfile->second == "hours" )
+            m_Profiler.m_Timers.emplace_back( "Buffering", Support::Resolutions::h );
+        else
+        {
+            if( m_DebugMode == true )
+                throw std::invalid_argument( "ERROR: Method profile_buffering_units argument must be mus, ms, s, min or h, in call to Open or Engine constructor\n" );
+        }
+
+        m_Profiler.m_IsActive = true;
+    }
+}
+
+
 void BPFileWriter::InitTransports( )
 {
     if( m_DebugMode == true )
@@ -193,30 +245,66 @@ void BPFileWriter::InitTransports( )
 
     for( const auto& parameters : m_Method.m_TransportParameters )
     {
+        auto itProfile = parameters.find( "profile_units" );
+        Support::Resolutions resolution;
+        if( itProfile != parameters.end() )
+        {
+            if( itProfile->second == "mus" || itProfile->second == "microseconds" )
+                resolution = Support::Resolutions::mus;
+
+            else if( itProfile->second == "ms" || itProfile->second == "milliseconds" )
+                resolution = Support::Resolutions::ms;
+
+            else if( itProfile->second == "s" || itProfile->second == "seconds" )
+                resolution = Support::Resolutions::s;
+
+            else if( itProfile->second == "min" || itProfile->second == "minutes" )
+                resolution = Support::Resolutions::m;
+
+            else if( itProfile->second == "h" || itProfile->second == "hours" )
+                resolution = Support::Resolutions::h;
+
+            else
+            {
+                if( m_DebugMode == true )
+                    throw std::invalid_argument( "ERROR: Transport profile_units argument must be mus, ms, s, min or h " + m_EndMessage );
+            }
+        }
+
         auto itTransport = parameters.find( "transport" );
+
         if( itTransport->second == "file" || itTransport->second == "File" )
         {
             auto itLibrary = parameters.find( "library" );
             if( itLibrary == parameters.end() || itLibrary->second == "POSIX" ) //use default POSIX
             {
-                auto file = std::make_shared<transport::FD>( m_MPIComm, m_DebugMode );
+                auto file = std::make_shared<transport::FileDescriptor>( m_MPIComm, m_DebugMode );
+                if( parameters.count( "profile_units" ) == 1 )
+                    file->InitProfiler( resolution );
+
                 m_BP1Writer.OpenRankFiles( m_Name, m_AccessMode, *file );
                 m_Transports.push_back( std::move( file ) );
+
             }
-            else if( itLibrary->second == "FILE*" || itLibrary->second == "stdio.h" )
+            else if( itLibrary->second == "FILE*" || itLibrary->second == "stdio" )
             {
-                auto file = std::make_shared<transport::FP>( m_MPIComm, m_DebugMode );
+                auto file = std::make_shared<transport::FilePointer>( m_MPIComm, m_DebugMode );
+                if( parameters.count( "profile_units" ) == 1 )
+                    file->InitProfiler( resolution );
+
                 m_BP1Writer.OpenRankFiles( m_Name, m_AccessMode, *file );
                 m_Transports.push_back( std::move( file ) );
-
             }
             else if( itLibrary->second == "fstream" || itLibrary->second == "std::fstream" )
             {
                 auto file = std::make_shared<transport::FStream>( m_MPIComm, m_DebugMode );
+                if( parameters.count( "profile_units" ) == 1 )
+                    file->InitProfiler( resolution );
+
                 m_BP1Writer.OpenRankFiles( m_Name, m_AccessMode, *file );
                 m_Transports.push_back( std::move( file ) );
             }
-            else if( itLibrary->second == "MPI-IO" )
+            else if( itLibrary->second == "MPI_File" || itLibrary->second == "MPI-IO" )
             {
 
             }
diff --git a/src/engine/dataman/DataManReader.cpp b/src/engine/dataman/DataManReader.cpp
index 2704088d6..4c9569be5 100644
--- a/src/engine/dataman/DataManReader.cpp
+++ b/src/engine/dataman/DataManReader.cpp
@@ -12,12 +12,12 @@
 #include "functions/adiosFunctions.h" //CSVToVector
 
 //supported transports
-#include "transport/file/FD.h" // uses POSIX
-#include "transport/file/FP.h" // uses C FILE*
 #include "transport/file/FStream.h" // uses C++ fstream
 #include "transport/wan/MdtmMan.h" //uses Mdtm library
 
 #include "DataMan.h"  //here comes your DataMan header from external dataman library
+#include "../../../include/transport/file/FileDescriptor.h" // uses POSIX
+#include "../../../include/transport/file/FilePointer.h" // uses C FILE*
 
 namespace adios
 {
diff --git a/src/engine/dataman/DataManWriter.cpp b/src/engine/dataman/DataManWriter.cpp
index 7f06b75c7..1c83e9858 100644
--- a/src/engine/dataman/DataManWriter.cpp
+++ b/src/engine/dataman/DataManWriter.cpp
@@ -13,8 +13,6 @@
 #include "functions/adiosFunctions.h" //CSVToVector
 
 //supported transports
-#include "transport/file/FD.h" // uses POSIX
-#include "transport/file/FP.h" // uses C FILE*
 #include "transport/file/FStream.h" // uses C++ fstream
 #include "transport/wan/MdtmMan.h" //uses Mdtm library
 
diff --git a/src/format/BP1Writer.cpp b/src/format/BP1Writer.cpp
index 219c1419f..287d79f7e 100644
--- a/src/format/BP1Writer.cpp
+++ b/src/format/BP1Writer.cpp
@@ -107,10 +107,6 @@ void BP1Writer::Close( BP1MetadataSet& metadataSet, capsule::STLVector& buffer,
         isFirstClose = false;
     }
     //implementing N-to-N for now, no aggregation
-//    PrintValues<double>( "myDoubles", capsule.GetData(), 155, 10  );
-//    PrintValues<float>( "myMatrix", capsule.GetData(), 391, 9  );
-//    PrintValues<float>( "myMatrix2", capsule.GetData(), 584, 9  );
-//    PrintValues<float>( "myMatrix3", capsule.GetData(), 777, 9  );
 
     transport.Write( buffer.m_Data.data(), buffer.m_DataPosition ); //single write
 
diff --git a/src/transport/file/FD.cpp b/src/transport/file/FileDescriptor.cpp
similarity index 63%
rename from src/transport/file/FD.cpp
rename to src/transport/file/FileDescriptor.cpp
index 06e3f21ea..cf90c9380 100644
--- a/src/transport/file/FD.cpp
+++ b/src/transport/file/FileDescriptor.cpp
@@ -1,5 +1,5 @@
 /*
- * FD.cpp file descriptor
+ * FileDescriptor.cpp file descriptor
  *
  *  Created on: Oct 6, 2016
  *      Author: wfg
@@ -15,7 +15,8 @@
 /// \endcond
 
 
-#include "transport/file/FD.h"
+
+#include "transport/file/FileDescriptor.h"
 
 
 namespace adios
@@ -23,12 +24,12 @@ namespace adios
 namespace transport
 {
 
-FD::FD( MPI_Comm mpiComm, const bool debugMode ):
+FileDescriptor::FileDescriptor( MPI_Comm mpiComm, const bool debugMode ):
     Transport( "FD", mpiComm, debugMode )
 { }
 
 
-FD::~FD( )
+FileDescriptor::~FileDescriptor( )
 {
     if( m_FileDescriptor != -1 )
     {
@@ -37,22 +38,41 @@ FD::~FD( )
 }
 
 
-void FD::Open( const std::string name, const std::string accessMode )
+void FileDescriptor::Open( const std::string name, const std::string accessMode )
 {
     m_Name = name;
     m_AccessMode = accessMode;
 
     if( accessMode == "w" || accessMode == "write" )
     {
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetInitialTime();
+
         m_FileDescriptor = open( m_Name.c_str(), O_WRONLY | O_CREAT, 0777 );
+
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetTime();
+
     }
     else if( accessMode == "a" || accessMode == "append" )
     {
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetInitialTime();
+
         m_FileDescriptor = open( m_Name.c_str(),  O_WRONLY | O_APPEND );
+
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetTime();
     }
     else if( accessMode == "r" || accessMode == "read" )
     {
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetInitialTime();
+
         m_FileDescriptor = open( m_Name.c_str(), O_RDONLY );
+
+        if( m_Profiler.m_IsActive == true )
+            m_Profiler.m_Timers[0].SetTime();
     }
 
     if( m_DebugMode == true )
@@ -64,10 +84,16 @@ void FD::Open( const std::string name, const std::string accessMode )
 }
 
 
-void FD::Write( const char* buffer, std::size_t size )
+void FileDescriptor::Write( const char* buffer, std::size_t size )
 {
+    if( m_Profiler.m_IsActive == true )
+        m_Profiler.m_Timers[1].SetInitialTime();
+
     auto writtenSize = write( m_FileDescriptor, buffer, size );
 
+    if( m_Profiler.m_IsActive == true )
+        m_Profiler.m_Timers[1].SetTime();
+
     if( m_DebugMode == true )
     {
         if( writtenSize == -1 )
@@ -83,10 +109,16 @@ void FD::Write( const char* buffer, std::size_t size )
 }
 
 
-void FD::Close( )
+void FileDescriptor::Close( )
 {
+    if( m_Profiler.m_IsActive == true )
+        m_Profiler.m_Timers[2].SetInitialTime();
+
     int status = close( m_FileDescriptor );
 
+    if( m_Profiler.m_IsActive == true )
+        m_Profiler.m_Timers[2].SetTime();
+
     if( m_DebugMode == true )
     {
         if( status == -1 )
@@ -96,5 +128,6 @@ void FD::Close( )
 }
 
 
+
 } //end namespace transport
 }//end namespace
diff --git a/src/transport/file/FP.cpp b/src/transport/file/FilePointer.cpp
similarity index 75%
rename from src/transport/file/FP.cpp
rename to src/transport/file/FilePointer.cpp
index b9f1e26d2..ce3088ebb 100644
--- a/src/transport/file/FP.cpp
+++ b/src/transport/file/FilePointer.cpp
@@ -10,7 +10,7 @@
 /// \endcond
 
 
-#include "transport/file/FP.h"
+#include "transport/file/FilePointer.h"
 
 
 namespace adios
@@ -19,19 +19,19 @@ namespace transport
 {
 
 
-FP::FP( MPI_Comm mpiComm, const bool debugMode ):
+FilePointer::FilePointer( MPI_Comm mpiComm, const bool debugMode ):
     Transport( "File", mpiComm, debugMode )
 { }
 
 
-FP::~FP( )
+FilePointer::~FilePointer( )
 {
     if( m_File != NULL )
         fclose( m_File );
 }
 
 
-void FP::Open( const std::string name, const std::string accessMode )
+void FilePointer::Open( const std::string name, const std::string accessMode )
 {
     m_Name = name;
     m_AccessMode = accessMode;
@@ -49,12 +49,12 @@ void FP::Open( const std::string name, const std::string accessMode )
     {
         if( m_File == NULL )
             throw std::ios_base::failure( "ERROR: couldn't open file " + name + ", "
-                                          "in call to Open from File transport\n" );
+                                          "in call to Open from File* transport\n" );
     }
 }
 
 
-void FP::SetBuffer( char* buffer, std::size_t size )
+void FilePointer::SetBuffer( char* buffer, std::size_t size )
 {
     int status = setvbuf( m_File, buffer, _IOFBF, size );
 
@@ -67,7 +67,7 @@ void FP::SetBuffer( char* buffer, std::size_t size )
 }
 
 
-void FP::Write( const char* buffer, std::size_t size )
+void FilePointer::Write( const char* buffer, std::size_t size )
 {
     fwrite( buffer, sizeof(char), size, m_File );
 
@@ -75,18 +75,18 @@ void FP::Write( const char* buffer, std::size_t size )
     {
         if( ferror( m_File ) )
             throw std::ios_base::failure( "ERROR: couldn't write to file " + m_Name +
-                                          ", in call to FP write\n"   );
+                                          ", in call to File* write\n"   );
     }
 }
 
 
-void FP::Flush( )
+void FilePointer::Flush( )
 {
     fflush( m_File );
 }
 
 
-void FP::Close( )
+void FilePointer::Close( )
 {
     fclose( m_File );
 }
-- 
GitLab