refact: optimize regular expression initialization

add profiling test.

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe
2023-08-21 18:38:27 +08:00
committed by Comix
parent 06ee5e5899
commit 2bdb9e99ee
6 changed files with 50 additions and 7 deletions

View File

@ -8,6 +8,10 @@
#include <QDir>
#include "dbus/applicationmanager1service.h"
#include "cgroupsidentifier.h"
#include <chrono>
#include <iostream>
Q_LOGGING_CATEGORY(DDEAMProf, "dde.am.prof", QtInfoMsg)
namespace {
void registerComplexDbusType()
@ -21,6 +25,7 @@ void registerComplexDbusType()
int main(int argc, char *argv[])
{
auto start = std::chrono::high_resolution_clock::now();
QCoreApplication app{argc, argv};
auto &bus = ApplicationManager1DBus::instance();
@ -43,6 +48,12 @@ int main(int argc, char *argv[])
AMService.addApplication(std::move(ret).value());
return false; // means to apply this function to the rest of the files
});
return QCoreApplication::exec();
auto end = std::chrono::high_resolution_clock::now();
qCInfo(DDEAMProf) << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms";
return
#ifdef PROFILING_MODE
QCoreApplication::exec();
#else
0;
#endif
}