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, ...@@ -46,14 +46,9 @@ runSpMVBenchmarks( Benchmark & benchmark,
benchmarkSpmvSynthetic< Real >( benchmark, inputFileName, verboseMR ); benchmarkSpmvSynthetic< Real >( benchmark, inputFileName, verboseMR );
} }
void // Get current date time to have different log files names and avoid overwriting.
setupConfig( Config::ConfigDescription & config ) 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 // source: https://stackoverflow.com/questions/16357999/current-date-and-time-as-string
time_t rawtime; time_t rawtime;
struct tm * timeinfo; struct tm * timeinfo;
...@@ -62,8 +57,17 @@ setupConfig( Config::ConfigDescription & config ) ...@@ -62,8 +57,17 @@ setupConfig( Config::ConfigDescription & config )
timeinfo = localtime( &rawtime ); timeinfo = localtime( &rawtime );
strftime( buffer, sizeof( buffer ), "%d-%m-%Y--%H:%M:%S", timeinfo ); strftime( buffer, sizeof( buffer ), "%d-%m-%Y--%H:%M:%S", timeinfo );
std::string curr_date_time( buffer ); 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.addEntry< String >( "output-mode", "Mode for opening the log file.", "overwrite" );
config.addEntryEnum( "append" ); config.addEntryEnum( "append" );
......
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