1 // Copyright (C) 2005, 2006 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Common Public License.
4 //
5 // $Id: IpTimingStatistics.cpp 759 2006-07-07 03:07:08Z andreasw $
6 //
7 // Authors:  Andreas Waechter          IBM    2005-09-19
8 
9 #include "IpTimingStatistics.hpp"
10 
11 namespace SimTKIpopt
12 {
13   void
ResetTimes()14   TimingStatistics::ResetTimes()
15   {
16     OverallAlgorithm_.Reset();
17     PrintProblemStatistics_.Reset();
18     InitializeIterates_.Reset();
19     UpdateHessian_.Reset();
20     OutputIteration_.Reset();
21     UpdateBarrierParameter_.Reset();
22     ComputeSearchDirection_.Reset();
23     ComputeAcceptableTrialPoint_.Reset();
24     AcceptTrialPoint_.Reset();
25     CheckConvergence_.Reset();
26     PDSystemSolverTotal_.Reset();
27     PDSystemSolverSolveOnce_.Reset();
28     ComputeResiduals_.Reset();
29     LinearSystemScaling_.Reset();
30     LinearSystemSymbolicFactorization_.Reset();
31     LinearSystemFactorization_.Reset();
32     LinearSystemBackSolve_.Reset();
33     LinearSystemStructureConverter_.Reset();
34     LinearSystemStructureConverterInit_.Reset();
35     QualityFunctionSearch_.Reset();
36     TryCorrector_.Reset();
37     Task1_.Reset();
38     Task2_.Reset();
39     Task3_.Reset();
40     Task4_.Reset();
41     Task5_.Reset();
42     Task6_.Reset();
43   }
44 
45   void
PrintAllTimingStatistics(Journalist & jnlst,EJournalLevel level,EJournalCategory category) const46   TimingStatistics::PrintAllTimingStatistics(
47     Journalist& jnlst,
48     EJournalLevel level,
49     EJournalCategory category) const
50   {
51     if (!jnlst.ProduceOutput(level, category))
52       return;
53 
54     jnlst.Printf(level, category,
55                  "OverallAlgorithm....................: %10.3f\n",
56                  OverallAlgorithm_.TotalTime());
57     jnlst.Printf(level, category,
58                  " PrintProblemStatistics.............: %10.3f\n",
59                  PrintProblemStatistics_.TotalTime());
60     jnlst.Printf(level, category,
61                  " InitializeIterates.................: %10.3f\n",
62                  InitializeIterates_.TotalTime());
63     jnlst.Printf(level, category,
64                  " UpdateHessian......................: %10.3f\n",
65                  UpdateHessian_.TotalTime());
66     jnlst.Printf(level, category,
67                  " OutputIteration....................: %10.3f\n",
68                  OutputIteration_.TotalTime());
69     jnlst.Printf(level, category,
70                  " UpdateBarrierParameter.............: %10.3f\n",
71                  UpdateBarrierParameter_.TotalTime());
72     jnlst.Printf(level, category,
73                  " ComputeSearchDirection.............: %10.3f\n",
74                  ComputeSearchDirection_.TotalTime());
75     jnlst.Printf(level, category,
76                  " ComputeAcceptableTrialPoint........: %10.3f\n",
77                  ComputeAcceptableTrialPoint_.TotalTime());
78     jnlst.Printf(level, category,
79                  " AcceptTrialPoint...................: %10.3f\n",
80                  AcceptTrialPoint_.TotalTime());
81     jnlst.Printf(level, category,
82                  " CheckConvergence...................: %10.3f\n",
83                  CheckConvergence_.TotalTime());
84 
85     jnlst.Printf(level, category,
86                  "PDSystemSolverTotal.................: %10.3f\n",
87                  PDSystemSolverTotal_.TotalTime());
88     jnlst.Printf(level, category,
89                  " PDSystemSolverSolveOnce............: %10.3f\n",
90                  PDSystemSolverSolveOnce_.TotalTime());
91     jnlst.Printf(level, category,
92                  " ComputeResiduals...................: %10.3f\n",
93                  ComputeResiduals_.TotalTime());
94     jnlst.Printf(level, category,
95                  " LinearSystemScaling................: %10.3f\n",
96                  LinearSystemScaling_.TotalTime());
97     jnlst.Printf(level, category,
98                  " LinearSystemSymbolicFactorization..: %10.3f\n",
99                  LinearSystemSymbolicFactorization_.TotalTime());
100     jnlst.Printf(level, category,
101                  " LinearSystemFactorization..........: %10.3f\n",
102                  LinearSystemFactorization_.TotalTime());
103     jnlst.Printf(level, category,
104                  " LinearSystemBackSolve..............: %10.3f\n",
105                  LinearSystemBackSolve_.TotalTime());
106     jnlst.Printf(level, category,
107                  " LinearSystemStructureConverter.....: %10.3f\n",
108                  LinearSystemStructureConverter_.TotalTime());
109     jnlst.Printf(level, category,
110                  "  LinearSystemStructureConverterInit: %10.3f\n",
111                  LinearSystemStructureConverterInit_.TotalTime());
112     jnlst.Printf(level, category,
113                  "QualityFunctionSearch...............: %10.3f\n",
114                  QualityFunctionSearch_.TotalTime());
115     jnlst.Printf(level, category,
116                  "TryCorrector........................: %10.3f\n",
117                  TryCorrector_.TotalTime());
118     jnlst.Printf(level, category,
119                  "Task1...............................: %10.3f\n",
120                  Task1_.TotalTime());
121     jnlst.Printf(level, category,
122                  "Task2...............................: %10.3f\n",
123                  Task2_.TotalTime());
124     jnlst.Printf(level, category,
125                  "Task3...............................: %10.3f\n",
126                  Task3_.TotalTime());
127     jnlst.Printf(level, category,
128                  "Task4...............................: %10.3f\n",
129                  Task4_.TotalTime());
130     jnlst.Printf(level, category,
131                  "Task5...............................: %10.3f\n",
132                  Task5_.TotalTime());
133   }
134 } // namespace Ipopt
135