Commit 483d1b36 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Add an internal timer based on std::clock

parent bd60eab6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 *
 * \brief Implementation of the calculation for a cluster of spheres.
 */
#include <chrono>
#include <cstdio>
#include <exception>
#include <fstream>
@@ -61,6 +62,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
 *  \param output_path: `string` Directory to write the output files in.
 */
void cluster(string config_file, string data_file, string output_path) {
  chrono::time_point<chrono::high_resolution_clock> t_start = chrono::high_resolution_clock::now();
  Logger *logger = new Logger(LOG_INFO);
  logger->log("INFO: making legacy configuration...", LOG_INFO);
  ScattererConfiguration *sconf = NULL;
@@ -795,6 +797,10 @@ void cluster(string config_file, string data_file, string output_path) {
  }
  delete sconf;
  delete gconf;
  chrono::time_point<chrono::high_resolution_clock> t_end = chrono::high_resolution_clock::now();
  const chrono::duration<double> elapsed = t_end - t_start;
  string message = "Calculation lasted " + to_string(elapsed.count()) + ".\n";
  logger->log(message);
  logger->log("Finished: output written to " + output_path + "/c_OCLU\n");
  delete logger;
}