Commit 5da00173 authored by Oleg Korshul's avatar Oleg Korshul Committed by Alexander Trofimov

добавлена возможность логгировать скорость работы билдера

parent 6f34fb4f
...@@ -91,6 +91,8 @@ public: ...@@ -91,6 +91,8 @@ public:
bool ExecuteCommand(const std::wstring& command, bool bIsSave = true) bool ExecuteCommand(const std::wstring& command, bool bIsSave = true)
{ {
LOGGER_SPEED_START
std::string commandA = U_TO_UTF8(command); std::string commandA = U_TO_UTF8(command);
//commandA = "_api." + commandA; //commandA = "_api." + commandA;
...@@ -104,6 +106,8 @@ public: ...@@ -104,6 +106,8 @@ public:
v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, commandA.c_str()); v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, commandA.c_str());
v8::Local<v8::Script> script = v8::Script::Compile(source); v8::Local<v8::Script> script = v8::Script::Compile(source);
LOGGER_SPEED_LAP("compile_command")
if (try_catch.HasCaught()) if (try_catch.HasCaught())
{ {
std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine()); std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine());
...@@ -130,11 +134,15 @@ public: ...@@ -130,11 +134,15 @@ public:
} }
} }
LOGGER_SPEED_LAP("run_command")
return true; return true;
} }
bool OpenFile(const std::wstring& path, const std::string& sString) bool OpenFile(const std::wstring& path, const std::string& sString)
{ {
LOGGER_SPEED_START
v8::Context::Scope context_scope(m_context); v8::Context::Scope context_scope(m_context);
v8::TryCatch try_catch; v8::TryCatch try_catch;
...@@ -142,6 +150,8 @@ public: ...@@ -142,6 +150,8 @@ public:
v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, sString.c_str()); v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, sString.c_str());
v8::Local<v8::Script> script = v8::Script::Compile(source); v8::Local<v8::Script> script = v8::Script::Compile(source);
LOGGER_SPEED_LAP("compile")
if (try_catch.HasCaught()) if (try_catch.HasCaught())
{ {
std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine()); std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine());
...@@ -167,6 +177,7 @@ public: ...@@ -167,6 +177,7 @@ public:
return false; return false;
} }
} }
LOGGER_SPEED_LAP("run")
CNativeControl* pNative = NULL; CNativeControl* pNative = NULL;
bool bIsBreak = false; bool bIsBreak = false;
...@@ -261,6 +272,8 @@ public: ...@@ -261,6 +272,8 @@ public:
if (!bIsBreak) if (!bIsBreak)
bIsBreak = !this->ExecuteCommand(L"_api.asc_SetSilentMode(true);", false); bIsBreak = !this->ExecuteCommand(L"_api.asc_SetSilentMode(true);", false);
LOGGER_SPEED_LAP("open")
return !bIsBreak; return !bIsBreak;
} }
}; };
...@@ -528,6 +541,8 @@ namespace NSDoctRenderer ...@@ -528,6 +541,8 @@ namespace NSDoctRenderer
bool OpenFile(const std::wstring& path, const std::wstring& params) bool OpenFile(const std::wstring& path, const std::wstring& params)
{ {
LOGGER_SPEED_START
CheckFileDir(); CheckFileDir();
NSDirectory::CreateDirectory(m_sFileDir + L"/changes"); NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
...@@ -672,6 +687,8 @@ namespace NSDoctRenderer ...@@ -672,6 +687,8 @@ namespace NSDoctRenderer
NSFile::CFileBinary::Remove(sTempFileForParams); NSFile::CFileBinary::Remove(sTempFileForParams);
LOGGER_SPEED_LAP("open_convert")
if (0 == nReturnCode) if (0 == nReturnCode)
return true; return true;
...@@ -702,6 +719,8 @@ namespace NSDoctRenderer ...@@ -702,6 +719,8 @@ namespace NSDoctRenderer
return false; return false;
} }
LOGGER_SPEED_START
NSStringUtils::CStringBuilder oBuilder; NSStringUtils::CStringBuilder oBuilder;
oBuilder.WriteString(L"<?xml version=\"1.0\" encoding=\"utf-8\"?><TaskQueueDataConvert><m_sFileFrom>"); oBuilder.WriteString(L"<?xml version=\"1.0\" encoding=\"utf-8\"?><TaskQueueDataConvert><m_sFileFrom>");
...@@ -842,6 +861,8 @@ namespace NSDoctRenderer ...@@ -842,6 +861,8 @@ namespace NSDoctRenderer
NSFile::CFileBinary::Remove(sTempFileForParams); NSFile::CFileBinary::Remove(sTempFileForParams);
LOGGER_SPEED_LAP("save_convert")
if (0 == nReturnCode) if (0 == nReturnCode)
return true; return true;
......
...@@ -871,6 +871,12 @@ public: ...@@ -871,6 +871,12 @@ public:
m_dwTime = dwCur; m_dwTime = dwCur;
} }
}; };
#define LOGGER_SPEED_START CLoggerSpeed __logger_speed;
#define LOGGER_SPEED_LAP(__logger_param) __logger_speed.Lap(#__logger_param);
#else
#define LOGGER_SPEED_START
#define LOGGER_SPEED_LAP(__logger_param)
#endif #endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment