mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-23 07:29:42 +00:00
fix codecheck issues
Signed-off-by: wenlong12 <wenlong12@huawei.com> Signed-off-by: wenlong12 <wwx1097114@DESKTOP-2021EGU.localdomain>
This commit is contained in:
parent
5b495d2c87
commit
e356db195a
1
LICENSE
1
LICENSE
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
|
0
README_zh.md
Executable file → Normal file
0
README_zh.md
Executable file → Normal file
0
demo/cpp/hiperf_example_cmd.cpp
Executable file → Normal file
0
demo/cpp/hiperf_example_cmd.cpp
Executable file → Normal file
0
demo/cpp/hiperf_malloc_demo.cpp
Executable file → Normal file
0
demo/cpp/hiperf_malloc_demo.cpp
Executable file → Normal file
0
demo/js/entry/package.json
Executable file → Normal file
0
demo/js/entry/package.json
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/app.js
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/app.js
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/i18n/en-US.json
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/i18n/en-US.json
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/i18n/zh-CN.json
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/i18n/zh-CN.json
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.css
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.css
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.hml
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.hml
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.js
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/index/index.js
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.css
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.css
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.hml
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.hml
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.js
Executable file → Normal file
0
demo/js/entry/src/main/js/MainAbility/pages/second/second.js
Executable file → Normal file
0
demo/js/package.json
Executable file → Normal file
0
demo/js/package.json
Executable file → Normal file
2
include/callstack.h
Executable file → Normal file
2
include/callstack.h
Executable file → Normal file
@ -136,4 +136,4 @@ struct UnwindInfo {
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_CALLSTACK_H
|
||||||
|
2
include/command.h
Executable file → Normal file
2
include/command.h
Executable file → Normal file
@ -29,4 +29,4 @@ public:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_COMMAND_H
|
||||||
|
2
include/debug_logger.h
Executable file → Normal file
2
include/debug_logger.h
Executable file → Normal file
@ -329,7 +329,7 @@ private:
|
|||||||
|
|
||||||
class ScopeDebugLevel {
|
class ScopeDebugLevel {
|
||||||
public:
|
public:
|
||||||
ScopeDebugLevel(DebugLevel level, bool mix = false) {};
|
ScopeDebugLevel(DebugLevel level, bool mix = false) {}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
|
2
include/dwarf_encoding.h
Executable file → Normal file
2
include/dwarf_encoding.h
Executable file → Normal file
@ -190,4 +190,4 @@ struct eh_frame_hdr {
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // DWARF_ENCODING_H
|
||||||
|
4
include/elf_parser.h
Executable file → Normal file
4
include/elf_parser.h
Executable file → Normal file
@ -254,7 +254,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HLOGE("string not found sh_link %u st_name %d, mmap_ is %p", sh_link, st_name, mmap_);
|
HLOGE("string not found sh_link %u st_name %d", sh_link, st_name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,4 +307,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // ELF_PARSER_H_
|
||||||
|
2
include/hashlist.h
Executable file → Normal file
2
include/hashlist.h
Executable file → Normal file
@ -222,4 +222,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_HASHLIST_H
|
||||||
|
0
include/hashlist.hpp
Executable file → Normal file
0
include/hashlist.hpp
Executable file → Normal file
@ -94,5 +94,4 @@ DLL_EXPORT const char *CDECL ReportGetBuildId(const char *elfPath);
|
|||||||
// return "unknown" when failed happend
|
// return "unknown" when failed happend
|
||||||
DLL_EXPORT const char *CDECL ReportGetElfArch(const char *elfPath);
|
DLL_EXPORT const char *CDECL ReportGetElfArch(const char *elfPath);
|
||||||
}
|
}
|
||||||
|
#endif // HIPERF_LIBREPORT_H
|
||||||
#endif
|
|
||||||
|
2
include/mem_map_item.h
Executable file → Normal file
2
include/mem_map_item.h
Executable file → Normal file
@ -98,4 +98,4 @@ public:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // MEMMAPITEM_H
|
||||||
|
@ -23,4 +23,4 @@ private:
|
|||||||
Noncopyable(const Noncopyable &);
|
Noncopyable(const Noncopyable &);
|
||||||
const Noncopyable &operator=(const Noncopyable &);
|
const Noncopyable &operator=(const Noncopyable &);
|
||||||
};
|
};
|
||||||
#endif
|
#endif // NONCOPYABLE_H_
|
||||||
|
2
include/option.h
Executable file → Normal file
2
include/option.h
Executable file → Normal file
@ -137,4 +137,4 @@ const std::map<std::string, std::unique_ptr<MainOption>> &GetMainOptions();
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_OPTION_H_
|
||||||
|
2
include/option_debug.h
Executable file → Normal file
2
include/option_debug.h
Executable file → Normal file
@ -27,4 +27,4 @@ void RegisterMainCommandDebug(void);
|
|||||||
}
|
}
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_OPTION_DEBUG_H
|
||||||
|
66
include/perf_event_record.h
Executable file → Normal file
66
include/perf_event_record.h
Executable file → Normal file
@ -110,7 +110,7 @@ public:
|
|||||||
|
|
||||||
PerfEventRecord(uint8_t *p, const std::string &name);
|
PerfEventRecord(uint8_t *p, const std::string &name);
|
||||||
|
|
||||||
virtual ~PerfEventRecord() {};
|
virtual ~PerfEventRecord() {}
|
||||||
|
|
||||||
virtual size_t GetSize() const
|
virtual size_t GetSize() const
|
||||||
{
|
{
|
||||||
@ -170,21 +170,21 @@ class PerfRecordMmap : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordMmapData data_;
|
PerfRecordMmapData data_;
|
||||||
|
|
||||||
PerfRecordMmap(uint8_t *p);
|
explicit PerfRecordMmap(uint8_t *p);
|
||||||
|
|
||||||
PerfRecordMmap(bool inKernel, u32 pid, u32 tid, u64 addr, u64 len, u64 pgoff,
|
PerfRecordMmap(bool inKernel, u32 pid, u32 tid, u64 addr, u64 len, u64 pgoff,
|
||||||
const std::string &filename);
|
const std::string &filename);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
virtual void DumpLog(const std::string &prefix) const override;
|
void DumpLog(const std::string &prefix) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfRecordMmap2 : public PerfEventRecord {
|
class PerfRecordMmap2 : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordMmap2Data data_;
|
PerfRecordMmap2Data data_;
|
||||||
|
|
||||||
PerfRecordMmap2(uint8_t *p);
|
explicit PerfRecordMmap2(uint8_t *p);
|
||||||
|
|
||||||
PerfRecordMmap2(bool inKernel, u32 pid, u32 tid, u64 addr, u64 len, u64 pgoff, u32 maj, u32 min,
|
PerfRecordMmap2(bool inKernel, u32 pid, u32 tid, u64 addr, u64 len, u64 pgoff, u32 maj, u32 min,
|
||||||
u64 ino, u32 prot, u32 flags, const std::string &filename);
|
u64 ino, u32 prot, u32 flags, const std::string &filename);
|
||||||
@ -192,18 +192,18 @@ public:
|
|||||||
PerfRecordMmap2(bool inKernel, u32 pid, u32 tid, const MemMapItem &item);
|
PerfRecordMmap2(bool inKernel, u32 pid, u32 tid, const MemMapItem &item);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
virtual void DumpLog(const std::string &prefix) const override;
|
void DumpLog(const std::string &prefix) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfRecordLost : public PerfEventRecord {
|
class PerfRecordLost : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordLostData data_;
|
PerfRecordLostData data_;
|
||||||
|
|
||||||
PerfRecordLost(uint8_t *p);
|
explicit PerfRecordLost(uint8_t *p);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
|
|
||||||
// only for UT
|
// only for UT
|
||||||
PerfRecordLost(bool inKernel, u64 id, u64 lost)
|
PerfRecordLost(bool inKernel, u64 id, u64 lost)
|
||||||
@ -219,12 +219,12 @@ class PerfRecordComm : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordCommData data_;
|
PerfRecordCommData data_;
|
||||||
|
|
||||||
PerfRecordComm(uint8_t *p);
|
explicit PerfRecordComm(uint8_t *p);
|
||||||
|
|
||||||
PerfRecordComm(bool inKernel, u32 pid, u32 tid, const std::string &comm);
|
PerfRecordComm(bool inKernel, u32 pid, u32 tid, const std::string &comm);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
void DumpLog(const std::string &prefix) const override;
|
void DumpLog(const std::string &prefix) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -242,8 +242,8 @@ public:
|
|||||||
// referenced input(p) in PerfRecordSample, require caller keep input(p) together
|
// referenced input(p) in PerfRecordSample, require caller keep input(p) together
|
||||||
PerfRecordSample(uint8_t *p, const perf_event_attr &attr);
|
PerfRecordSample(uint8_t *p, const perf_event_attr &attr);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent = 0) const override;
|
void DumpData(int indent = 0) const override;
|
||||||
virtual void DumpLog(const std::string &prefix) const override;
|
void DumpLog(const std::string &prefix) const override;
|
||||||
|
|
||||||
// originalSize is use for expand callstack
|
// originalSize is use for expand callstack
|
||||||
void ReplaceWithCallStack(size_t originalSize = 0);
|
void ReplaceWithCallStack(size_t originalSize = 0);
|
||||||
@ -266,10 +266,10 @@ class PerfRecordExit : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordExitData data_;
|
PerfRecordExitData data_;
|
||||||
|
|
||||||
PerfRecordExit(uint8_t *p);
|
explicit PerfRecordExit(uint8_t *p);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfRecordThrottle : public PerfEventRecord {
|
class PerfRecordThrottle : public PerfEventRecord {
|
||||||
@ -279,27 +279,27 @@ public:
|
|||||||
PerfRecordThrottle(uint8_t *p);
|
PerfRecordThrottle(uint8_t *p);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfRecordUnthrottle : public PerfEventRecord {
|
class PerfRecordUnthrottle : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordThrottleData data_;
|
PerfRecordThrottleData data_;
|
||||||
|
|
||||||
PerfRecordUnthrottle(uint8_t *p);
|
explicit PerfRecordUnthrottle(uint8_t *p);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerfRecordFork : public PerfEventRecord {
|
class PerfRecordFork : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordForkData data_;
|
PerfRecordForkData data_;
|
||||||
|
|
||||||
PerfRecordFork(uint8_t *p);
|
explicit PerfRecordFork(uint8_t *p);
|
||||||
|
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -309,9 +309,9 @@ class PerfRecordRead : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordReadData data_;
|
PerfRecordReadData data_;
|
||||||
|
|
||||||
PerfRecordRead(uint8_t *p);
|
explicit PerfRecordRead(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -337,9 +337,9 @@ class PerfRecordAux : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordAuxData data_;
|
PerfRecordAuxData data_;
|
||||||
|
|
||||||
PerfRecordAux(uint8_t *p);
|
explicit PerfRecordAux(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -357,9 +357,9 @@ class PerfRecordItraceStart : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordItraceStartData data_;
|
PerfRecordItraceStartData data_;
|
||||||
|
|
||||||
PerfRecordItraceStart(uint8_t *p);
|
explicit PerfRecordItraceStart(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -371,9 +371,9 @@ class PerfRecordLostSamples : public PerfEventRecord {
|
|||||||
public:
|
public:
|
||||||
PerfRecordLostSamplesData data_;
|
PerfRecordLostSamplesData data_;
|
||||||
|
|
||||||
PerfRecordLostSamples(uint8_t *p);
|
explicit PerfRecordLostSamples(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -385,9 +385,9 @@ public:
|
|||||||
class PerfRecordSwitch : public PerfEventRecord {
|
class PerfRecordSwitch : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordSwitchData data_;
|
PerfRecordSwitchData data_;
|
||||||
PerfRecordSwitch(uint8_t *p);
|
explicit PerfRecordSwitch(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData([[maybe_unused]] int indent) const override {};
|
void DumpData([[maybe_unused]] int indent) const override {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -411,9 +411,9 @@ public:
|
|||||||
class PerfRecordSwitchCpuWide : public PerfEventRecord {
|
class PerfRecordSwitchCpuWide : public PerfEventRecord {
|
||||||
public:
|
public:
|
||||||
PerfRecordSwitchCpuWideData data_;
|
PerfRecordSwitchCpuWideData data_;
|
||||||
PerfRecordSwitchCpuWide(uint8_t *p);
|
explicit PerfRecordSwitchCpuWide(uint8_t *p);
|
||||||
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
bool GetBinary(std::vector<uint8_t> &buf) const override;
|
||||||
virtual void DumpData(int indent) const override;
|
void DumpData(int indent) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<PerfEventRecord> GetPerfEventRecord(const int type, uint8_t *data,
|
std::unique_ptr<PerfEventRecord> GetPerfEventRecord(const int type, uint8_t *data,
|
||||||
@ -433,4 +433,4 @@ void PopFromBinary2(bool condition, uint8_t *&p, T1 &v1, T2 &v2);
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_PERF_EVENT_RECORD_H
|
||||||
|
2
include/perf_events.h
Executable file → Normal file
2
include/perf_events.h
Executable file → Normal file
@ -517,4 +517,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_PERF_EVENTS_H
|
||||||
|
6
include/perf_file_format.h
Executable file → Normal file
6
include/perf_file_format.h
Executable file → Normal file
@ -127,7 +127,7 @@ public:
|
|||||||
|
|
||||||
virtual bool GetBinary(char *buf, size_t size) = 0;
|
virtual bool GetBinary(char *buf, size_t size) = 0;
|
||||||
virtual size_t GetSize() = 0;
|
virtual size_t GetSize() = 0;
|
||||||
virtual ~PerfFileSection() {};
|
virtual ~PerfFileSection() {}
|
||||||
explicit PerfFileSection(const FEATURE featureId) : featureId_(featureId)
|
explicit PerfFileSection(const FEATURE featureId) : featureId_(featureId)
|
||||||
{
|
{
|
||||||
header.size = 0;
|
header.size = 0;
|
||||||
@ -180,7 +180,7 @@ struct SymbolStruct {
|
|||||||
uint64_t vaddr_ = 0;
|
uint64_t vaddr_ = 0;
|
||||||
uint32_t len_ = 0;
|
uint32_t len_ = 0;
|
||||||
std::string symbolName_ = EMPTY_STRING;
|
std::string symbolName_ = EMPTY_STRING;
|
||||||
SymbolStruct() {};
|
SymbolStruct() {}
|
||||||
SymbolStruct(uint64_t vaddr, uint32_t len, const std::string &symbolName)
|
SymbolStruct(uint64_t vaddr, uint32_t len, const std::string &symbolName)
|
||||||
: vaddr_(vaddr), len_(len), symbolName_(symbolName)
|
: vaddr_(vaddr), len_(len), symbolName_(symbolName)
|
||||||
{
|
{
|
||||||
@ -257,4 +257,4 @@ public:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_PERF_FILE_FORMAT_H
|
||||||
|
2
include/perf_file_reader.h
Executable file → Normal file
2
include/perf_file_reader.h
Executable file → Normal file
@ -98,4 +98,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_FILE_READER
|
||||||
|
4
include/perf_file_writer.h
Executable file → Normal file
4
include/perf_file_writer.h
Executable file → Normal file
@ -39,7 +39,7 @@ public:
|
|||||||
attrSection_.size = 0;
|
attrSection_.size = 0;
|
||||||
defaultEventAttr_.branch_sample_type = 0;
|
defaultEventAttr_.branch_sample_type = 0;
|
||||||
defaultEventAttr_.namespaces = 0;
|
defaultEventAttr_.namespaces = 0;
|
||||||
};
|
}
|
||||||
~PerfFileWriter();
|
~PerfFileWriter();
|
||||||
|
|
||||||
bool Open(const std::string &fileName, bool compressData = false);
|
bool Open(const std::string &fileName, bool compressData = false);
|
||||||
@ -89,4 +89,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_PERF_FILE_WRITER_H
|
||||||
|
2
include/perf_record_format.h
Executable file → Normal file
2
include/perf_record_format.h
Executable file → Normal file
@ -357,4 +357,4 @@ struct PerfRecordNamespacesData {
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_PERF_RECORD_FORMAT_H
|
||||||
|
2
include/register.h
Executable file → Normal file
2
include/register.h
Executable file → Normal file
@ -190,4 +190,4 @@ void UpdateRegForABI(ArchType arch, u64 registers[]);
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_REGISTER_H
|
||||||
|
4
include/report.h
Executable file → Normal file
4
include/report.h
Executable file → Normal file
@ -500,7 +500,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::vector<ReportEventConfigItem> configs_;
|
std::vector<ReportEventConfigItem> configs_;
|
||||||
virtual ~Report() {};
|
virtual ~Report() {}
|
||||||
|
|
||||||
std::map<uint64_t, size_t> configIdIndexMaps_; // index of configNames_
|
std::map<uint64_t, size_t> configIdIndexMaps_; // index of configNames_
|
||||||
std::string GetConfigName(uint64_t id)
|
std::string GetConfigName(uint64_t id)
|
||||||
@ -566,4 +566,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // REPORT_H
|
||||||
|
8
include/report_json_file.h
Executable file → Normal file
8
include/report_json_file.h
Executable file → Normal file
@ -206,7 +206,7 @@ struct ReportFuncItem {
|
|||||||
uint64_t sampleCount_ = 0;
|
uint64_t sampleCount_ = 0;
|
||||||
uint64_t eventCount_ = 0;
|
uint64_t eventCount_ = 0;
|
||||||
uint64_t subTreeEventCount_ = 0;
|
uint64_t subTreeEventCount_ = 0;
|
||||||
ReportFuncItem(int functionId) : functionId_(functionId) {}
|
explicit ReportFuncItem(int functionId) : functionId_(functionId) {}
|
||||||
void OutputJson(FILE *output) const
|
void OutputJson(FILE *output) const
|
||||||
{
|
{
|
||||||
if (fprintf(output, "{") < 0) {
|
if (fprintf(output, "{") < 0) {
|
||||||
@ -266,7 +266,7 @@ struct ReportCallNodeItem {
|
|||||||
return (a.functionId_ == functionId);
|
return (a.functionId_ == functionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportCallNodeItem(int functionId) : functionId_(functionId) {}
|
explicit ReportCallNodeItem(int functionId) : functionId_(functionId) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ReportLibItem {
|
struct ReportLibItem {
|
||||||
@ -328,7 +328,7 @@ struct ReportProcessItem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ReportProcessItem(pid_t pid) : pid_(pid) {}
|
explicit ReportProcessItem(pid_t pid) : pid_(pid) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ReportConfigItem {
|
struct ReportConfigItem {
|
||||||
@ -415,4 +415,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // REPORT_JSON_FILE_H
|
||||||
|
2
include/report_protobuf_file.h
Executable file → Normal file
2
include/report_protobuf_file.h
Executable file → Normal file
@ -97,4 +97,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_REPORT_PROTOBUF_FILE
|
||||||
|
4
include/ring_buffer.h
Executable file → Normal file
4
include/ring_buffer.h
Executable file → Normal file
@ -25,7 +25,7 @@ public:
|
|||||||
// little endian, perf_event_header.type is less than 0xff, so set it
|
// little endian, perf_event_header.type is less than 0xff, so set it
|
||||||
static constexpr uint8_t MARGIN_BYTE = 0xFF;
|
static constexpr uint8_t MARGIN_BYTE = 0xFF;
|
||||||
|
|
||||||
RingBuffer(size_t size);
|
explicit RingBuffer(size_t size);
|
||||||
~RingBuffer();
|
~RingBuffer();
|
||||||
// get size of the writable space
|
// get size of the writable space
|
||||||
size_t GetFreeSize() const;
|
size_t GetFreeSize() const;
|
||||||
@ -50,4 +50,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_RING_BUFFER_H
|
||||||
|
4
include/subcommand.h
Executable file → Normal file
4
include/subcommand.h
Executable file → Normal file
@ -57,7 +57,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void DumpOptions() const {};
|
virtual void DumpOptions() const {}
|
||||||
|
|
||||||
// args should be empty after all the args processed
|
// args should be empty after all the args processed
|
||||||
virtual bool ParseOption(std::vector<std::string> &args)
|
virtual bool ParseOption(std::vector<std::string> &args)
|
||||||
@ -95,4 +95,4 @@ protected:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_SUBCOMMAND_H_
|
||||||
|
@ -116,4 +116,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // SUBCOMMAND_DUMP_H
|
||||||
|
@ -42,4 +42,4 @@ public:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_SUBCOMMAND_HELP_H_
|
||||||
|
@ -64,4 +64,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // SUBCOMMAND_LIST_H_
|
||||||
|
@ -290,4 +290,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // SUBCOMMAND_RECORD_H
|
||||||
|
@ -188,4 +188,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // SUBCOMMAND_REPORT_H
|
||||||
|
@ -118,4 +118,4 @@ bool RegisterSubCommandStat(void);
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // SUBCOMMAND_STAT_H_
|
||||||
|
10
include/symbols_file.h
Executable file → Normal file
10
include/symbols_file.h
Executable file → Normal file
@ -82,19 +82,19 @@ struct Symbol {
|
|||||||
len_(len),
|
len_(len),
|
||||||
name_(MemoryHold::Get().HoldStringView(name)),
|
name_(MemoryHold::Get().HoldStringView(name)),
|
||||||
demangle_(MemoryHold::Get().HoldStringView(demangle)),
|
demangle_(MemoryHold::Get().HoldStringView(demangle)),
|
||||||
module_(MemoryHold::Get().HoldStringView(module)) {};
|
module_(MemoryHold::Get().HoldStringView(module)) {}
|
||||||
Symbol(uint64_t vaddr, uint64_t len, const std::string &name, const std::string &module)
|
Symbol(uint64_t vaddr, uint64_t len, const std::string &name, const std::string &module)
|
||||||
: Symbol(vaddr, len, name, name, module) {};
|
: Symbol(vaddr, len, name, name, module) {}
|
||||||
|
|
||||||
// kernel use this
|
// kernel use this
|
||||||
Symbol(uint64_t vaddr, const std::string &name, const std::string &module)
|
Symbol(uint64_t vaddr, const std::string &name, const std::string &module)
|
||||||
: Symbol(vaddr, 0, name, name, module) {};
|
: Symbol(vaddr, 0, name, name, module) {}
|
||||||
|
|
||||||
// Symbolic use this
|
// Symbolic use this
|
||||||
Symbol(uint64_t taskVaddr = 0, const std::string &comm = "")
|
Symbol(uint64_t taskVaddr = 0, const std::string &comm = "")
|
||||||
: taskVaddr_(taskVaddr), comm_(comm)
|
: taskVaddr_(taskVaddr), comm_(comm)
|
||||||
{
|
{
|
||||||
};
|
}
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
Symbol(const Symbol &other) = default;
|
Symbol(const Symbol &other) = default;
|
||||||
@ -353,4 +353,4 @@ protected:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_SYMBOLS_H
|
||||||
|
2
include/tracked_command.h
Executable file → Normal file
2
include/tracked_command.h
Executable file → Normal file
@ -73,4 +73,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_TRACKED_COMMAND_H_
|
||||||
|
2
include/utilities.h
Executable file → Normal file
2
include/utilities.h
Executable file → Normal file
@ -320,4 +320,4 @@ int munmap(void *addr, size_t);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif // HIPERF_UTILITIES_H_
|
||||||
|
2
include/virtual_runtime.h
Executable file → Normal file
2
include/virtual_runtime.h
Executable file → Normal file
@ -176,4 +176,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_VIRTUAL_RUNTIME_H
|
||||||
|
4
include/virtual_thread.h
Executable file → Normal file
4
include/virtual_thread.h
Executable file → Normal file
@ -48,7 +48,7 @@ public:
|
|||||||
symbolsFiles_(symbolsFiles),
|
symbolsFiles_(symbolsFiles),
|
||||||
processMemMaps_(),
|
processMemMaps_(),
|
||||||
memMaps_(processMemMaps_),
|
memMaps_(processMemMaps_),
|
||||||
parent_(*this) {};
|
parent_(*this) {}
|
||||||
|
|
||||||
VirtualThread(pid_t pid, pid_t tid, VirtualThread &thread,
|
VirtualThread(pid_t pid, pid_t tid, VirtualThread &thread,
|
||||||
const std::vector<std::unique_ptr<SymbolsFile>> &symbolsFiles)
|
const std::vector<std::unique_ptr<SymbolsFile>> &symbolsFiles)
|
||||||
@ -110,4 +110,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_VIRTUAL_THREAD_H
|
||||||
|
@ -322,4 +322,4 @@ private:
|
|||||||
} // namespace HiPerf
|
} // namespace HiPerf
|
||||||
} // namespace Developtools
|
} // namespace Developtools
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
#endif
|
#endif // HIPERF_CLIENT_H_
|
||||||
|
2
interfaces/kits/js/napi/hiperf_client_napi.h
Executable file → Normal file
2
interfaces/kits/js/napi/hiperf_client_napi.h
Executable file → Normal file
@ -15,4 +15,4 @@
|
|||||||
#ifndef HIPERF_CLIENT_NAPI_H
|
#ifndef HIPERF_CLIENT_NAPI_H
|
||||||
#define HIPERF_CLIENT_NAPI_H
|
#define HIPERF_CLIENT_NAPI_H
|
||||||
|
|
||||||
#endif
|
#endif // HIPERF_CLIENT_NAPI_H
|
||||||
|
0
script/loadlib_test.py
Executable file → Normal file
0
script/loadlib_test.py
Executable file → Normal file
0
script/make_diff.py
Executable file → Normal file
0
script/make_diff.py
Executable file → Normal file
0
script/make_report_sample.py
Executable file → Normal file
0
script/make_report_sample.py
Executable file → Normal file
0
script/record_control.py
Executable file → Normal file
0
script/record_control.py
Executable file → Normal file
0
script/recv_binary_cache.py
Executable file → Normal file
0
script/recv_binary_cache.py
Executable file → Normal file
0
script/report-diff.html
Executable file → Normal file
0
script/report-diff.html
Executable file → Normal file
0
script/report.html
Executable file → Normal file
0
script/report.html
Executable file → Normal file
0
script/test/__init__.py
Executable file → Normal file
0
script/test/__init__.py
Executable file → Normal file
0
script/test/test_command_script.py
Executable file → Normal file
0
script/test/test_command_script.py
Executable file → Normal file
0
script/test/test_utils.py
Executable file → Normal file
0
script/test/test_utils.py
Executable file → Normal file
0
src/callstack.cpp
Executable file → Normal file
0
src/callstack.cpp
Executable file → Normal file
0
src/command.cpp
Executable file → Normal file
0
src/command.cpp
Executable file → Normal file
0
src/debug_logger.cpp
Executable file → Normal file
0
src/debug_logger.cpp
Executable file → Normal file
0
src/dwarf_encoding.cpp
Executable file → Normal file
0
src/dwarf_encoding.cpp
Executable file → Normal file
0
src/elf_file.cpp
Executable file → Normal file
0
src/elf_file.cpp
Executable file → Normal file
0
src/elf_header.cpp
Executable file → Normal file
0
src/elf_header.cpp
Executable file → Normal file
0
src/elf_symbol.cpp
Executable file → Normal file
0
src/elf_symbol.cpp
Executable file → Normal file
@ -158,6 +158,10 @@ const char *ReportGetSymbolFiles(const char *perfFile)
|
|||||||
|
|
||||||
static std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size)
|
static std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
|
if (buffer == nullptr) {
|
||||||
|
HLOGE("param is null");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
std::string descString;
|
std::string descString;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (i < size) {
|
while (i < size) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
0
src/main.cpp
Executable file → Normal file
0
src/main.cpp
Executable file → Normal file
0
src/option.cpp
Executable file → Normal file
0
src/option.cpp
Executable file → Normal file
0
src/option_debug.cpp
Executable file → Normal file
0
src/option_debug.cpp
Executable file → Normal file
0
src/perf_event_record.cpp
Executable file → Normal file
0
src/perf_event_record.cpp
Executable file → Normal file
0
src/perf_events.cpp
Executable file → Normal file
0
src/perf_events.cpp
Executable file → Normal file
2
src/perf_file_format.cpp
Executable file → Normal file
2
src/perf_file_format.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
2
src/perf_file_reader.cpp
Executable file → Normal file
2
src/perf_file_reader.cpp
Executable file → Normal file
@ -125,7 +125,7 @@ bool PerfFileReader::ReadFileHeader()
|
|||||||
std::bitset<SIZE_FETURE_COUNT> features(header_.features[i]);
|
std::bitset<SIZE_FETURE_COUNT> features(header_.features[i]);
|
||||||
for (int j = 0; j < SIZE_FETURE_COUNT; j++) {
|
for (int j = 0; j < SIZE_FETURE_COUNT; j++) {
|
||||||
if (features.test(j)) {
|
if (features.test(j)) {
|
||||||
features_.emplace_back((FEATURE)(i * SIZE_FETURE_COUNT + j));
|
features_.emplace_back((FEATURE)(((uint64_t)i) * SIZE_FETURE_COUNT + j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
0
src/perf_file_writer.cpp
Executable file → Normal file
0
src/perf_file_writer.cpp
Executable file → Normal file
2
src/program_header.cpp
Executable file → Normal file
2
src/program_header.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
2
src/register.cpp
Executable file → Normal file
2
src/register.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
|
0
src/report.cpp
Executable file → Normal file
0
src/report.cpp
Executable file → Normal file
0
src/report_json_file.cpp
Executable file → Normal file
0
src/report_json_file.cpp
Executable file → Normal file
2
src/report_protobuf_file.cpp
Executable file → Normal file
2
src/report_protobuf_file.cpp
Executable file → Normal file
@ -259,7 +259,7 @@ bool ReportProtobufFileReader::Dump(std::string fileName, ProtobufReadBack readB
|
|||||||
if (!CheckFileMagic()) {
|
if (!CheckFileMagic()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
protpbufInputStream_ =std::make_unique<google::protobuf::io::CopyingInputStreamAdaptor>(this);
|
protpbufInputStream_ = std::make_unique<google::protobuf::io::CopyingInputStreamAdaptor>(this);
|
||||||
protpbufCodedInputStream_ =
|
protpbufCodedInputStream_ =
|
||||||
std::make_unique<google::protobuf::io::CodedInputStream>(protpbufInputStream_.get());
|
std::make_unique<google::protobuf::io::CodedInputStream>(protpbufInputStream_.get());
|
||||||
uint32_t recordLength = 0;
|
uint32_t recordLength = 0;
|
||||||
|
0
src/ring_buffer.cpp
Executable file → Normal file
0
src/ring_buffer.cpp
Executable file → Normal file
0
src/section_header.cpp
Executable file → Normal file
0
src/section_header.cpp
Executable file → Normal file
0
src/subcommand.cpp
Executable file → Normal file
0
src/subcommand.cpp
Executable file → Normal file
28
src/symbols_file.cpp
Executable file → Normal file
28
src/symbols_file.cpp
Executable file → Normal file
@ -222,6 +222,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size) const
|
std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size) const
|
||||||
{
|
{
|
||||||
|
if (buffer == nullptr) {
|
||||||
|
HLOGE("param is null");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
std::string descString;
|
std::string descString;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while (i < size) {
|
while (i < size) {
|
||||||
@ -233,6 +237,10 @@ protected:
|
|||||||
|
|
||||||
std::string ElfGetBuildId(const unsigned char *buffer, size_t size) const
|
std::string ElfGetBuildId(const unsigned char *buffer, size_t size) const
|
||||||
{
|
{
|
||||||
|
if (buffer == nullptr) {
|
||||||
|
HLOGE("param is null");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
const unsigned char *end = buffer + size;
|
const unsigned char *end = buffer + size;
|
||||||
HLOGV("size:%zu", size);
|
HLOGV("size:%zu", size);
|
||||||
|
|
||||||
@ -554,6 +562,10 @@ private:
|
|||||||
bool ReadSymTab(const std::unique_ptr<ElfFile> &elfFile, const ELF::SectionHeader *shdr,
|
bool ReadSymTab(const std::unique_ptr<ElfFile> &elfFile, const ELF::SectionHeader *shdr,
|
||||||
std::vector<Symbol> &symbolsTable) const
|
std::vector<Symbol> &symbolsTable) const
|
||||||
{
|
{
|
||||||
|
if (shdr == nullptr) {
|
||||||
|
HLOGE("param is null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
HLOGV("ParseSymTable");
|
HLOGV("ParseSymTable");
|
||||||
if (!elfFile->ParseSymTable(shdr)) {
|
if (!elfFile->ParseSymTable(shdr)) {
|
||||||
return false;
|
return false;
|
||||||
@ -962,7 +974,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual bool LoadSymbols(const std::string &symbolFilePath) override
|
bool LoadSymbols(const std::string &symbolFilePath) override
|
||||||
{
|
{
|
||||||
symbolsLoaded_ = true;
|
symbolsLoaded_ = true;
|
||||||
HLOGV("KernelSymbols try read '%s' search paths size %zu, inDeviceRecord %d",
|
HLOGV("KernelSymbols try read '%s' search paths size %zu, inDeviceRecord %d",
|
||||||
@ -997,7 +1009,7 @@ public:
|
|||||||
// try vmlinux
|
// try vmlinux
|
||||||
return ElfFileSymbols::LoadSymbols(KERNEL_ELF_NAME);
|
return ElfFileSymbols::LoadSymbols(KERNEL_ELF_NAME);
|
||||||
}
|
}
|
||||||
virtual uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart, uint64_t) const override
|
uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart, uint64_t) const override
|
||||||
{
|
{
|
||||||
// ip is vaddr in /proc/kallsyms
|
// ip is vaddr in /proc/kallsyms
|
||||||
return ip;
|
return ip;
|
||||||
@ -1015,7 +1027,7 @@ public:
|
|||||||
}
|
}
|
||||||
~KernelModuleSymbols() override {};
|
~KernelModuleSymbols() override {};
|
||||||
|
|
||||||
virtual bool LoadSymbols(const std::string &symbolFilePath) override
|
bool LoadSymbols(const std::string &symbolFilePath) override
|
||||||
{
|
{
|
||||||
symbolsLoaded_ = true;
|
symbolsLoaded_ = true;
|
||||||
if (module_ == filePath_ and onRecording_) {
|
if (module_ == filePath_ and onRecording_) {
|
||||||
@ -1040,7 +1052,7 @@ public:
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart, uint64_t) const override
|
uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart, uint64_t) const override
|
||||||
{
|
{
|
||||||
return ip - mapStart;
|
return ip - mapStart;
|
||||||
}
|
}
|
||||||
@ -1069,14 +1081,14 @@ public:
|
|||||||
{
|
{
|
||||||
symbolFileType_ = SYMBOL_KERNEL_FILE;
|
symbolFileType_ = SYMBOL_KERNEL_FILE;
|
||||||
}
|
}
|
||||||
virtual bool LoadSymbols(const std::string &symbolFilePath) override
|
bool LoadSymbols(const std::string &symbolFilePath) override
|
||||||
{
|
{
|
||||||
symbolsLoaded_ = true;
|
symbolsLoaded_ = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
~JavaFileSymbols() override {}
|
~JavaFileSymbols() override {}
|
||||||
|
|
||||||
virtual uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart,
|
uint64_t GetVaddrInSymbols(uint64_t ip, uint64_t mapStart,
|
||||||
uint64_t mapPageOffset) const override
|
uint64_t mapPageOffset) const override
|
||||||
{
|
{
|
||||||
// this is different with elf
|
// this is different with elf
|
||||||
@ -1091,7 +1103,7 @@ public:
|
|||||||
{
|
{
|
||||||
symbolFileType_ = SYMBOL_KERNEL_FILE;
|
symbolFileType_ = SYMBOL_KERNEL_FILE;
|
||||||
}
|
}
|
||||||
virtual bool LoadSymbols(const std::string &symbolFilePath) override
|
bool LoadSymbols(const std::string &symbolFilePath) override
|
||||||
{
|
{
|
||||||
symbolsLoaded_ = true;
|
symbolsLoaded_ = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1105,7 +1117,7 @@ public:
|
|||||||
: SymbolsFile(SYMBOL_UNKNOW_FILE, symbolFilePath)
|
: SymbolsFile(SYMBOL_UNKNOW_FILE, symbolFilePath)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual bool LoadSymbols(const std::string &symbolFilePath) override
|
bool LoadSymbols(const std::string &symbolFilePath) override
|
||||||
{
|
{
|
||||||
symbolsLoaded_ = true;
|
symbolsLoaded_ = true;
|
||||||
return false;
|
return false;
|
||||||
|
0
src/tracked_command.cpp
Executable file → Normal file
0
src/tracked_command.cpp
Executable file → Normal file
0
src/utilities.cpp
Executable file → Normal file
0
src/utilities.cpp
Executable file → Normal file
8
src/virtual_runtime.cpp
Executable file → Normal file
8
src/virtual_runtime.cpp
Executable file → Normal file
@ -578,7 +578,7 @@ bool VirtualRuntime::GetSymbolCache(uint64_t ip, pid_t pid, pid_t tid, Symbol &s
|
|||||||
const Symbol VirtualRuntime::GetSymbol(uint64_t ip, pid_t pid, pid_t tid,
|
const Symbol VirtualRuntime::GetSymbol(uint64_t ip, pid_t pid, pid_t tid,
|
||||||
const perf_callchain_context &context)
|
const perf_callchain_context &context)
|
||||||
{
|
{
|
||||||
HLOGV("try find tid %u ip 0x%" PRIx64 " in %zu symbolsFiles ", tid, ip, symbolsFiles_.size());
|
HLOGV("try find tid %u ip 0x%" PRIx64 " in %zu symbolsFiles", tid, ip, symbolsFiles_.size());
|
||||||
Symbol symbol;
|
Symbol symbol;
|
||||||
if (threadSymbolCache_.find(tid) == threadSymbolCache_.end()) {
|
if (threadSymbolCache_.find(tid) == threadSymbolCache_.end()) {
|
||||||
threadSymbolCache_[tid].reserve(THREAD_SYMBOL_CACHE_LIMIT);
|
threadSymbolCache_[tid].reserve(THREAD_SYMBOL_CACHE_LIMIT);
|
||||||
@ -590,15 +590,15 @@ const Symbol VirtualRuntime::GetSymbol(uint64_t ip, pid_t pid, pid_t tid,
|
|||||||
// check userspace memmap
|
// check userspace memmap
|
||||||
symbol = GetUserSymbol(ip, GetThread(pid, tid));
|
symbol = GetUserSymbol(ip, GetThread(pid, tid));
|
||||||
threadSymbolCache_[tid][ip] = symbol;
|
threadSymbolCache_[tid][ip] = symbol;
|
||||||
HLOGV("cache ip 0x%" PRIx64 " to %s", ip,
|
HLOGV("cache ip 0x%" PRIx64 " to %s", ip,
|
||||||
threadSymbolCache_[tid][ip].ToDebugString().c_str());
|
threadSymbolCache_[tid][ip].ToDebugString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context == PERF_CONTEXT_KERNEL or (context == PERF_CONTEXT_MAX and !symbol.isValid())) {
|
if (context == PERF_CONTEXT_KERNEL or (context == PERF_CONTEXT_MAX and !symbol.isValid())) {
|
||||||
// check kernelspace
|
// check kernelspace
|
||||||
HLOGM("try found addr in kernelspace %zu maps ", kernelSpaceMemMaps_.size());
|
HLOGM("try found addr in kernelspace %zu maps", kernelSpaceMemMaps_.size());
|
||||||
symbol = GetKernelSymbol(ip, kernelSpaceMemMaps_, GetThread(pid, tid));
|
symbol = GetKernelSymbol(ip, kernelSpaceMemMaps_, GetThread(pid, tid));
|
||||||
HLOGM("add addr to kernel cache 0x%" PRIx64 " cache size %zu ", ip,
|
HLOGM("add addr to kernel cache 0x%" PRIx64 " cache size %zu", ip,
|
||||||
kernelSymbolCache_.size());
|
kernelSymbolCache_.size());
|
||||||
kernelSymbolCache_[ip] = symbol;
|
kernelSymbolCache_[ip] = symbol;
|
||||||
}
|
}
|
||||||
|
0
src/virtual_thread.cpp
Executable file → Normal file
0
src/virtual_thread.cpp
Executable file → Normal file
0
test/fuzztest/ClientApi_fuzzer/ClientApi_fuzzer.cpp
Executable file → Normal file
0
test/fuzztest/ClientApi_fuzzer/ClientApi_fuzzer.cpp
Executable file → Normal file
2
test/fuzztest/ClientApi_fuzzer/ClientApi_fuzzer.h
Executable file → Normal file
2
test/fuzztest/ClientApi_fuzzer/ClientApi_fuzzer.h
Executable file → Normal file
@ -31,4 +31,4 @@
|
|||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||||
|
|
||||||
#endif /* CLIENTAPI_FUZZER_H */
|
#endif // CLIENTAPI_FUZZER_H
|
||||||
|
0
test/fuzztest/ClientApi_fuzzer/corpus/init
Executable file → Normal file
0
test/fuzztest/ClientApi_fuzzer/corpus/init
Executable file → Normal file
0
test/fuzztest/ClientApi_fuzzer/project.xml
Executable file → Normal file
0
test/fuzztest/ClientApi_fuzzer/project.xml
Executable file → Normal file
0
test/fuzztest/CommandLine_fuzzer/CommandLine_fuzzer.cpp
Executable file → Normal file
0
test/fuzztest/CommandLine_fuzzer/CommandLine_fuzzer.cpp
Executable file → Normal file
4
test/fuzztest/CommandLine_fuzzer/CommandLine_fuzzer.h
Executable file → Normal file
4
test/fuzztest/CommandLine_fuzzer/CommandLine_fuzzer.h
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -30,4 +30,4 @@
|
|||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||||
|
|
||||||
#endif /* COMMANDLINE_FUZZER_H */
|
#endif // COMMANDLINE_FUZZER_H
|
||||||
|
0
test/fuzztest/CommandLine_fuzzer/corpus/init
Executable file → Normal file
0
test/fuzztest/CommandLine_fuzzer/corpus/init
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user