refact: optimize regular expression initialization
add profiling test. Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
		@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user