00001 // Copyright (C) 2005, 2006 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // $Id: IpTimingStatistics.hpp 759 2006-07-07 03:07:08Z andreasw $ 00006 // 00007 // Authors: Andreas Waechter IBM 2005-09-19 00008 00009 #ifndef __IPTIMINGSTATISTICS_HPP__ 00010 #define __IPTIMINGSTATISTICS_HPP__ 00011 00012 #include "IpReferenced.hpp" 00013 #include "IpJournalist.hpp" 00014 #include "IpTimedTask.hpp" 00015 00016 #ifdef HAVE_CTIME 00017 # include <ctime> 00018 #else 00019 # ifdef HAVE_TIME_H 00020 # include <time.h> 00021 # else 00022 # error "don't have header file for time" 00023 # endif 00024 #endif 00025 00026 // The following lines are copied from CoinTime.hpp 00027 // We should probably make some more tests here 00028 #if defined(_MSC_VER) 00029 // Turn off compiler warning about long names 00030 # pragma warning(disable:4786) 00031 #else 00032 // MacOS-X and FreeBSD needs sys/time.h 00033 # if defined(__MACH__) || defined (__FreeBSD__) 00034 # include <sys/time.h> 00035 # endif 00036 # if !defined(__MSVCRT__) 00037 # include <sys/resource.h> 00038 # endif 00039 #endif 00040 00041 namespace Ipopt 00042 { 00045 class TimingStatistics : public ReferencedObject 00046 { 00047 public: 00051 TimingStatistics() 00052 {} 00053 00055 virtual ~TimingStatistics() 00056 {} 00058 00060 void ResetTimes(); 00061 00063 void PrintAllTimingStatistics(Journalist& jnlst, 00064 EJournalLevel level, 00065 EJournalCategory category) const; 00066 00069 TimedTask& OverallAlgorithm() 00070 { 00071 return OverallAlgorithm_; 00072 } 00073 TimedTask& PrintProblemStatistics() 00074 { 00075 return PrintProblemStatistics_; 00076 } 00077 TimedTask& InitializeIterates() 00078 { 00079 return InitializeIterates_; 00080 } 00081 TimedTask& UpdateHessian() 00082 { 00083 return UpdateHessian_; 00084 } 00085 TimedTask& OutputIteration() 00086 { 00087 return OutputIteration_; 00088 } 00089 TimedTask& UpdateBarrierParameter() 00090 { 00091 return UpdateBarrierParameter_; 00092 } 00093 TimedTask& ComputeSearchDirection() 00094 { 00095 return ComputeSearchDirection_; 00096 } 00097 TimedTask& ComputeAcceptableTrialPoint() 00098 { 00099 return ComputeAcceptableTrialPoint_; 00100 } 00101 TimedTask& AcceptTrialPoint() 00102 { 00103 return AcceptTrialPoint_; 00104 } 00105 TimedTask& CheckConvergence() 00106 { 00107 return CheckConvergence_; 00108 } 00109 00110 TimedTask& PDSystemSolverTotal() 00111 { 00112 return PDSystemSolverTotal_; 00113 } 00114 TimedTask& PDSystemSolverSolveOnce() 00115 { 00116 return PDSystemSolverSolveOnce_; 00117 } 00118 TimedTask& ComputeResiduals() 00119 { 00120 return ComputeResiduals_; 00121 } 00122 TimedTask& LinearSystemScaling() 00123 { 00124 return LinearSystemScaling_; 00125 } 00126 TimedTask& LinearSystemSymbolicFactorization() 00127 { 00128 return LinearSystemSymbolicFactorization_; 00129 } 00130 TimedTask& LinearSystemFactorization() 00131 { 00132 return LinearSystemFactorization_; 00133 } 00134 TimedTask& LinearSystemBackSolve() 00135 { 00136 return LinearSystemBackSolve_; 00137 } 00138 TimedTask& LinearSystemStructureConverter() 00139 { 00140 return LinearSystemStructureConverter_; 00141 } 00142 TimedTask& LinearSystemStructureConverterInit() 00143 { 00144 return LinearSystemStructureConverterInit_; 00145 } 00146 TimedTask& QualityFunctionSearch() 00147 { 00148 return QualityFunctionSearch_; 00149 } 00150 TimedTask& TryCorrector() 00151 { 00152 return TryCorrector_; 00153 } 00154 00155 TimedTask& Task1() 00156 { 00157 return Task1_; 00158 } 00159 TimedTask& Task2() 00160 { 00161 return Task2_; 00162 } 00163 TimedTask& Task3() 00164 { 00165 return Task3_; 00166 } 00167 TimedTask& Task4() 00168 { 00169 return Task4_; 00170 } 00171 TimedTask& Task5() 00172 { 00173 return Task5_; 00174 } 00175 TimedTask& Task6() 00176 { 00177 return Task6_; 00178 } 00180 00181 private: 00191 TimingStatistics(const TimingStatistics&); 00192 00194 void operator=(const TimingStatistics&); 00196 00199 TimedTask OverallAlgorithm_; 00200 TimedTask PrintProblemStatistics_; 00201 TimedTask InitializeIterates_; 00202 TimedTask UpdateHessian_; 00203 TimedTask OutputIteration_; 00204 TimedTask UpdateBarrierParameter_; 00205 TimedTask ComputeSearchDirection_; 00206 TimedTask ComputeAcceptableTrialPoint_; 00207 TimedTask AcceptTrialPoint_; 00208 TimedTask CheckConvergence_; 00209 00210 TimedTask PDSystemSolverTotal_; 00211 TimedTask PDSystemSolverSolveOnce_; 00212 TimedTask ComputeResiduals_; 00213 TimedTask LinearSystemScaling_; 00214 TimedTask LinearSystemSymbolicFactorization_; 00215 TimedTask LinearSystemFactorization_; 00216 TimedTask LinearSystemBackSolve_; 00217 TimedTask LinearSystemStructureConverter_; 00218 TimedTask LinearSystemStructureConverterInit_; 00219 TimedTask QualityFunctionSearch_; 00220 TimedTask TryCorrector_; 00221 00222 TimedTask Task1_; 00223 TimedTask Task2_; 00224 TimedTask Task3_; 00225 TimedTask Task4_; 00226 TimedTask Task5_; 00227 TimedTask Task6_; 00229 }; 00230 00231 } // namespace Ipopt 00232 00233 #endif