mirror of
https://gitee.com/openharmony/hiviewdfx_hitrace
synced 2024-11-23 07:49:43 +00:00
fix: some misspelled words and logic errors.
Signed-off-by: yanmengzhao1 <yanmengzhao1@huawei.com>
This commit is contained in:
parent
3fc00be626
commit
3851097502
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
# Copyright (C) 2023-2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
@ -11,5 +11,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
.vscode
|
||||
target
|
||||
Cargo.lock
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2022-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -646,7 +646,7 @@ static std::string ReloadTraceArgs()
|
||||
if (g_runningState == RECORDING_SHORT_RAW || g_runningState == RECORDING_LONG_BEGIN_RECORD) {
|
||||
args += (" fileSize:" + std::to_string(g_traceArgs.fileSize));
|
||||
} else {
|
||||
ConsoleLog("warnning: The current state does not support specifying the file size, file size: " +
|
||||
ConsoleLog("warning: The current state does not support specifying the file size, file size: " +
|
||||
std::to_string(g_traceArgs.fileSize) + " is invalid.");
|
||||
}
|
||||
}
|
||||
@ -661,7 +661,7 @@ static bool HandleRecordingShortRaw()
|
||||
{
|
||||
std::string args = ReloadTraceArgs();
|
||||
if (g_traceArgs.output.size() > 0) {
|
||||
ConsoleLog("warnning: The current state does not support specifying the output file path, " +
|
||||
ConsoleLog("warning: The current state does not support specifying the output file path, " +
|
||||
g_traceArgs.output + " is invalid.");
|
||||
}
|
||||
auto openRet = g_traceCollector->OpenRecording(args);
|
||||
@ -731,7 +731,7 @@ static bool HandleRecordingLongBegin()
|
||||
{
|
||||
std::string args = ReloadTraceArgs();
|
||||
if (g_traceArgs.output.size() > 0) {
|
||||
ConsoleLog("warnning: The current state does not support specifying the output file path, " +
|
||||
ConsoleLog("warning: The current state does not support specifying the output file path, " +
|
||||
g_traceArgs.output + " is invalid.");
|
||||
}
|
||||
auto openRet = g_traceCollector->OpenRecording(args);
|
||||
@ -778,7 +778,7 @@ static bool HandleRecordingLongBeginRecord()
|
||||
{
|
||||
std::string args = ReloadTraceArgs();
|
||||
if (g_traceArgs.output.size() > 0) {
|
||||
ConsoleLog("warnning: The current state does not support specifying the output file path, " +
|
||||
ConsoleLog("warning: The current state does not support specifying the output file path, " +
|
||||
g_traceArgs.output + " is invalid.");
|
||||
}
|
||||
auto openRet = g_traceCollector->OpenRecording(args);
|
||||
@ -848,7 +848,7 @@ static bool HandleDumpSnapshot()
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
static bool HandlCloseSnapshot()
|
||||
static bool HandleCloseSnapshot()
|
||||
{
|
||||
bool isSuccess = true;
|
||||
auto closeRet = g_traceCollector->Close();
|
||||
@ -937,7 +937,7 @@ int main(int argc, char **argv)
|
||||
isSuccess = HandleDumpSnapshot();
|
||||
break;
|
||||
case SNAPSHOT_STOP:
|
||||
isSuccess = HandlCloseSnapshot();
|
||||
isSuccess = HandleCloseSnapshot();
|
||||
break;
|
||||
case SHOW_HELP:
|
||||
ShowHelp(argv[0]);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Copyright (C) 2023-2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -268,7 +268,7 @@ bool WriteStrToFile(const std::string& filename, const std::string& str)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SetFtraceEnabled(const std::string &path, bool enabled)
|
||||
void SetTraceNodeStatus(const std::string &path, bool enabled)
|
||||
{
|
||||
WriteStrToFile(path, enabled ? "1" : "0");
|
||||
}
|
||||
@ -295,6 +295,7 @@ bool SetProperty(const std::string& property, const std::string& value)
|
||||
return result;
|
||||
}
|
||||
|
||||
// close all trace node
|
||||
void TraceInit(const std::map<std::string, TagCategory> &allTags)
|
||||
{
|
||||
// close all ftrace events
|
||||
@ -303,7 +304,7 @@ void TraceInit(const std::map<std::string, TagCategory> &allTags)
|
||||
continue;
|
||||
}
|
||||
for (size_t i = 0; i < it->second.sysFiles.size(); i++) {
|
||||
SetFtraceEnabled(it->second.sysFiles[i], false);
|
||||
SetTraceNodeStatus(it->second.sysFiles[i], false);
|
||||
}
|
||||
}
|
||||
// close all user tags
|
||||
@ -313,9 +314,10 @@ void TraceInit(const std::map<std::string, TagCategory> &allTags)
|
||||
WriteStrToFile("buffer_size_kb", "1");
|
||||
|
||||
// close tracing_on
|
||||
SetFtraceEnabled("tracing_on", false);
|
||||
SetTraceNodeStatus("tracing_on", false);
|
||||
}
|
||||
|
||||
// Open specific trace node
|
||||
void SetAllTags(const TraceParams &traceParams, const std::map<std::string, TagCategory> &allTags,
|
||||
const std::map<std::string, std::vector<std::string>> &tagGroupTable)
|
||||
{
|
||||
@ -360,7 +362,7 @@ void SetAllTags(const TraceParams &traceParams, const std::map<std::string, TagC
|
||||
|
||||
if (iter->second.type == 1) {
|
||||
for (const auto& path : iter->second.sysFiles) {
|
||||
SetFtraceEnabled(path, true);
|
||||
SetTraceNodeStatus(path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1189,7 +1191,7 @@ TraceErrorCode HandleTraceOpen(const TraceParams &traceParams,
|
||||
if (!SetTraceSetting(traceParams, allTags, tagGroupTable)) {
|
||||
return TraceErrorCode::FILE_ERROR;
|
||||
}
|
||||
SetFtraceEnabled("tracing_on", true);
|
||||
SetTraceNodeStatus("tracing_on", true);
|
||||
g_currentTraceParams = traceParams;
|
||||
return TraceErrorCode::SUCCESS;
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ inline void UpdateSysParamTags()
|
||||
g_tagsProperty = (tags | HITRACE_TAG_ALWAYS) & HITRACE_TAG_VALID_MASK;
|
||||
}
|
||||
int appPidChanged = 0;
|
||||
const char *paramPid = CachedParameterGetChanged(g_appPidCachedHandle, &changed);
|
||||
if (appPidChanged == 1 && paramPid != nullptr) {
|
||||
const char *paramPid = CachedParameterGetChanged(g_appPidCachedHandle, &appPidChanged);
|
||||
if (UNEXPECTANTLY(appPidChanged == 1) && paramPid != nullptr) {
|
||||
g_appTagMatchPid = strtoll(paramPid, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user