mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-23 15:00:17 +00:00
commit
23b1f9b4be
@ -80,6 +80,7 @@ ohos_source_set("hiprofiler_base") {
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"init:libbegetutil",
|
||||
"ipc:ipc_core",
|
||||
"os_account:os_account_innerkits",
|
||||
"samgr:samgr_proxy",
|
||||
|
@ -46,5 +46,6 @@ std::string GetClockStr(const int32_t clockId);
|
||||
void AdaptSandboxPath(std::string& filePath, int pid);
|
||||
int32_t GetPackageUid(const std::string &name);
|
||||
bool GetCurrentUserId(int32_t &userId);
|
||||
bool IsBetaVersion();
|
||||
} // COMMON
|
||||
#endif // COMMON_H
|
@ -21,6 +21,8 @@
|
||||
#include <dirent.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <parameter.h>
|
||||
#include <parameters.h>
|
||||
#include <sstream>
|
||||
#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
@ -64,6 +66,7 @@ const int FILE_PATH_SIZE = 512;
|
||||
const int BUFFER_SIZE = 1024;
|
||||
const int INVALID_PID = -1;
|
||||
constexpr int32_t EC_INVALID_VALUE = -2;
|
||||
const std::string KEY_HIVIEW_USER_TYPE = "const.logsystem.versiontype";
|
||||
}
|
||||
|
||||
bool IsProcessRunning(int& lockFileFd)
|
||||
@ -564,4 +567,16 @@ int32_t GetPackageUid(const std::string& name)
|
||||
HILOG_INFO(LOG_CORE, "pkgname is: %s, uid is : %d", name.c_str(), uid);
|
||||
return uid;
|
||||
}
|
||||
|
||||
bool IsBetaVersion()
|
||||
{
|
||||
int ret = static_cast<int>(FindParameter(KEY_HIVIEW_USER_TYPE.c_str()));
|
||||
if (ret == -1) {
|
||||
HILOG_INFO(LOG_CORE, "user type is not exist");
|
||||
return true;
|
||||
}
|
||||
std::string userType = OHOS::system::GetParameter(KEY_HIVIEW_USER_TYPE, "");
|
||||
HILOG_INFO(LOG_CORE, "user type is:%s", userType.c_str());
|
||||
return userType == "beta";
|
||||
}
|
||||
} // namespace COMMON
|
||||
|
@ -235,6 +235,10 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
if (!COMMON::IsBetaVersion()) {
|
||||
printf("memory profiler only support in beta version\n");
|
||||
return 0;
|
||||
}
|
||||
if (argc == 2 && strcmp(argv[1], "sa") == 0) {
|
||||
if (!OHOS::Developtools::NativeDaemon::NativeMemoryProfilerSaService::StartServiceAbility()) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user