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

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

parent 6f34fb4f
......@@ -91,6 +91,8 @@ public:
bool ExecuteCommand(const std::wstring& command, bool bIsSave = true)
{
LOGGER_SPEED_START
std::string commandA = U_TO_UTF8(command);
//commandA = "_api." + commandA;
......@@ -104,6 +106,8 @@ public:
v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, commandA.c_str());
v8::Local<v8::Script> script = v8::Script::Compile(source);
LOGGER_SPEED_LAP("compile_command")
if (try_catch.HasCaught())
{
std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine());
......@@ -130,11 +134,15 @@ public:
}
}
LOGGER_SPEED_LAP("run_command")
return true;
}
bool OpenFile(const std::wstring& path, const std::string& sString)
{
LOGGER_SPEED_START
v8::Context::Scope context_scope(m_context);
v8::TryCatch try_catch;
......@@ -142,6 +150,8 @@ public:
v8::Local<v8::String> source = v8::String::NewFromUtf8(m_isolate, sString.c_str());
v8::Local<v8::Script> script = v8::Script::Compile(source);
LOGGER_SPEED_LAP("compile")
if (try_catch.HasCaught())
{
std::wstring strCode = to_cstring(try_catch.Message()->GetSourceLine());
......@@ -167,6 +177,7 @@ public:
return false;
}
}
LOGGER_SPEED_LAP("run")
CNativeControl* pNative = NULL;
bool bIsBreak = false;
......@@ -261,6 +272,8 @@ public:
if (!bIsBreak)
bIsBreak = !this->ExecuteCommand(L"_api.asc_SetSilentMode(true);", false);
LOGGER_SPEED_LAP("open")
return !bIsBreak;
}
};
......@@ -528,6 +541,8 @@ namespace NSDoctRenderer
bool OpenFile(const std::wstring& path, const std::wstring& params)
{
LOGGER_SPEED_START
CheckFileDir();
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
......@@ -672,6 +687,8 @@ namespace NSDoctRenderer
NSFile::CFileBinary::Remove(sTempFileForParams);
LOGGER_SPEED_LAP("open_convert")
if (0 == nReturnCode)
return true;
......@@ -702,6 +719,8 @@ namespace NSDoctRenderer
return false;
}
LOGGER_SPEED_START
NSStringUtils::CStringBuilder oBuilder;
oBuilder.WriteString(L"<?xml version=\"1.0\" encoding=\"utf-8\"?><TaskQueueDataConvert><m_sFileFrom>");
......@@ -842,6 +861,8 @@ namespace NSDoctRenderer
NSFile::CFileBinary::Remove(sTempFileForParams);
LOGGER_SPEED_LAP("save_convert")
if (0 == nReturnCode)
return true;
......
......@@ -871,6 +871,12 @@ public:
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
//////////////////////////////////////////////////////////////////////////////
......
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