!10283 add print codesize for jit

Merge pull request !10283 from 志新/sizeprint
This commit is contained in:
openharmony_ci 2024-11-22 00:40:20 +00:00 committed by Gitee
commit 6781ca7293
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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_);