添加性能记录机制
This commit is contained in:
parent
ebdc712c62
commit
16f89a2ee7
|
@ -7,8 +7,12 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:55.5400719Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:55.5400719Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:55.8096222Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:55.8096222Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
#include "novelparser.h"
|
#include "novelparser.h"
|
||||||
#include "htmlprint.h"
|
#include "htmlprint.h"
|
||||||
|
@ -80,6 +81,8 @@ int main(int argc, char* argv[]) {
|
||||||
auto parser = std::make_shared<NovelParser>();
|
auto parser = std::make_shared<NovelParser>();
|
||||||
auto novel_accesstree = parser->parse(files);
|
auto novel_accesstree = parser->parse(files);
|
||||||
|
|
||||||
|
|
||||||
|
QTime time_stamp = QTime::currentTime();
|
||||||
printer::tools_printer tool;
|
printer::tools_printer tool;
|
||||||
tool.build_fragments(novel_accesstree);
|
tool.build_fragments(novel_accesstree);
|
||||||
tool.build_refers_network(novel_accesstree);
|
tool.build_refers_network(novel_accesstree);
|
||||||
|
@ -231,6 +234,8 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto current_stamp = QTime::currentTime();
|
||||||
|
qDebug() << QString(u8"html构建消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||||
//tnode_print(novel_accesstree, 0);
|
//tnode_print(novel_accesstree, 0);
|
||||||
qDebug() << u8"±àÒë³É¹¦£º" << QDir::current().absoluteFilePath(u8"index.html");
|
qDebug() << u8"±àÒë³É¹¦£º" << QDir::current().absoluteFilePath(u8"index.html");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <syntax_novel.h>
|
#include <syntax_novel.h>
|
||||||
#include <ast_novel.h>
|
#include <ast_novel.h>
|
||||||
#include <parse_novel.h>
|
#include <parse_novel.h>
|
||||||
|
#include <QTime>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
using namespace example_novel;
|
using namespace example_novel;
|
||||||
|
|
||||||
|
@ -25,11 +27,14 @@ std::shared_ptr<const ast_gen::ElementAccess> NovelParser::parse(const QFileInfo
|
||||||
QList<std::shared_ptr<const ast_basic::TokenNode>> forst_root;
|
QList<std::shared_ptr<const ast_basic::TokenNode>> forst_root;
|
||||||
auto lex_reader = NovalSyntax::getLexReader();
|
auto lex_reader = NovalSyntax::getLexReader();
|
||||||
|
|
||||||
|
auto time_stamp = QTime::currentTime();
|
||||||
for (auto& file : source_list) {
|
for (auto& file : source_list) {
|
||||||
auto tokens = lex_reader->extractFrom(file.canonicalFilePath());
|
auto tokens = lex_reader->extractFrom(file.canonicalFilePath());
|
||||||
auto exprs_result = std::make_shared<lib_syntax::ExprsChecker>(this->syntax_defines)->parseFrom(tokens);
|
auto exprs_result = std::make_shared<lib_syntax::ExprsChecker>(this->syntax_defines)->parseFrom(tokens);
|
||||||
forst_root.append(exprs_result);
|
forst_root.append(exprs_result);
|
||||||
}
|
}
|
||||||
|
auto current_stamp = QTime::currentTime();
|
||||||
|
qDebug() << QString(u8"词法解析+语法解析消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||||
|
|
||||||
|
|
||||||
std::function<QList<std::shared_ptr<const ast_basic::ExprNode>>(QList<std::shared_ptr<const ast_basic::TokenNode>> input)> summary =
|
std::function<QList<std::shared_ptr<const ast_basic::ExprNode>>(QList<std::shared_ptr<const ast_basic::TokenNode>> input)> summary =
|
||||||
|
@ -45,11 +50,13 @@ std::shared_ptr<const ast_gen::ElementAccess> NovelParser::parse(const QFileInfo
|
||||||
return temp;
|
return temp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
time_stamp = QTime::currentTime();
|
||||||
auto tree_visit = std::make_shared<example_novel::NovelExprsVisitor>();
|
auto tree_visit = std::make_shared<example_novel::NovelExprsVisitor>();
|
||||||
auto vinst = std::make_shared<ast_gen::ExprTreeParser>(tree_visit);
|
auto vinst = std::make_shared<ast_gen::ExprTreeParser>(tree_visit);
|
||||||
auto resultx = vinst->parse("test", summary(forst_root));
|
auto resultx = vinst->parse("test", summary(forst_root));
|
||||||
auto novel_accesstree = vinst->tidy(resultx);
|
auto novel_accesstree = vinst->tidy(resultx);
|
||||||
|
current_stamp = QTime::currentTime();
|
||||||
|
qDebug() << QString(u8"程序结构重建消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||||
|
|
||||||
return analyzer_ref->validCheckWith(novel_accesstree);
|
return analyzer_ref->validCheckWith(novel_accesstree);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,12 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:56.1755099Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:56.1755099Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:56.2760593Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:56.2760593Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -8,9 +8,14 @@ QString CheckException::message() const { return msg_store; }
|
||||||
|
|
||||||
Analyzer::Analyzer(const QList<std::shared_ptr<const CheckProvider> >& providers) : check_providers(providers) {}
|
Analyzer::Analyzer(const QList<std::shared_ptr<const CheckProvider> >& providers) : check_providers(providers) {}
|
||||||
|
|
||||||
|
#include <QTime>
|
||||||
|
#include <QDebug>
|
||||||
std::shared_ptr<const ast_gen::ElementAccess> Analyzer::validCheckWith(std::shared_ptr<const ast_gen::ElementAccess> root) const {
|
std::shared_ptr<const ast_gen::ElementAccess> Analyzer::validCheckWith(std::shared_ptr<const ast_gen::ElementAccess> root) const {
|
||||||
for (auto& v : check_providers)
|
for (auto& v : check_providers){
|
||||||
|
QTime time_stamp = QTime::currentTime();
|
||||||
v->validCheck(root);
|
v->validCheck(root);
|
||||||
|
auto current_stamp = QTime::currentTime();
|
||||||
|
qDebug() << QString(u8"校验器:%2 消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp)).arg(v->name());
|
||||||
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace lib_parse {
|
||||||
*/
|
*/
|
||||||
class CheckProvider {
|
class CheckProvider {
|
||||||
public:
|
public:
|
||||||
|
virtual QString name() const = 0;
|
||||||
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const = 0;
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <ast_novel.h>
|
#include <ast_novel.h>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
using namespace example_novel;
|
using namespace example_novel;
|
||||||
using namespace ast_basic;
|
using namespace ast_basic;
|
||||||
|
|
|
@ -12,6 +12,9 @@ namespace example_novel {
|
||||||
public:
|
public:
|
||||||
// 通过 CheckProvider 继承
|
// 通过 CheckProvider 继承
|
||||||
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
||||||
|
virtual QString name() const override {
|
||||||
|
return u8"FragmentExistsCheck";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +33,9 @@ namespace example_novel {
|
||||||
// CheckProvider interface
|
// CheckProvider interface
|
||||||
public:
|
public:
|
||||||
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
virtual void validCheck(std::shared_ptr<const ast_gen::ElementAccess> root) const override;
|
||||||
|
virtual QString name() const override {
|
||||||
|
return u8"FragmentOrdersCheck";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,8 +6,12 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:56.3290165Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:56.3290165Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:56.4329521Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:56.4329521Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -3,8 +3,12 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:55.8742215Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:55.8742215Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<QtLastBackgroundBuild>2024-06-09T14:31:56.1208490Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2024-06-09T14:31:56.1208490Z</QtLastBackgroundBuild>
|
||||||
|
<QtTouchProperty>
|
||||||
|
</QtTouchProperty>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue