oomph::TimingHelpers Namespace Reference

Helper for recording execution time. More...

Functions

double timer ()
 returns the time in seconds after some point in past More...
 
std::string convert_secs_to_formatted_string (const double &time_in_sec)
 

Detailed Description

Helper for recording execution time.

//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

Function Documentation

◆ convert_secs_to_formatted_string()

std::string oomph::TimingHelpers::convert_secs_to_formatted_string ( const double time_in_sec)

Returns a nicely formatted string from an input time in seconds; the format depends on the size of time, e.g.: 86510 will be printed as 1d 1m:50 3710 will be printed as 1h:01:50 700 will be printed as 11m:40 59 will be printed as 59s

Returns a nicely formatted string from an input time in seconds; the format depends on the size of time, e.g.: 86510 will be printed as 1d 1m:50 3710 will be printed as 1h:01:50 700 will be printed as 11m:40 59.15 will be printed as 59.2s

1317  {
1318  std::ostringstream ss;
1319 
1320  unsigned sec_within_day = unsigned(time_in_sec) % (3600 * 24);
1321 
1322  unsigned days = unsigned(time_in_sec) / (3600 * 24);
1323  unsigned hours = sec_within_day / 3600;
1324  unsigned minutes = (sec_within_day % 3600) / 60;
1325  unsigned seconds = (sec_within_day % 3600) % 60;
1326 
1327  if (days > 0)
1328  {
1329  ss << days << "d ";
1330  }
1331 
1332  if (hours > 0)
1333  {
1334  ss << hours << "h:";
1335  ss << std::setw(2) << std::setfill('0');
1336  ss << minutes << ":";
1337  ss << seconds;
1338  }
1339  else if (minutes > 0)
1340  {
1341  ss << minutes << "m:";
1342  ss << std::setw(2) << std::setfill('0');
1343  ss << seconds;
1344  }
1345  else
1346  {
1347  double seconds_double = seconds + (time_in_sec - double(seconds));
1348  ss << std::setprecision(1) << std::fixed << seconds_double << "s";
1349  }
1350 
1351  return ss.str();
1352  }
double seconds(void)

References seconds().

Referenced by oomph::MumpsSolver::backsub(), oomph::MumpsSolver::factorise(), oomph::Problem::newton_solve(), oomph::SuperLUSolver::resolve(), oomph::MumpsSolver::resolve(), oomph::SuperLUSolver::resolve_transpose(), oomph::MumpsSolver::solve(), oomph::DenseLU::solve(), oomph::FD_LU::solve(), oomph::SuperLUSolver::solve(), and oomph::SuperLUSolver::solve_transpose().

◆ timer()

double oomph::TimingHelpers::timer ( )

returns the time in seconds after some point in past

1296  {
1297 #ifdef OOMPH_HAS_MPI
1298  if (MPI_Helpers::mpi_has_been_initialised())
1299  {
1300  return MPI_Wtime();
1301  }
1302  else
1303 #endif
1304  {
1305  time_t t = clock();
1306  return double(t) / double(CLOCKS_PER_SEC);
1307  }
1308  }
t
Definition: plotPSD.py:36

References oomph::MPI_Helpers::mpi_has_been_initialised(), and plotPSD::t.

Referenced by oomph::RefineableGmshTetMesh< ELEMENT >::adapt(), oomph::Problem::adapt(), oomph::TreeBasedRefineableMeshBase::adapt_mesh(), MovingBlockProblem< ELEMENT >::apply_boundary_conditions(), oomph::Problem::assign_eqn_numbers(), oomph::Multi_domain_functions::aux_setup_multi_domain_interaction(), oomph::MumpsSolver::backsub(), oomph::ExtrudedCubeMeshFromQuadMesh< ELEMENT >::build_mesh(), MovingBlockProblem< ELEMENT >::complete_element_build(), oomph::ComplexDampedJacobi< MATRIX >::complex_solve_helper(), oomph::ComplexGMRES< MATRIX >::complex_solve_helper(), oomph::CRDoubleMatrixHelpers::concatenate(), MovingBlockProblem< ELEMENT >::create_extruded_mesh(), oomph::MumpsSolver::factorise(), oomph::MGSolver< DIM >::full_setup(), oomph::HelmholtzMGPreconditioner< DIM >::full_setup(), oomph::GmshTetScaffoldMesh::GmshTetScaffoldMesh(), oomph::HypreInterface::hypre_solve(), oomph::HypreInterface::hypre_solver_setup(), main(), oomph::MGSolver< DIM >::mg_solve(), oomph::HelmholtzMGPreconditioner< DIM >::mg_solve(), oomph::Problem::newton_solve(), oomph::Mesh::node_update(), oomph::Problem::p_adapt(), oomph::TreeBasedRefineableMeshBase::p_adapt_mesh(), oomph::Problem::p_refine_uniformly_aux(), oomph::BlockDiagonalPreconditioner< MATRIX >::preconditioner_solve(), oomph::HyprePreconditioner::preconditioner_solve(), oomph::TrilinosPreconditionerBase::preconditioner_solve(), oomph::PressureBasedSolidLSCPreconditioner::preconditioner_solve(), oomph::GMRESBlockPreconditioner::preconditioner_solve(), oomph::ProjectionProblem< PROJECTABLE_ELEMENT >::project(), oomph::VorticitySmoother< ELEMENT >::recover_vorticity(), oomph::Problem::refine_uniformly_aux(), oomph::SuperLUSolver::resolve(), oomph::MumpsSolver::resolve(), oomph::TrilinosAztecOOSolver::resolve(), oomph::SuperLUSolver::resolve_transpose(), oomph::MGSolver< DIM >::self_test(), BoussinesqPreconditioner::setup(), oomph::BlockDiagonalPreconditioner< MATRIX >::setup(), oomph::BlockTriangularPreconditioner< MATRIX >::setup(), oomph::FSIPreconditioner::setup(), oomph::PressureBasedSolidLSCPreconditioner::setup(), oomph::ExactDGPBlockPreconditioner< MATRIX >::setup(), oomph::BandedBlockTriangularPreconditioner< MATRIX >::setup(), oomph::SpaceTimeNavierStokesSubsidiaryPreconditioner::setup(), oomph::GMRESBlockPreconditioner::setup(), oomph::MatrixVectorProduct::setup(), oomph::Preconditioner::setup(), oomph::LineVisualiser::setup(), oomph::HelmholtzMGPreconditioner< DIM >::setup_coarsest_level_structures(), oomph::MGSolver< DIM >::setup_mg_hierarchy(), oomph::HelmholtzMGPreconditioner< DIM >::setup_mg_hierarchy(), oomph::MGSolver< DIM >::setup_mg_structures(), oomph::HelmholtzMGPreconditioner< DIM >::setup_mg_structures(), oomph::MGSolver< DIM >::setup_smoothers(), oomph::HelmholtzMGPreconditioner< DIM >::setup_smoothers(), oomph::StefanBoltzmannHelper::setup_stefan_boltzmann_visibility(), oomph::MGSolver< DIM >::setup_transfer_matrices(), oomph::HelmholtzMGPreconditioner< DIM >::setup_transfer_matrices(), oomph::TrilinosMLPreconditioner::setup_trilinos_preconditioner(), oomph::SimpleCubicTetMesh< ELEMENT >::SimpleCubicTetMesh(), oomph::MyProblem::smart_time_step(), oomph::MumpsSolver::solve(), oomph::CG< MATRIX >::solve(), oomph::BiCGStab< MATRIX >::solve(), oomph::GS< MATRIX >::solve(), oomph::GS< CRDoubleMatrix >::solve(), oomph::DampedJacobi< MATRIX >::solve(), oomph::GMRES< MATRIX >::solve(), oomph::AugmentedProblemGMRES::solve(), oomph::DenseLU::solve(), oomph::SuperLUSolver::solve(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), oomph::HelmholtzFGMRESMG< MATRIX >::solve(), oomph::HypreSolver::solve(), oomph::TrilinosAztecOOSolver::solve(), oomph::CG< MATRIX >::solve_helper(), oomph::BiCGStab< MATRIX >::solve_helper(), oomph::GS< MATRIX >::solve_helper(), oomph::GS< CRDoubleMatrix >::solve_helper(), oomph::DampedJacobi< MATRIX >::solve_helper(), oomph::GMRES< MATRIX >::solve_helper(), oomph::AugmentedProblemGMRES::solve_helper(), oomph::HelmholtzGMRESMG< MATRIX >::solve_helper(), oomph::HelmholtzFGMRESMG< MATRIX >::solve_helper(), oomph::SuperLUSolver::solve_transpose(), oomph::TrilinosAztecOOSolver::solver_setup(), oomph::Problem::sparse_assemble_row_or_column_compressed_with_lists(), oomph::Problem::sparse_assemble_row_or_column_compressed_with_maps(), oomph::Problem::sparse_assemble_row_or_column_compressed_with_two_arrays(), oomph::Problem::sparse_assemble_row_or_column_compressed_with_two_vectors(), oomph::Problem::sparse_assemble_row_or_column_compressed_with_vectors_of_pairs(), and oomph::GMRES< MATRIX >::update().