Monitorize folder content controller performance in debug mode.

This commit is contained in:
Luis Ángel San Martín 2018-04-26 18:24:35 +02:00
parent 630a5c94a0
commit 87b0e64b1a

View File

@ -8,7 +8,9 @@
#include "yacreader_server_data_helper.h"
#include "qnaturalsorting.h"
#include "qnaturalsorting.h"
#include "QsLog.h"
#include <ctime>
using namespace std;
@ -39,7 +41,10 @@ void FolderContentControllerV2::service(HttpRequest& request, HttpResponse& resp
}
void FolderContentControllerV2::serviceContent(const int &library, const qulonglong &folderId, HttpResponse &response)
{
{
#ifdef QT_DEBUG
auto started = std::chrono::high_resolution_clock::now();
#endif
QList<LibraryItem *> folderContent = DBHelper::getFolderSubfoldersFromLibrary(library,folderId);
QList<LibraryItem *> folderComics = DBHelper::getFolderComicsFromLibrary(library,folderId);
@ -55,7 +60,7 @@ void FolderContentControllerV2::serviceContent(const int &library, const qulongl
for(QList<LibraryItem *>::const_iterator itr = folderContent.constBegin();itr!=folderContent.constEnd();itr++)
{
if((*itr)->isDir())
{
{
currentFolder = (Folder *)(*itr);
items.append(YACReaderServerDataHelper::folderToJSON(library, *currentFolder));
}
@ -68,5 +73,11 @@ void FolderContentControllerV2::serviceContent(const int &library, const qulongl
QJsonDocument output(items);
response.write(output.toJson());
response.write(output.toJson());
#ifdef QT_DEBUG
auto done = std::chrono::high_resolution_clock::now();
QLOG_TRACE() << "num items = " << items.count();
QLOG_TRACE() << std::chrono::duration_cast<std::chrono::milliseconds>(done-started).count();
#endif
}