Skip to content

Commit

Permalink
use StopWatch class to print elapsed time for parsing designs
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 committed Oct 30, 2023
1 parent cb08601 commit 6575fc9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions OdbDesignLib/FileModel/Design/FileArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "MiscInfoFile.h"
#include <iostream>
#include "Logger.h"
#include "StopWatch.h"

using namespace Utils;
using namespace std::filesystem;
Expand Down Expand Up @@ -51,9 +52,9 @@ namespace Odb::Lib::FileModel::Design
{
//try
{
if (!exists(m_filePath)) return false;
StopWatch timer(true);

auto started = std::chrono::system_clock::now();
if (!exists(m_filePath)) return false;

if (is_regular_file(m_filePath))
{
Expand All @@ -69,11 +70,9 @@ namespace Odb::Lib::FileModel::Design

if (ParseDesignDirectory(m_rootDir))
{
auto finished = std::chrono::system_clock::now();
auto elapsed = finished - started;
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed).count();
double s = ms / 1000.0;
loginfo("Successfully parsed. (" + std::to_string(s) + " ms)");
timer.stop();
auto s = timer.getElapsedSecondsString(" s");
loginfo("Successfully parsed. (" + s + ")");

return true;
}
Expand Down

0 comments on commit 6575fc9

Please sign in to comment.