Skip to content
Snippets Groups Projects
Commit 0480ab8f authored by Lukáš Paukert's avatar Lukáš Paukert
Browse files

Added timer

parent d54ee66a
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <Wt/WPushButton.h> #include <Wt/WPushButton.h>
   
#include <fstream> #include <fstream>
#include <chrono>
   
#include "./../calculation/Query.h" #include "./../calculation/Query.h"
#include "./../calculation/Computor.h" #include "./../calculation/Computor.h"
...@@ -81,6 +82,7 @@ void Page::displayDetail(int document_id, bool useInvertedIndex) ...@@ -81,6 +82,7 @@ void Page::displayDetail(int document_id, bool useInvertedIndex)
   
std::vector<std::pair<int, double>> result; std::vector<std::pair<int, double>> result;
   
auto start = std::chrono::high_resolution_clock::now();
if (useInvertedIndex) { if (useInvertedIndex) {
// threshold je nyni nastaven na -1 --> ve vysledku budou i uplne rozdilne dokumenty // threshold je nyni nastaven na -1 --> ve vysledku budou i uplne rozdilne dokumenty
Query query(database.getTermsAndWightsByDocumentID(document_id), -1); Query query(database.getTermsAndWightsByDocumentID(document_id), -1);
...@@ -89,7 +91,10 @@ void Page::displayDetail(int document_id, bool useInvertedIndex) ...@@ -89,7 +91,10 @@ void Page::displayDetail(int document_id, bool useInvertedIndex)
else { else {
result = SequentialSearch::search(database, document_id); result = SequentialSearch::search(database, document_id);
} }
auto stop = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
   
container->addNew<Wt::WText>("<i>Query took " + std::to_string(duration.count()*0.000001) + " seconds</i>");
container->addNew<Wt::WText>("<h1>The most similar books</h1>"); container->addNew<Wt::WText>("<h1>The most similar books</h1>");
Wt::WMenu *menu = container->addNew<Wt::WMenu>(); Wt::WMenu *menu = container->addNew<Wt::WMenu>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment