Skip to content
Snippets Groups Projects
Commit bba157be authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Created function to get current date and time for log file naming. Preparation for new branch.

parent f3d817cb
No related branches found
No related tags found
1 merge request!45Matrices revision
......@@ -46,14 +46,9 @@ runSpMVBenchmarks( Benchmark & benchmark,
benchmarkSpmvSynthetic< Real >( benchmark, inputFileName, verboseMR );
}
void
setupConfig( Config::ConfigDescription & config )
// Get current date time to have different log files names and avoid overwriting.
std::string getCurrDateTime()
{
config.addDelimiter( "Benchmark settings:" );
config.addRequiredEntry< String >( "input-file", "Input file name." );
////////////////
// Get current date time to have different log files names and avoid overwriting.
// source: https://stackoverflow.com/questions/16357999/current-date-and-time-as-string
time_t rawtime;
struct tm * timeinfo;
......@@ -62,8 +57,17 @@ setupConfig( Config::ConfigDescription & config )
timeinfo = localtime( &rawtime );
strftime( buffer, sizeof( buffer ), "%d-%m-%Y--%H:%M:%S", timeinfo );
std::string curr_date_time( buffer );
////////////////
config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + curr_date_time + ".log");
return curr_date_time;
}
void
setupConfig( Config::ConfigDescription & config )
{
config.addDelimiter( "Benchmark settings:" );
config.addRequiredEntry< String >( "input-file", "Input file name." );
config.addEntry< String >( "log-file", "Log file name.", "tnl-benchmark-spmv::" + getCurrDateTime() + ".log");
config.addEntry< String >( "output-mode", "Mode for opening the log file.", "overwrite" );
config.addEntryEnum( "append" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment