fix: 1.删去dump trace返回OUT_OF_TIME错误时的产生的trace文件,并添加pagetracetime和traceendtime的打印

Signed-off-by: jiangwei <jiangwei214@h-partners.com>
This commit is contained in:
jiangwei 2024-10-08 14:27:58 +08:00
parent 5c0d84eeaa
commit 89a7f77bdb

View File

@ -589,7 +589,8 @@ bool WriteFile(uint8_t contentType, const std::string &src, int outFd, const std
if (traceEndTime < pageTraceTime) {
endFlag = true;
readBytes = 0;
HILOG_ERROR(LOG_CORE, "Current trace time is out of trace end time, stop to read trace info.");
HILOG_ERROR(LOG_CORE, "Current pageTraceTime:(%{public}" PRId64 ") is larger than traceEndTime:(%{public}" PRId64 "), stop to read trace info.",
pageTraceTime, traceEndTime);
break;
}
@ -1104,22 +1105,22 @@ TraceErrorCode DumpTraceInner(std::vector<std::string> &outputFiles)
}
if (g_dumpStatus) {
remove(reOutPath.c_str());
return static_cast<TraceErrorCode>(g_dumpStatus.load());
}
if (access(reOutPath.c_str(), F_OK) == 0) {
HILOG_INFO(LOG_CORE, "Output: %{public}s.", reOutPath.c_str());
struct timeval now = {0, 0};
gettimeofday(&now, nullptr);
int nowSec = now.tv_sec;
SearchFromTable(outputFiles, nowSec);
outputFiles.push_back(outputFileName);
g_traceFilesTable.push_back({outputFileName, nowSec});
} else {
if (access(reOutPath.c_str(), F_OK) != 0) {
HILOG_ERROR(LOG_CORE, "DumpTraceInner: write %{public}s failed.", outputFileName.c_str());
return TraceErrorCode::WRITE_TRACE_INFO_ERROR;
}
HILOG_INFO(LOG_CORE, "Output: %{public}s.", reOutPath.c_str());
struct timeval now = {0, 0};
gettimeofday(&now, nullptr);
int nowSec = now.tv_sec;
SearchFromTable(outputFiles, nowSec);
outputFiles.push_back(outputFileName);
g_traceFilesTable.push_back({outputFileName, nowSec});
return TraceErrorCode::SUCCESS;
}
@ -1491,7 +1492,8 @@ TraceRetInfo DumpTrace(int maxDuration, uint64_t traceEndTime)
// beware of input precision of seconds: add an extra second of tolerance
g_inputTraceEndTime = (traceEndTime - static_cast<uint64_t>(boot_time) + 1) * S_TO_NS;
} else {
HILOG_ERROR(LOG_CORE, "DumpTrace: Illegal input: traceEndTime is earlier than system boot time.");
HILOG_ERROR(LOG_CORE, "DumpTrace: traceEndTime:(%{public}" PRId64 ") is earlier than boot_time:(%{public}" PRId64 ").",
traceEndTime, static_cast<uint64_t>(boot_time));
ret.errorCode = OUT_OF_TIME;
return ret;
}