Skip to content
Snippets Groups Projects
Commit 483d1b36 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Add an internal timer based on std::clock

parent bd60eab6
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment