Revert hidebug 678

Signed-off-by: zhang-cui11 <zhangcui11@huawei.com>
This commit is contained in:
zhang-cui11 2023-02-15 14:29:19 +08:00
parent 8cfe3c7ca8
commit 6799c301e7
2 changed files with 5 additions and 5 deletions

View File

@ -44,7 +44,7 @@ constexpr int ONE_VALUE_LIMIT = 1;
constexpr int ARRAY_INDEX_FIRST = 0;
const std::string SLASH_STR = "/";
const std::string DEFAULT_FILENAME = "undefined";
const std::string CPUPROFILE_FILE = ".cpuprofile";
const std::string JSON_FILE = ".json";
const std::string HEAPSNAPSHOT_FILE = ".heapsnapshot";
enum ErrorCode {
PERMISSION_ERROR = 201,
@ -245,7 +245,7 @@ napi_value StartProfiling(napi_env env, napi_callback_info info)
if (filesDir.empty()) {
return CreateErrorMessage(env, "Get App files dir failed.");
}
std::string filePath = filesDir + SLASH_STR + fileName + CPUPROFILE_FILE;
std::string filePath = filesDir + SLASH_STR + fileName + JSON_FILE;
if (!IsLegalPath(filePath)) {
return CreateErrorMessage(env, "input fileName is illegal.");
}
@ -274,7 +274,7 @@ napi_value StartJsCpuProfiling(napi_env env, napi_callback_info info)
if (filesDir.empty()) {
return CreateErrorMessage(env, "Get App files dir failed.");
}
std::string filePath = filesDir + SLASH_STR + fileName + CPUPROFILE_FILE;
std::string filePath = filesDir + SLASH_STR + fileName + JSON_FILE;
if (!IsLegalPath(filePath)) {
return CreateErrorMessage(env, "input fileName is illegal.");
}

View File

@ -74,7 +74,7 @@ describe("HidebugJsTest", function () {
}
hidebug.stopProfiling();
const pid = process.pid;
let path = "/proc/" + pid + "/root/data/storage/el2/base/files/" + filename + ".cpuprofile";
let path = "/proc/" + pid + "/root/data/storage/el2/base/files/" + filename + ".json";
let data = fileio.readTextSync(path);
if (data.includes("napi")) {
expect(true).assertTrue();
@ -104,7 +104,7 @@ describe("HidebugJsTest", function () {
}
hidebug.stopJsCpuProfiling();
const pid = process.pid;
let path = "/proc/" + pid + "/root/data/storage/el2/base/files/" + filename + ".cpuprofile";
let path = "/proc/" + pid + "/root/data/storage/el2/base/files/" + filename + ".json";
let data = fileio.readTextSync(path);
if (data.includes("napi")) {
expect(true).assertTrue();