89 if ( m_TimeProbe.GetNumberOfStarts() > 0 )
93 m_Durations.push_back(
DurationForIndex(m_CurrentIndex, m_TimeProbe.GetTotal(), m_CurrentDescription));
95 if ( ! m_OutputFileName.empty() )
97 this->WriteLineToFile(*(m_Durations.end()-1));
101 m_TimeProbe = itk::TimeProbe();
106 std::ofstream filestream(m_OutputFileName.c_str());
107 if ( filestream.is_open() )
109 for ( DurationsVector::iterator it = m_Durations.begin();
110 it != m_Durations.end(); ++it )
112 filestream << it->index <<
";" << it->duration <<
";" << it->description << std::endl;
118 std::string filename = m_OutputFileName;
119 m_OutputFileName.clear();
120 mitkThrow() <<
"Cannot open file '" << filename <<
"' for writing.";
144 std::ifstream filestream(filename.c_str());
145 if (! filestream.is_open() )
147 mitkThrow() <<
"Cannot open file '" << filename <<
"' for reading.";
151 while ( std::getline(filestream, line) )
153 size_t position = line.find(
";");
156 if ( position == std::string::npos )
158 mitkThrow() <<
"File \"" <<
"\" contains invalid line (no ';' found).";
162 std::stringstream streamIndex(line.substr(0, position));
164 streamIndex >> index;
166 line = line.substr(position+1);
167 position = line.find(
";");
170 if ( position == std::string::npos )
172 mitkThrow() <<
"File \"" <<
"\" contains invalid line (no ';' found).";
176 std::stringstream streamDuration(line.substr(0, position+1));
178 streamDuration >> duration;
181 std::string description = line.substr(position+1);