Index: /XIOS/dev/branch_yushan_merged/make_xios
===================================================================
--- /XIOS/dev/branch_yushan_merged/make_xios	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/make_xios	(revision 1157)
@@ -47,8 +47,8 @@
          "--job")   job=$2              ; shift ; shift ;;
          "--netcdf_lib")   netcdf_lib=$2 ; shift ; shift ;;
-         "--memtrack")   use_memtrack="true" ; shift ;;
-         *)         code="$1"           ; shift ;;
-      esac
-   done
+         "--memtrack")  use_memtrack="true" memtrack=$2  ; shift ; shift ;;
+          *)         code="$1"           ; shift ;;
+       esac
+    done
 
 # Installation des sources
@@ -172,6 +172,16 @@
 if [[ "$use_memtrack" == "true" ]]
    then
-   XIOS_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XIOS_LIB"
    XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK"
+   if [[ "$memtrack" == "light" ]]
+    then
+ 	XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_LIGHT"
+    elif [[ "$memtrack" == "FULL"  ]]
+    then
+      XIOS_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XIOS_LIB"
+      XIOS_CPPKEY="$XIOS_CPPKEY XIOS_MEMTRACK_FULL"
+    else
+	echo "Bad choice for --memtrack argument : choose between 'light','full'"
+	exit
+    fi
 fi 
 
Index: /XIOS/dev/branch_yushan_merged/src/client.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/client.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/client.cpp	(revision 1157)
@@ -292,5 +292,5 @@
          report(0)<< "     Memory report : increasing it by a factor will increase performance, depending of the volume of data wrote in file at each time step of the file"<<endl ;
          report(100)<<CTimer::getAllCumulatedTime()<<endl ;
-      }      
+       }      
 */
    }
Index: /XIOS/dev/branch_yushan_merged/src/cxios.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/cxios.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/cxios.cpp	(revision 1157)
@@ -163,6 +163,14 @@
        delete globalRegistry ;
      }
-
 #ifdef XIOS_MEMTRACK
+
+#ifdef XIOS_MEMTRACK_LIGHT
+       #pragma omp critical (_output)
+       report(10) << " Memory report : current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
+       #pragma omp critical (_output)
+       report(10) << " Memory report : maximum memory used by XIOS : "<<  MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
+#endif
+
+#ifdef XIOS_MEMTRACK_FULL
 
 #ifdef XIOS_MEMTRACK_LIGHT
@@ -239,12 +247,12 @@
     CServer::finalize();
 
+    CServer::finalize();
 #ifdef XIOS_MEMTRACK
 
 #ifdef XIOS_MEMTRACK_LIGHT
        #pragma omp critical (_output)
-       {
-         report(10) << " Memory report : current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
-         report(10) << " Memory report : maximum memory used by XIOS : "<<  MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
-       }
+       report(10) << " Memory report : current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
+       #pragma omp critical (_output)
+       report(10) << " Memory report : maximum memory used by XIOS : "<<  MemTrack::getMaxMemorySize()*1.0/(1024*1024)<<" Mbyte" << endl ;
 #endif
 
@@ -253,5 +261,6 @@
      MemTrack::TrackDumpBlocks();
 #endif
-#endif
+
+#endif 
     CServer::closeInfoStream();
   }
Index: /XIOS/dev/branch_yushan_merged/src/io/nc4_data_output.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/io/nc4_data_output.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/io/nc4_data_output.cpp	(revision 1157)
@@ -1833,5 +1833,4 @@
 
          singleDomain = (file->nbDomains == 1);
-
          StdString conv_str ;
          if (file->convention_str.isEmpty())
@@ -1841,5 +1840,6 @@
          }
          else conv_str=file->convention_str ;
-           
+
+
          try
          {
@@ -2274,5 +2274,4 @@
                 }
 
-
                 CTimer::get("Files : writing data").resume();
                 SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1, &start, &count);
Index: /XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/io/onetcdf4.cpp	(revision 1157)
@@ -57,6 +57,5 @@
             CTimer::get("Files : create").resume();
             if (wmpi)
-               //CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp);           
-               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp);           
+               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL_STD, this->ncidp);
             else
                CNetCdfInterface::create(filename, mode, this->ncidp);
Index: /XIOS/dev/branch_yushan_merged/src/io/onetcdf4_impl.hpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/io/onetcdf4_impl.hpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/io/onetcdf4_impl.hpp	(revision 1157)
@@ -4,5 +4,5 @@
 #include "onetcdf4.hpp"
 #include "netCdfInterface.hpp"
-
+#include "timer.hpp"
 // mpi_std.hpp
 
@@ -60,5 +60,4 @@
     this->getWriteDataInfos(name, record, array_size,  sstart, scount, start, count);
     CTimer::get("CONetCDF4::writeData getWriteDataInfos").suspend();
- 
     if (data.numElements()*stringArrayLen != array_size)
     {
Index: /XIOS/dev/branch_yushan_merged/src/node/context.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/node/context.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/node/context.cpp	(revision 1157)
@@ -16,5 +16,4 @@
 #include "timer.hpp"
 #include "memtrack.hpp"
-
 
 namespace xios {
@@ -1212,7 +1211,9 @@
    {
       calendar->update(step);
-      #ifdef XIOS_MEMTRACK_LIGHT
+#ifdef XIOS_MEMTRACK_LIGHT
+      #pragma omp critical (_output)
       info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ;
 #endif
+
       if (hasClient)
       {
Index: /XIOS/dev/branch_yushan_merged/src/node/field.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/node/field.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/node/field.cpp	(revision 1157)
@@ -125,5 +125,5 @@
   void CField::sendUpdateData(const CArray<double,1>& data)
   {
-    CTimer::get("Field : send data").resume();
+    CTimer::get("XIOS send data").resume();
 
     CContext* context = CContext::getCurrent();
@@ -177,5 +177,5 @@
     }
 
-    CTimer::get("Field : send data").suspend();
+    CTimer::get("XIOS send data").suspend();
   }
 
Index: /XIOS/dev/branch_yushan_merged/src/timer.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/timer.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/timer.cpp	(revision 1157)
@@ -6,4 +6,6 @@
 #include <sstream>
 #include "tracer.hpp"
+#include <iostream>
+#include <sstream>
 
 namespace xios
@@ -61,5 +63,5 @@
     // return it->second;
 
-    if(allTimer_ptr == NULL) allTimer_ptr = new std::map<std::string,CTimer>;
+    if(allTimer_ptr == 0) allTimer_ptr = new std::map<std::string,CTimer>;
 
     std::map<std::string,CTimer>::iterator it = (*allTimer_ptr).find(name);
@@ -71,8 +73,11 @@
   string CTimer::getAllCumulatedTime(void)
   {
+    if(allTimer_ptr == 0) allTimer_ptr = new std::map<std::string,CTimer>;
+
     std::ostringstream strOut ;
-    for(std::map<std::string,CTimer>::iterator it=allTimer.begin();it!=allTimer.end();++it)
+    for(std::map<std::string,CTimer>::iterator it=(*allTimer_ptr).begin();it!=(*allTimer_ptr).end();++it)
       strOut<<"Timer : "<<it->first<<"    -->   cumulated time : "<<it->second.getCumulatedTime()<<std::endl ;
     return strOut.str() ;
   }
+
 }
Index: /XIOS/dev/branch_yushan_merged/src/transformation/Functions/average_reduction.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/transformation/Functions/average_reduction.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/transformation/Functions/average_reduction.cpp	(revision 1157)
@@ -40,4 +40,5 @@
     int currentlocalIndex = 0;
     double currentWeight  = 0.0;    
+
 
     for (int idx = 0; idx < nbLocalIndex; ++idx)
Index: /XIOS/dev/branch_yushan_merged/src/transformation/Functions/max_reduction.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/transformation/Functions/max_reduction.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/transformation/Functions/max_reduction.cpp	(revision 1157)
@@ -36,5 +36,6 @@
   {
     int nbLocalIndex = localIndex.size();
-    int currentlocalIndex = 0;    
+    int currentlocalIndex = 0;
+
     for (int idx = 0; idx < nbLocalIndex; ++idx)
     {
Index: /XIOS/dev/branch_yushan_merged/src/transformation/Functions/min_reduction.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/transformation/Functions/min_reduction.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/transformation/Functions/min_reduction.cpp	(revision 1157)
@@ -36,5 +36,6 @@
   {
     int nbLocalIndex = localIndex.size();
-    int currentlocalIndex = 0;    
+    int currentlocalIndex = 0;
+
     for (int idx = 0; idx < nbLocalIndex; ++idx)
     {
Index: /XIOS/dev/branch_yushan_merged/src/transformation/Functions/sum_reduction.cpp
===================================================================
--- /XIOS/dev/branch_yushan_merged/src/transformation/Functions/sum_reduction.cpp	(revision 1156)
+++ /XIOS/dev/branch_yushan_merged/src/transformation/Functions/sum_reduction.cpp	(revision 1157)
@@ -36,5 +36,5 @@
   {
     int nbLocalIndex = localIndex.size();
-    int currentlocalIndex = 0;    
+    int currentlocalIndex = 0;
   
     for (int idx = 0; idx < nbLocalIndex; ++idx)
