Add print codesize for jit

Issue:     https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IB4DCL
Signed-off-by: zhixin <1757149461@qq.com>
This commit is contained in:
zhixin 2024-11-19 19:47:38 +08:00
parent fd8fd6ae20
commit d85178cd1f
3 changed files with 12 additions and 1 deletions

View File

@ -531,7 +531,7 @@ Jit::TimeScope::~TimeScope()
if (vm_->GetEnableJitLogSkip() && bundleName != "" && message_.find(bundleName) == std::string::npos) {
return;
}
LOG_JIT(INFO) << tier_ << message_ << ": " << TotalSpentTime() << "ms";
LOG_JIT(INFO) << tier_ << message_ << ", compile time: " << TotalSpentTime() << "ms";
}
}
} // namespace panda::ecmascript

View File

@ -129,6 +129,9 @@ public:
explicit TimeScope(EcmaVM *vm)
: vm_(vm), message_(""), tier_(CompilerTier::Tier::FAST), outPutLog_(false), isDebugLevel_(true) {}
PUBLIC_API ~TimeScope();
void appendMessage(const CString& value) { message_ += value; }
private:
EcmaVM *vm_;
CString message_;

View File

@ -417,6 +417,14 @@ bool JitTask::AsyncTask::Run([[maybe_unused]] uint32_t threadIndex)
if (jitTask_->IsAsyncTask()) {
jitTask_->jit_->RequestInstallCode(jitTask_);
}
MachineCodeDesc codeDesc = jitTask_->GetMachineCodeDesc();
size_t instrSize = codeDesc.codeSizeAlign + codeDesc.rodataSizeBeforeTextAlign
+ codeDesc.rodataSizeAfterTextAlign;
CString sizeInfo = ": text size: ";
sizeInfo.append(std::to_string(instrSize)).append("bytes");
scope.appendMessage(sizeInfo);
int compilerTime = scope.TotalSpentTimeInMicroseconds();
JitDfx::GetInstance()->RecordSpentTimeAndPrintStatsLogInJitThread(compilerTime, jitTask_->methodName_,
jitTask_->compilerTier_.IsBaseLine(), jitTask_->mainThreadCompileTime_);