1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +00:00

Log content files loading time by editor

This commit is contained in:
elsid 2023-02-15 20:56:32 +01:00
parent 8a6a3c7121
commit de24cdc12c
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625
2 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include <apps/opencs/model/world/data.hpp>
#include <apps/opencs/model/world/universalid.hpp>
#include <components/debug/debuglog.hpp>
#include <components/files/conversion.hpp>
#include <QTimer>
@ -56,6 +57,9 @@ void CSMDoc::Loader::load()
return;
}
if (!mStart.has_value())
mStart = std::chrono::steady_clock::now();
std::vector<std::pair<Document*, Stage>>::iterator iter = mDocuments.begin();
Document* document = iter->first;
@ -133,6 +137,14 @@ void CSMDoc::Loader::load()
if (done)
{
if (mStart.has_value())
{
const auto duration = std::chrono::steady_clock::now() - *mStart;
Log(Debug::Verbose) << "Loaded content files in "
<< std::chrono::duration_cast<std::chrono::duration<double>>(duration).count() << 's';
mStart.reset();
}
mDocuments.erase(iter);
emit documentLoaded(document);
}

View File

@ -1,6 +1,8 @@
#ifndef CSM_DOC_LOADER_H
#define CSM_DOC_LOADER_H
#include <chrono>
#include <optional>
#include <string>
#include <utility>
#include <vector>
@ -35,6 +37,8 @@ namespace CSMDoc
QTimer* mTimer;
bool mShouldStop;
std::optional<std::chrono::steady_clock::time_point> mStart;
public:
Loader();