!404 告警清理

Merge pull request !404 from wenlong_12/master
This commit is contained in:
openharmony_ci 2023-12-19 06:14:14 +00:00 committed by Gitee
commit 2d754af177
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 903 additions and 969 deletions

View File

@ -15,7 +15,7 @@
#ifndef HIPERF_LIBREPORT_H
#define HIPERF_LIBREPORT_H
#if is_mingw
#if defined(is_mingw) && is_mingw
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __attribute__((visibility("default")))

View File

@ -14,7 +14,7 @@
*/
#ifndef NONLINUX_MINGW64FIX_H
#define NONLINUX_MINGW64FIX_H
#if is_mingw
#if defined(is_mingw) && is_mingw
// in mingw 64 _pid_t define to int64
// but in linux it always int

View File

@ -27,7 +27,7 @@
#include <linux/perf_event.h>
#include "perf_file_reader.h"
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
#include "report_protobuf_file.h"
#endif
#include "debug_logger.h"
@ -173,7 +173,7 @@ private:
std::unique_ptr<ReportJsonFile> reportJsonFile_ = nullptr;
bool protobufFormat_ = false;
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
std::unique_ptr<ReportProtobufFileWriter> protobufOutputFileWriter_ = nullptr;
void UpdateReportInfo();
#endif

View File

@ -125,14 +125,14 @@ private:
uint32_t tableSize_ = INITIAL_TABLE_SIZE;
std::unique_ptr<uint8_t[]> tableBuf_ = nullptr;
std::vector<uint32_t> usedSlots_;
uint32_t totalNodes_;
uint32_t totalNodes_ = 0;
// current available node count, include index 0
uint32_t availableNodes_;
uint32_t hashModulus_;
uint32_t availableNodes_ = 0;
uint32_t hashModulus_ = 0;
// 0 for reserved, start from 1
uint32_t availableIndex_ = 1;
// for de-conflict
uint64_t hashStep_;
uint64_t hashStep_ = 0;
uint8_t deconflictTimes_ = INIT_DECONFLICT_ALLOWED;
};

View File

@ -223,7 +223,7 @@ bool IsPath(const std::string &fileName);
bool LittleMemory();
#if is_mingw
#if defined(is_mingw) && is_mingw
const char PATH_SEPARATOR = '\\';
#else
const char PATH_SEPARATOR = '/';
@ -348,7 +348,7 @@ bool NeedAdaptSandboxPath(char *filename, int pid, u16 &headerSize);
} // namespace OHOS
// this will also used for libunwind head (out of namespace)
#if is_mingw
#if defined(is_mingw) && is_mingw
#if !is_double_framework
#define HAVE_MMAP 1
#define MAP_PRIVATE 0x02

File diff suppressed because it is too large Load Diff

View File

@ -329,7 +329,7 @@ PerfFileSectionUniStackTable::PerfFileSectionUniStackTable(FEATURE id, const cha
HLOGV("tableSize %" PRIu32 " ", stackTable.tableSize);
Read(stackTable.numNodes);
HLOGV("numNodes %" PRIu32 " ", stackTable.numNodes);
for (size_t i = 0; i < stackTable.numNodes; i++) {
for (size_t j = 0; j < stackTable.numNodes; j++) {
UniStackNode& node = stackTable.nodes.emplace_back();
Read(node.index);
Read(node.node.value);

View File

@ -235,7 +235,7 @@ ArchType SetDeviceArch(ArchType arch)
ArchType GetDeviceArch()
{
#if is_mingw
#if defined(is_mingw) && is_mingw
return deviceArchType;
#else
if (deviceArchType != ArchType::ARCH_UNKNOWN) {

View File

@ -20,7 +20,7 @@
#include <set>
#include <sstream>
#if is_mingw
#if defined(is_mingw) && is_mingw
#include <windows.h>
#else
#include <sys/ioctl.h>
@ -428,7 +428,7 @@ bool Report::OutputStdCallFrame(int indent, const std::string_view &funcName, ui
void Report::PrepareConsole()
{
#if is_mingw
#if defined(is_mingw) && is_mingw
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
consoleWidth_ = static_cast<unsigned int>(csbi.srWindow.Right - csbi.srWindow.Left + 1);

View File

@ -17,7 +17,7 @@
#include <set>
#include "report_json_file.h"
#if is_mingw
#if defined(is_mingw) && is_mingw
#include <windows.h>
#else
#include <sys/ioctl.h>

View File

@ -85,7 +85,7 @@ bool SubCommandDump::ParseOption(std::vector<std::string> &args)
if (!Option::GetOptionValue(args, "-i", dumpFileName_)) {
return false;
}
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
if (!Option::GetOptionValue(args, "--proto", protobufDumpFileName_)) {
HLOGD("get option --proto failed");
return false;
@ -143,7 +143,7 @@ bool SubCommandDump::OnSubCommand(std::vector<std::string> &args)
return DumpElfFile();
}
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
if (!protobufDumpFileName_.empty()) {
return DumpProtoFile();
}
@ -204,7 +204,7 @@ bool SubCommandDump::DumpElfFile()
}
return true;
}
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
bool SubCommandDump::DumpProtoFile()
{
printf("dump protobuf file: '%s'\n", protobufDumpFileName_.c_str());

View File

@ -20,7 +20,7 @@
#include <set>
#include <sstream>
#if is_mingw
#if defined(is_mingw) && is_mingw
#include <windows.h>
#else
#include <sys/ioctl.h>
@ -206,7 +206,7 @@ void SubCommandReport::ProcessSample(std::unique_ptr<PerfRecordSample> &sample)
sample->data_.tid, sample->data_.period,
sample->callFrames_);
} else if (protobufFormat_) {
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
// make some cook
// redesgin here
protobufOutputFileWriter_->ProcessSampleRecord(
@ -261,7 +261,7 @@ bool SubCommandReport::RecordCallBack(std::unique_ptr<PerfEventRecord> record)
ProcessSample(sample);
}
} else {
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
if (protobufFormat_) {
protobufOutputFileWriter_->ProcessRecord(*record);
}
@ -291,7 +291,7 @@ void SubCommandReport::ProcessSymbolsData()
static_cast<const PerfFileSectionSymbolsFiles *>(featureSection);
GetReport().virtualRuntime_.UpdateFromPerfData(sectionSymbolsFiles->symbolFileStructs_);
}
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
// we have load the elf
// write it to proto first
if (protobufFormat_) {
@ -428,7 +428,7 @@ void SubCommandReport::ProcessFeaturesData()
// update device arch from feature
SetDeviceArch(GetArchTypeFromUname(recordFileReader_->GetFeatureString(FEATURE::ARCH)));
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
UpdateReportInfo();
#endif
}
@ -542,7 +542,7 @@ bool SubCommandReport::OutputReport()
bool SubCommandReport::PrepareOutput()
{
if (protobufFormat_) {
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
printf("save to protobuf file: '%s'\n", reportFile_.c_str());
protobufOutputFileWriter_ = std::make_unique<ReportProtobufFileWriter>();
protobufOutputFileWriter_->Create(reportFile_);
@ -568,7 +568,7 @@ bool SubCommandReport::PrepareOutput()
SubCommandReport::~SubCommandReport()
{
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
if (protobufOutputFileWriter_ != nullptr) {
protobufOutputFileWriter_->Close();
}

View File

@ -23,7 +23,7 @@
#include <fcntl.h>
#include <fstream>
#if is_mingw
#if defined(is_mingw) && is_mingw
#include <memoryapi.h>
#else
#include <sys/mman.h>
@ -196,11 +196,9 @@ public:
const std::unordered_map<uint64_t, ElfLoadInfo> GetPtLoads() override
{
std::unordered_map<uint64_t, ElfLoadInfo> info;
if (elfFile_ == nullptr) {
return info;
return info_;
}
return elfFile_->GetPtLoads();
}
@ -280,6 +278,7 @@ private:
uint64_t ehFrameHDRFdeTableItemSize_ {0};
uint64_t ehFrameHDRFdeTableElfOffset_ {0};
std::shared_ptr<DfxElf> elfFile_;
std::unordered_map<uint64_t, ElfLoadInfo> info_;
bool GetSectionInfo(const std::string &name, uint64_t &sectionVaddr, uint64_t &sectionSize,
uint64_t &sectionFileOffset) const override

View File

@ -89,7 +89,7 @@ uint64_t UniqueStackTable::PutIpInSlot(uint64_t thisIp, uint64_t prevIdx)
node.section.prevIdx = prevIdx;
node.section.inKernel = !!(thisIp & IP_IN_KERNEL);
while (currentDeconflictTimes_--) {
Node* tableNode = (Node*)tableHead_ + curIpIdx;
Node* tableNode = reinterpret_cast<Node *>(tableHead_) + curIpIdx;
// empty case
if (tableNode->value == 0) {
@ -177,13 +177,14 @@ bool UniqueStackTable::GetIpsByStackId(StackId stackId, std::vector<u64>& ips)
uint64_t tailIdx = stackId.section.id;
Node *node = GetFrame(tailIdx);
while (node != nullptr && nr--) {
while (node != nullptr && nr > 0) {
ips.push_back(
node->section.inKernel ? (node->section.ip | KERNEL_PREFIX) : node->section.ip);
if (node->section.prevIdx == HEAD_NODE_INDEX) {
break;
}
node = GetFrame(node->section.prevIdx);
nr--;
}
return true;
}

View File

@ -225,7 +225,7 @@ bool VirtualThread::ReadRoMemory(uint64_t vaddr, uint8_t *data, size_t size) con
return false;
}
#if is_mingw
#if defined(is_mingw) && is_mingw
void VirtualThread::ParseMap()
{
// only linux support read maps in runtime

View File

@ -182,7 +182,7 @@ HWTEST_F(SubCommandDumpTest, DumpInputElfConflict, TestSize.Level1)
TestDumpCommand("perf.data --elf elffile ", false);
}
#if HAVE_PROTOBUF
#if defined(HAVE_PROTOBUF) && HAVE_PROTOBUF
HWTEST_F(SubCommandDumpTest, DumpProtofile, TestSize.Level1)
{
TestDumpCommand("--proto /data/test/resource/testdata/proto_test ");

View File

@ -25,9 +25,11 @@ using namespace OHOS::HiviewDFX;
namespace OHOS {
namespace Developtools {
namespace HiPerf {
constexpr int DEFAULT_RUN_TIMEOUT_MS = 10000;
class SubCommandReportTest : public testing::Test {
public:
const int DEFAULT_RUN_TIMEOUT_MS = 10000;
#if is_ohos
const std::string RESOURCE_PATH = "/data/test/resource/testdata/";
#else