mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-23 06:50:12 +00:00
清理告警
Signed-off-by:wenlong12 <wenlong12@huawei.com> Signed-off-by: wenlong12 <wenlong12@huawei.com>
This commit is contained in:
parent
0f0651a985
commit
d5d36b16b5
@ -269,7 +269,7 @@ bool CheckDestroySession(std::unique_ptr<IProfilerService::Stub>& profilerStub,
|
||||
}
|
||||
|
||||
void StartKeepAliveThread(std::unique_ptr<IProfilerService::Stub> &profilerStub,
|
||||
uint32_t &id, std::atomic<bool> &sendHeart)
|
||||
uint32_t &id, std::atomic<bool> &sendHeart)
|
||||
{
|
||||
while (sendHeart.load()) {
|
||||
KeepSessionRequest keepRequest;
|
||||
@ -495,7 +495,6 @@ bool ParseConfig(const std::string& configFile, std::string& config)
|
||||
|
||||
void SignalHandler(int signal)
|
||||
{
|
||||
printf("hiprofiler_cmd receive signal(%d)!\n", signal);
|
||||
if (signal == SIGINT) {
|
||||
g_exitProcessFlag = true;
|
||||
g_sessionCv.notify_one();
|
||||
|
@ -64,8 +64,8 @@ void BufferWriter::Report() const
|
||||
void BufferWriter::DoStats(long bytes)
|
||||
{
|
||||
++writeCount_;
|
||||
bytesCount_ += bytes;
|
||||
bytesPending_ += bytes;
|
||||
bytesCount_ += static_cast<uint64_t>(bytes);
|
||||
bytesPending_ += static_cast<uint64_t>(bytes);
|
||||
}
|
||||
|
||||
long BufferWriter::Write(const void* data, size_t size)
|
||||
|
@ -72,8 +72,8 @@ int DiskioDataPlugin::ReportOptimize(RandomWriteCtx* randomWrite)
|
||||
ioEntry_->PutPluginStatsData(*statsData);
|
||||
}
|
||||
|
||||
size_t msgSize = dataProto.Finish();
|
||||
return (int)msgSize;
|
||||
int32_t msgSize = dataProto.Finish();
|
||||
return static_cast<int>(msgSize);
|
||||
}
|
||||
|
||||
int DiskioDataPlugin::Report(uint8_t* data, uint32_t dataSize)
|
||||
|
@ -185,7 +185,7 @@ bool FlowController::ParseBasicData()
|
||||
if (!ReportClockTimes(traceResult)) {
|
||||
HILOG_ERROR(LOG_CORE, "report clock times FAILED!");
|
||||
}
|
||||
size_t msgSize = traceResult->Finish();
|
||||
int32_t msgSize = traceResult->Finish();
|
||||
resultWriter_->finishReport(resultWriter_, msgSize);
|
||||
tansporter_->Report(msgSize);
|
||||
}
|
||||
@ -204,7 +204,7 @@ bool FlowController::ParseBasicData()
|
||||
if (!ParseKernelSymbols(traceResult)) {
|
||||
HILOG_ERROR(LOG_CORE, "parse kernel symbols FAILED!");
|
||||
}
|
||||
size_t msgSize = traceResult->Finish();
|
||||
int32_t msgSize = traceResult->Finish();
|
||||
resultWriter_->finishReport(resultWriter_, msgSize);
|
||||
tansporter_->Report(msgSize);
|
||||
}
|
||||
@ -222,7 +222,7 @@ bool FlowController::ParseBasicData()
|
||||
if (!ParsePerCpuStatus(traceResult, TRACE_START)) {
|
||||
HILOG_ERROR(LOG_CORE, "parse TRACE_START stats failed!");
|
||||
}
|
||||
size_t msgSize = traceResult->Finish();
|
||||
int32_t msgSize = traceResult->Finish();
|
||||
resultWriter_->finishReport(resultWriter_, msgSize);
|
||||
tansporter_->Report(msgSize);
|
||||
}
|
||||
@ -410,7 +410,7 @@ bool FlowController::ParseEventData(int cpuid, uint8_t* page)
|
||||
if (!ParseFtraceEvent(&traceResult, cpuid, page, event)) {
|
||||
HILOG_ERROR(LOG_CORE, "parse raw event for cpu-%d failed!", cpuid);
|
||||
}
|
||||
size_t msgSize = traceResult.Finish();
|
||||
int32_t msgSize = traceResult.Finish();
|
||||
resultWriter_->finishReport(resultWriter_, msgSize);
|
||||
tansporter_->Report(msgSize);
|
||||
}
|
||||
@ -478,7 +478,7 @@ int FlowController::StopCapture(void)
|
||||
if (!ParsePerCpuStatus(traceResult, TRACE_END)) {
|
||||
HILOG_ERROR(LOG_CORE, "parse TRACE_END stats FAILED!");
|
||||
}
|
||||
size_t msgSize = traceResult->Finish();
|
||||
int32_t msgSize = traceResult->Finish();
|
||||
resultWriter_->finishReport(resultWriter_, msgSize);
|
||||
tansporter_->Report(msgSize);
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ int TracePluginRegisterWriter(const WriterStruct* writer)
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
g_mainController = std::make_unique<FTRACE_NS::FlowController>();
|
||||
|
||||
HILOG_INFO(LOG_CORE, "%s: %d %p", __func__, __LINE__, writer);
|
||||
int result = g_mainController->SetWriter(const_cast<WriterStructPtr>(writer));
|
||||
HILOG_INFO(LOG_CORE, "%s: %d", __func__, __LINE__);
|
||||
return result;
|
||||
|
@ -607,7 +607,7 @@ bool FtraceParser::ReadInc(uint8_t* start[], uint8_t end[], void* outData, size_
|
||||
return false;
|
||||
}
|
||||
CHECK_TRUE(memcpy_s(outData, outSize, *start, outSize) == EOK, false,
|
||||
"read %zu bytes from memory region [%p, %p) FAILED", outSize, *start, end);
|
||||
"read %zu bytes from memory region FAILED", outSize);
|
||||
*start += outSize;
|
||||
return true;
|
||||
}
|
||||
|
@ -312,12 +312,11 @@ int CallStack::AccessReg([[maybe_unused]] unw_addr_space_t as, unw_regnum_t regn
|
||||
if (unwindInfoPtr->callStack.regsNum_ == 0) {
|
||||
return -UNW_EUNSPEC;
|
||||
}
|
||||
UNWIND_CHECK_TRUE(RegisterGetValue(val, unwindInfoPtr->callStack.regs_, perfRegIndex,
|
||||
unwindInfoPtr->callStack.regsNum_), -UNW_EUNSPEC,
|
||||
"can't read reg %zu", perfRegIndex);
|
||||
UNWIND_CHECK_TRUE(
|
||||
RegisterGetValue(val, unwindInfoPtr->callStack.regs_, perfRegIndex, unwindInfoPtr->callStack.regsNum_),
|
||||
-UNW_EUNSPEC, "can't read reg %zu", perfRegIndex);
|
||||
*valuePoint = (unw_word_t)val;
|
||||
HLOGV("reg %d:%s, val 0x%" UNW_WORD_PFLAG "", regnum, RegisterGetName(perfRegIndex).c_str(),
|
||||
*valuePoint);
|
||||
HLOGV("reg %d:%s, val 0x%" UNW_WORD_PFLAG "", regnum, RegisterGetName(perfRegIndex).c_str(), *valuePoint);
|
||||
return UNW_ESUCCESS;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,12 @@ constexpr static uint32_t FUNCTION_MAP_LOG_PRINT = 100;
|
||||
constexpr static uint32_t FILE_MAP_LOG_PRINT = 10;
|
||||
constexpr static uint32_t MAX_BATCH_CNT = 5;
|
||||
constexpr static uint32_t LONG_TIME_THRESHOLD = 1000000;
|
||||
constexpr static uint32_t RIGHT_MOVE_1 = 1;
|
||||
constexpr static uint32_t RIGHT_MOVE_2 = 2;
|
||||
constexpr static uint32_t RIGHT_MOVE_4 = 4;
|
||||
constexpr static uint32_t RIGHT_MOVE_8 = 8;
|
||||
constexpr static uint32_t RIGHT_MOVE_16 = 16;
|
||||
constexpr static uint32_t RIGHT_MOVE_32 = 32;
|
||||
|
||||
using namespace OHOS::Developtools::NativeDaemon;
|
||||
|
||||
@ -891,31 +897,31 @@ bool StackPreprocess::GetMemTag(uint32_t tagId, std::string& tagName)
|
||||
|
||||
unsigned StackPreprocess::LgFloor(unsigned long val)
|
||||
{
|
||||
val |= (val >> 1);
|
||||
val |= (val >> 2);
|
||||
val |= (val >> 4);
|
||||
val |= (val >> 8);
|
||||
val |= (val >> 16);
|
||||
val |= (val >> RIGHT_MOVE_1);
|
||||
val |= (val >> RIGHT_MOVE_2);
|
||||
val |= (val >> RIGHT_MOVE_4);
|
||||
val |= (val >> RIGHT_MOVE_8);
|
||||
val |= (val >> RIGHT_MOVE_16);
|
||||
if (sizeof(val) > 4) {
|
||||
int constant = sizeof(val) * 4;
|
||||
val |= (val >> constant);
|
||||
}
|
||||
val++;
|
||||
if (val == 0) {
|
||||
return 8 * sizeof(val) - 1;
|
||||
return 8 * sizeof(val) - 1; // 8: 8byte
|
||||
}
|
||||
return __builtin_ffsl(val) - 2;
|
||||
return __builtin_ffsl(val) - 2; // 2:
|
||||
}
|
||||
|
||||
uint64_t StackPreprocess::PowCeil(uint64_t val)
|
||||
{
|
||||
++val;
|
||||
val |= val >> 1;
|
||||
val |= val >> 2;
|
||||
val |= val >> 4;
|
||||
val |= val >> 8;
|
||||
val |= val >> 16;
|
||||
val |= val >> 32;
|
||||
val |= val >> RIGHT_MOVE_1;
|
||||
val |= val >> RIGHT_MOVE_2;
|
||||
val |= val >> RIGHT_MOVE_4;
|
||||
val |= val >> RIGHT_MOVE_8;
|
||||
val |= val >> RIGHT_MOVE_16;
|
||||
val |= val >> RIGHT_MOVE_32;
|
||||
++val;
|
||||
return val;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
}
|
||||
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + tagSize + SIZE_FIXED32);
|
||||
size_ += tagSize + SIZE_FIXED32;
|
||||
size_ += static_cast<int32_t>(tagSize + SIZE_FIXED32);
|
||||
}
|
||||
|
||||
// ID Name Used For
|
||||
@ -170,7 +170,7 @@ public:
|
||||
}
|
||||
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + tagSize + SIZE_FIXED64);
|
||||
size_ += tagSize + SIZE_FIXED64;
|
||||
size_ += static_cast<int32_t>(tagSize + SIZE_FIXED64);
|
||||
}
|
||||
|
||||
// ID Name Used For(unsigned and 'intN' varint)
|
||||
@ -197,7 +197,7 @@ public:
|
||||
uint32_t fieldSize = EncodeVarint(fieldMemory, (fieldId << FIELDID_SHIFT) | ProtoMessageType::VARINT);
|
||||
fieldSize += EncodeVarint(fieldMemory + fieldSize, v);
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + fieldSize);
|
||||
size_ += fieldSize;
|
||||
size_ += static_cast<int32_t>(fieldSize);
|
||||
}
|
||||
|
||||
// ID Name Used For('sintN' varint, ZigZag encode)
|
||||
@ -224,7 +224,7 @@ public:
|
||||
uint32_t fieldSize = EncodeVarint(fieldMemory, (fieldId << FIELDID_SHIFT) | ProtoMessageType::VARINT);
|
||||
fieldSize += EncodeZigZagVarint(fieldMemory + fieldSize, v);
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + fieldSize);
|
||||
size_ += fieldSize;
|
||||
size_ += static_cast<int32_t>(fieldSize);
|
||||
}
|
||||
|
||||
// ID Name Used For
|
||||
@ -271,7 +271,7 @@ public:
|
||||
|
||||
uint32_t tagSize = EncodeVarint(fieldMemory, (fieldId << FIELDID_SHIFT) | ProtoMessageType::LEN);
|
||||
backfillOffset_ += tagSize;
|
||||
size_ += tagSize;
|
||||
size_ += static_cast<int32_t>(tagSize);
|
||||
// reserve length space
|
||||
writeCtx_->seek(writeCtx_, backfillOffset_ + SIZE_RESERVED_LEN);
|
||||
if (!AllocateSubMessage()) {
|
||||
@ -322,7 +322,7 @@ public:
|
||||
}
|
||||
// varint(Length)
|
||||
EncodeVarintPadding(fieldMemory + tagSize, dataSize, lenSize);
|
||||
size_ += tagSize + lenSize + dataSize;
|
||||
size_ += static_cast<int32_t>(tagSize + lenSize + dataSize);
|
||||
// seek to tail
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + tagSize + lenSize + dataSize);
|
||||
}
|
||||
@ -361,7 +361,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
size_ += tagSize + dataSize;
|
||||
size_ += static_cast<int32_t>(tagSize + dataSize);
|
||||
// seek to tail
|
||||
writeCtx_->seek(writeCtx_, fieldOffset + tagSize + dataSize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user