mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
!7802 修改process的getStartRealtime实现【runtime】
Merge pull request !7802 from yuqing_han/master
This commit is contained in:
commit
9cb166a520
@ -234,7 +234,7 @@ void EcmaVM::PostFork()
|
||||
ResetPGOProfiler();
|
||||
|
||||
options_.SetEnableJitFrame(ohos::JitTools::GetJitFrameEnable());
|
||||
|
||||
processStartRealtime_ = InitializeStartRealTime();
|
||||
bool jitEscapeDisable = ohos::JitTools::GetJitEscapeDisable();
|
||||
if (jitEscapeDisable || !JSNApi::IsJitEscape()) {
|
||||
if (ohos::EnableAotListHelper::GetJitInstance()->IsEnableJit(bundleName)) {
|
||||
@ -269,6 +269,7 @@ EcmaVM::EcmaVM(JSRuntimeOptions options, EcmaParamConfiguration config)
|
||||
optionalLogEnabled_ = options_.EnableOptionalLog();
|
||||
options_.ParseAsmInterOption();
|
||||
SetEnableOsr(options_.IsEnableOSR() && options_.IsEnableJIT() && options_.GetEnableAsmInterpreter());
|
||||
processStartRealtime_ = InitializeStartRealTime();
|
||||
}
|
||||
|
||||
// for jit
|
||||
@ -1123,4 +1124,25 @@ void EcmaVM::InitializeIcuData(const JSRuntimeOptions &options)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize Process StartRealTime
|
||||
int EcmaVM::InitializeStartRealTime()
|
||||
{
|
||||
int startRealTime = 0;
|
||||
struct timespec timespro = {0, 0};
|
||||
struct timespec timessys = {0, 0};
|
||||
auto res = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ×pro);
|
||||
if (res) {
|
||||
return startRealTime;
|
||||
}
|
||||
auto res1 = clock_gettime(CLOCK_MONOTONIC, ×sys);
|
||||
if (res1) {
|
||||
return startRealTime;
|
||||
}
|
||||
|
||||
int whenpro = int(timespro.tv_sec * 1000) + int(timespro.tv_nsec / 1000000);
|
||||
int whensys = int(timessys.tv_sec * 1000) + int(timessys.tv_nsec / 1000000);
|
||||
startRealTime = (whensys - whenpro);
|
||||
return startRealTime;
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -666,6 +666,11 @@ public:
|
||||
return workerList_;
|
||||
}
|
||||
|
||||
int GetProcessStartRealtime() const
|
||||
{
|
||||
return processStartRealtime_;
|
||||
}
|
||||
|
||||
Jit *GetJit() const;
|
||||
bool PUBLIC_API IsEnableFastJit() const;
|
||||
bool PUBLIC_API IsEnableBaselineJit() const;
|
||||
@ -723,6 +728,8 @@ public:
|
||||
|
||||
static void InitializeIcuData(const JSRuntimeOptions &options);
|
||||
|
||||
static int InitializeStartRealTime();
|
||||
|
||||
std::vector<std::pair<NativePointerCallback, std::pair<void *, void *>>> &GetSharedNativePointerCallbacks()
|
||||
{
|
||||
return sharedNativePointerCallbacks_;
|
||||
@ -925,6 +932,9 @@ private:
|
||||
bool isEnableOsr_ {false};
|
||||
bool isJitCompileVM_ {false};
|
||||
|
||||
// process StartRealTime
|
||||
int processStartRealtime_ = 0;
|
||||
|
||||
#if ECMASCRIPT_ENABLE_SCOPE_LOCK_STAT
|
||||
// Stats for Thread-State-Transition and String-Table Locks
|
||||
bool isCollectingScopeLockStats_ = false;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "ecmascript/base/aligned_struct.h"
|
||||
#include "ecmascript/base/config.h"
|
||||
|
@ -1557,6 +1557,7 @@ public:
|
||||
|
||||
static bool IsJitEscape();
|
||||
static bool IsAotEscape(const std::string &pgoRealPath = "");
|
||||
static int GetStartRealTime(const EcmaVM *vm);
|
||||
private:
|
||||
static int vmCount_;
|
||||
static bool initialize_;
|
||||
|
@ -4805,6 +4805,12 @@ uintptr_t JSNApi::GetGlobalHandleAddr(const EcmaVM *vm, uintptr_t localAddress)
|
||||
return thread->NewGlobalHandle(value);
|
||||
}
|
||||
|
||||
int JSNApi::GetStartRealTime(const EcmaVM *vm)
|
||||
{
|
||||
ecmascript::ThreadManagedScope scope(vm->GetJSThread());
|
||||
return vm->GetProcessStartRealtime();
|
||||
}
|
||||
|
||||
uintptr_t JSNApi::SetWeak(const EcmaVM *vm, uintptr_t localAddress)
|
||||
{
|
||||
if (localAddress == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user