Browse Source

resource statistic comp. in SemSegTools

Sven Sickert 9 years ago
parent
commit
66191da10a
2 changed files with 22 additions and 0 deletions
  1. 14 0
      semseg/SemSegTools.cpp
  2. 8 0
      semseg/SemSegTools.h

+ 14 - 0
semseg/SemSegTools.cpp

@@ -176,6 +176,20 @@ void SemSegTools::computeClassificationStatistics(
     std::cout << std::endl;
 }
 
+void SemSegTools::computeResourceStatistics (
+        NICE::ResourceStatistics &rs )
+{
+    std::cout << "\nSTATISTICS" << std::endl;
+    std::cout << "##########\n" << std::endl;
+
+    long maxMemory;
+    double userCPUTime, sysCPUTime;
+    rs.getStatistics ( maxMemory, userCPUTime, sysCPUTime );
+    std::cout << "Memory (max):    " << maxMemory << " KB" << std::endl;
+    std::cout << "CPU Time (user): " << userCPUTime << " seconds" << std::endl;
+    std::cout << "CPU Time (sys):  " << sysCPUTime << " seconds" << std::endl;
+}
+
 void SemSegTools::saveResultsToImageFile(
         const Config *conf,
         const string &section,

+ 8 - 0
semseg/SemSegTools.h

@@ -9,6 +9,7 @@
 #define SEMSEGTOOLSINCLUDE
 
 #include "core/basics/Config.h"
+#include "core/basics/ResourceStatistics.h"
 #include "vislearning/cbaselib/MultiDataset.h"
 #include "vislearning/cbaselib/Example.h"
 #include "vislearning/cbaselib/CachedExample.h"
@@ -64,6 +65,13 @@ class SemSegTools
             const std::set<int> & forbiddenClasses,
             std::map<int,int> & classMappingInv );
 
+    /**
+     * @brief compute some resource statistics
+     * @param rs resource statistics object
+     */
+    static void computeResourceStatistics (
+            NICE::ResourceStatistics & rs );
+
     /**
      * @brief save results to image file
      * @param conf Config file