fix codecheck issues

Signed-off-by: wenlong12 <wenlong12@huawei.com>

Signed-off-by: wenlong12 <wwx1097114@DESKTOP-2021EGU.localdomain>
This commit is contained in:
wenlong12 2022-03-25 11:49:41 +08:00
parent 5b495d2c87
commit e356db195a
212 changed files with 277 additions and 241 deletions

View File

@ -1,3 +1,4 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

0
OAT.xml Executable file → Normal file
View File

0
README_zh.md Executable file → Normal file
View File

View File

@ -17,4 +17,4 @@ for /r %%i in (*.h *.cpp) do (
clang-format.exe -style="file" -fallback-style="LLVM" -i --verbose %%i
)
pause
pause

2
demo/cpp/hiperf_example_cmd.cpp Executable file → Normal file
View File

@ -490,4 +490,4 @@ USED_FUNCTION int main(int argc, char *argv[])
RunSampleThread(option);
return 0;
}
}

0
demo/cpp/hiperf_malloc_demo.cpp Executable file → Normal file
View File

0
demo/js/entry/package.json Executable file → Normal file
View File

0
demo/js/entry/src/main/js/MainAbility/app.js Executable file → Normal file
View File

0
demo/js/entry/src/main/js/MainAbility/i18n/en-US.json Executable file → Normal file
View File

0
demo/js/entry/src/main/js/MainAbility/i18n/zh-CN.json Executable file → Normal file
View File

View File

View File

View File

View File

View File

View File

0
demo/js/package.json Executable file → Normal file
View File

2
include/callstack.h Executable file → Normal file
View File

@ -136,4 +136,4 @@ struct UnwindInfo {
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_CALLSTACK_H

2
include/command.h Executable file → Normal file
View File

@ -29,4 +29,4 @@ public:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_COMMAND_H

4
include/debug_logger.h Executable file → Normal file
View File

@ -329,10 +329,10 @@ private:
class ScopeDebugLevel {
public:
ScopeDebugLevel(DebugLevel level, bool mix = false) {};
ScopeDebugLevel(DebugLevel level, bool mix = false) {}
};
#endif
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif // _HIPERF_DEBUG_H_
#endif // _HIPERF_DEBUG_H_

2
include/dwarf_encoding.h Executable file → Normal file
View File

@ -190,4 +190,4 @@ struct eh_frame_hdr {
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // DWARF_ENCODING_H

4
include/elf_parser.h Executable file → Normal file
View 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;
}
@ -307,4 +307,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // ELF_PARSER_H_

2
include/hashlist.h Executable file → Normal file
View File

@ -222,4 +222,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_HASHLIST_H

10
include/hashlist.hpp Executable file → Normal file
View File

@ -112,12 +112,12 @@ HashList<Key, Val>::Iterator::Iterator(const LinkNode<Key, Val> *pnode, const Ha
template<typename Key, typename Val>
HashList<Key, Val>::Iterator::Iterator(const Iterator& itr)
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
{}
template<typename Key, typename Val>
HashList<Key, Val>::Iterator::Iterator(Iterator&& itr)
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
{
itr.pnode_ = nullptr;
itr.phashList_ = nullptr;
@ -218,7 +218,7 @@ auto HashList<Key, Val>::Iterator::operator--(int) noexcept
pnode_ = nullptr;
phashList_ = nullptr;
return res;
}
}
pnode_ = LinkNode<Key, Val>::GetLinkNode(plink);
return res;
}
@ -312,7 +312,7 @@ HashList<Key, Val>::ReverseIterator::ReverseIterator(const LinkNode<Key, Val> *p
template<typename Key, typename Val>
HashList<Key, Val>::ReverseIterator::ReverseIterator(const ReverseIterator &itr)
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
: pnode_ {itr.pnode_}, phashList_ {itr.phashList_}
{}
template<typename Key, typename Val>
@ -841,7 +841,7 @@ bool HashList<Key, Val>::MoveNode(const Iterator& pos, LinkNode<Key, Val> *&pnod
Link* nextLink = pnode->link_.next_;
if (prevLink and nextLink) {
prevLink->next_ = nextLink;
nextLink->prev_ = prevLink;
nextLink->prev_ = prevLink;
}
Link *currLink = &curNode->link_;
prevLink = currLink->prev_;

View File

@ -94,5 +94,4 @@ DLL_EXPORT const char *CDECL ReportGetBuildId(const char *elfPath);
// return "unknown" when failed happend
DLL_EXPORT const char *CDECL ReportGetElfArch(const char *elfPath);
}
#endif
#endif // HIPERF_LIBREPORT_H

2
include/mem_map_item.h Executable file → Normal file
View File

@ -98,4 +98,4 @@ public:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // MEMMAPITEM_H

View File

@ -23,4 +23,4 @@ private:
Noncopyable(const Noncopyable &);
const Noncopyable &operator=(const Noncopyable &);
};
#endif
#endif // NONCOPYABLE_H_

View File

@ -22,4 +22,4 @@
using _pid_t = int;
using pid_t = _pid_t;
#endif
#endif
#endif

View File

@ -14,4 +14,4 @@
*/
#ifndef BYTE_ORDER_H
#define BYTE_ORDER_H
#endif
#endif

View File

@ -14,4 +14,4 @@
*/
#ifndef NONLINUX_LINUX_IOCTL_H
#define NONLINUX_LINUX_IOCTL_H
#endif
#endif

View File

@ -30,4 +30,4 @@ using __s32 = int;
using __u32 = unsigned int;
using __s64 = long long;
using __u64 = unsigned long long;
#endif
#endif

2
include/option.h Executable file → Normal file
View File

@ -137,4 +137,4 @@ const std::map<std::string, std::unique_ptr<MainOption>> &GetMainOptions();
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_OPTION_H_

2
include/option_debug.h Executable file → Normal file
View File

@ -27,4 +27,4 @@ void RegisterMainCommandDebug(void);
}
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_OPTION_DEBUG_H

66
include/perf_event_record.h Executable file → Normal file
View File

@ -110,7 +110,7 @@ public:
PerfEventRecord(uint8_t *p, const std::string &name);
virtual ~PerfEventRecord() {};
virtual ~PerfEventRecord() {}
virtual size_t GetSize() const
{
@ -170,21 +170,21 @@ class PerfRecordMmap : public PerfEventRecord {
public:
PerfRecordMmapData data_;
PerfRecordMmap(uint8_t *p);
explicit PerfRecordMmap(uint8_t *p);
PerfRecordMmap(bool inKernel, u32 pid, u32 tid, u64 addr, u64 len, u64 pgoff,
const std::string &filename);
bool GetBinary(std::vector<uint8_t> &buf) const override;
virtual void DumpData(int indent) const override;
virtual void DumpLog(const std::string &prefix) const override;
void DumpData(int indent) const override;
void DumpLog(const std::string &prefix) const override;
};
class PerfRecordMmap2 : public PerfEventRecord {
public:
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,
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);
bool GetBinary(std::vector<uint8_t> &buf) const override;
virtual void DumpData(int indent) const override;
virtual void DumpLog(const std::string &prefix) const override;
void DumpData(int indent) const override;
void DumpLog(const std::string &prefix) const override;
};
class PerfRecordLost : public PerfEventRecord {
public:
PerfRecordLostData data_;
PerfRecordLost(uint8_t *p);
explicit PerfRecordLost(uint8_t *p);
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
PerfRecordLost(bool inKernel, u64 id, u64 lost)
@ -219,12 +219,12 @@ class PerfRecordComm : public PerfEventRecord {
public:
PerfRecordCommData data_;
PerfRecordComm(uint8_t *p);
explicit PerfRecordComm(uint8_t *p);
PerfRecordComm(bool inKernel, u32 pid, u32 tid, const std::string &comm);
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;
};
@ -242,8 +242,8 @@ public:
// referenced input(p) in PerfRecordSample, require caller keep input(p) together
PerfRecordSample(uint8_t *p, const perf_event_attr &attr);
bool GetBinary(std::vector<uint8_t> &buf) const override;
virtual void DumpData(int indent = 0) const override;
virtual void DumpLog(const std::string &prefix) const override;
void DumpData(int indent = 0) const override;
void DumpLog(const std::string &prefix) const override;
// originalSize is use for expand callstack
void ReplaceWithCallStack(size_t originalSize = 0);
@ -266,10 +266,10 @@ class PerfRecordExit : public PerfEventRecord {
public:
PerfRecordExitData data_;
PerfRecordExit(uint8_t *p);
explicit PerfRecordExit(uint8_t *p);
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 {
@ -279,27 +279,27 @@ public:
PerfRecordThrottle(uint8_t *p);
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 {
public:
PerfRecordThrottleData data_;
PerfRecordUnthrottle(uint8_t *p);
explicit PerfRecordUnthrottle(uint8_t *p);
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 {
public:
PerfRecordForkData data_;
PerfRecordFork(uint8_t *p);
explicit PerfRecordFork(uint8_t *p);
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:
PerfRecordReadData data_;
PerfRecordRead(uint8_t *p);
explicit PerfRecordRead(uint8_t *p);
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:
PerfRecordAuxData data_;
PerfRecordAux(uint8_t *p);
explicit PerfRecordAux(uint8_t *p);
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:
PerfRecordItraceStartData data_;
PerfRecordItraceStart(uint8_t *p);
explicit PerfRecordItraceStart(uint8_t *p);
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:
PerfRecordLostSamplesData data_;
PerfRecordLostSamples(uint8_t *p);
explicit PerfRecordLostSamples(uint8_t *p);
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 {
public:
PerfRecordSwitchData data_;
PerfRecordSwitch(uint8_t *p);
explicit PerfRecordSwitch(uint8_t *p);
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 {
public:
PerfRecordSwitchCpuWideData data_;
PerfRecordSwitchCpuWide(uint8_t *p);
explicit PerfRecordSwitchCpuWide(uint8_t *p);
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,
@ -433,4 +433,4 @@ void PopFromBinary2(bool condition, uint8_t *&p, T1 &v1, T2 &v2);
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_PERF_EVENT_RECORD_H

2
include/perf_events.h Executable file → Normal file
View File

@ -517,4 +517,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_PERF_EVENTS_H

6
include/perf_file_format.h Executable file → Normal file
View File

@ -127,7 +127,7 @@ public:
virtual bool GetBinary(char *buf, size_t size) = 0;
virtual size_t GetSize() = 0;
virtual ~PerfFileSection() {};
virtual ~PerfFileSection() {}
explicit PerfFileSection(const FEATURE featureId) : featureId_(featureId)
{
header.size = 0;
@ -180,7 +180,7 @@ struct SymbolStruct {
uint64_t vaddr_ = 0;
uint32_t len_ = 0;
std::string symbolName_ = EMPTY_STRING;
SymbolStruct() {};
SymbolStruct() {}
SymbolStruct(uint64_t vaddr, uint32_t len, const std::string &symbolName)
: vaddr_(vaddr), len_(len), symbolName_(symbolName)
{
@ -257,4 +257,4 @@ public:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_PERF_FILE_FORMAT_H

2
include/perf_file_reader.h Executable file → Normal file
View File

@ -98,4 +98,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_FILE_READER

4
include/perf_file_writer.h Executable file → Normal file
View File

@ -39,7 +39,7 @@ public:
attrSection_.size = 0;
defaultEventAttr_.branch_sample_type = 0;
defaultEventAttr_.namespaces = 0;
};
}
~PerfFileWriter();
bool Open(const std::string &fileName, bool compressData = false);
@ -89,4 +89,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_PERF_FILE_WRITER_H

2
include/perf_record_format.h Executable file → Normal file
View File

@ -357,4 +357,4 @@ struct PerfRecordNamespacesData {
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_PERF_RECORD_FORMAT_H

2
include/register.h Executable file → Normal file
View File

@ -190,4 +190,4 @@ void UpdateRegForABI(ArchType arch, u64 registers[]);
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_REGISTER_H

4
include/report.h Executable file → Normal file
View File

@ -500,7 +500,7 @@ public:
}
};
std::vector<ReportEventConfigItem> configs_;
virtual ~Report() {};
virtual ~Report() {}
std::map<uint64_t, size_t> configIdIndexMaps_; // index of configNames_
std::string GetConfigName(uint64_t id)
@ -566,4 +566,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // REPORT_H

8
include/report_json_file.h Executable file → Normal file
View File

@ -206,7 +206,7 @@ struct ReportFuncItem {
uint64_t sampleCount_ = 0;
uint64_t eventCount_ = 0;
uint64_t subTreeEventCount_ = 0;
ReportFuncItem(int functionId) : functionId_(functionId) {}
explicit ReportFuncItem(int functionId) : functionId_(functionId) {}
void OutputJson(FILE *output) const
{
if (fprintf(output, "{") < 0) {
@ -266,7 +266,7 @@ struct ReportCallNodeItem {
return (a.functionId_ == functionId);
}
ReportCallNodeItem(int functionId) : functionId_(functionId) {}
explicit ReportCallNodeItem(int functionId) : functionId_(functionId) {}
};
struct ReportLibItem {
@ -328,7 +328,7 @@ struct ReportProcessItem {
return;
}
}
ReportProcessItem(pid_t pid) : pid_(pid) {}
explicit ReportProcessItem(pid_t pid) : pid_(pid) {}
};
struct ReportConfigItem {
@ -415,4 +415,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // REPORT_JSON_FILE_H

2
include/report_protobuf_file.h Executable file → Normal file
View File

@ -97,4 +97,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_REPORT_PROTOBUF_FILE

4
include/ring_buffer.h Executable file → Normal file
View File

@ -25,7 +25,7 @@ public:
// little endian, perf_event_header.type is less than 0xff, so set it
static constexpr uint8_t MARGIN_BYTE = 0xFF;
RingBuffer(size_t size);
explicit RingBuffer(size_t size);
~RingBuffer();
// get size of the writable space
size_t GetFreeSize() const;
@ -50,4 +50,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_RING_BUFFER_H

4
include/subcommand.h Executable file → Normal file
View File

@ -57,7 +57,7 @@ public:
return false;
};
virtual void DumpOptions() const {};
virtual void DumpOptions() const {}
// args should be empty after all the args processed
virtual bool ParseOption(std::vector<std::string> &args)
@ -95,4 +95,4 @@ protected:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_SUBCOMMAND_H_

View File

@ -116,4 +116,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // SUBCOMMAND_DUMP_H

View File

@ -42,4 +42,4 @@ public:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_SUBCOMMAND_HELP_H_

View File

@ -64,4 +64,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // SUBCOMMAND_LIST_H_

View File

@ -290,4 +290,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // SUBCOMMAND_RECORD_H

View File

@ -188,4 +188,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // SUBCOMMAND_REPORT_H

View File

@ -118,4 +118,4 @@ bool RegisterSubCommandStat(void);
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // SUBCOMMAND_STAT_H_

10
include/symbols_file.h Executable file → Normal file
View File

@ -82,19 +82,19 @@ struct Symbol {
len_(len),
name_(MemoryHold::Get().HoldStringView(name)),
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(vaddr, len, name, name, module) {};
: Symbol(vaddr, len, name, name, module) {}
// kernel use this
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
Symbol(uint64_t taskVaddr = 0, const std::string &comm = "")
: taskVaddr_(taskVaddr), comm_(comm)
{
};
}
// copy
Symbol(const Symbol &other) = default;
@ -353,4 +353,4 @@ protected:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_SYMBOLS_H

2
include/tracked_command.h Executable file → Normal file
View File

@ -73,4 +73,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_TRACKED_COMMAND_H_

2
include/utilities.h Executable file → Normal file
View File

@ -320,4 +320,4 @@ int munmap(void *addr, size_t);
#endif
#endif
#endif
#endif // HIPERF_UTILITIES_H_

2
include/virtual_runtime.h Executable file → Normal file
View File

@ -176,4 +176,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_VIRTUAL_RUNTIME_H

4
include/virtual_thread.h Executable file → Normal file
View File

@ -48,7 +48,7 @@ public:
symbolsFiles_(symbolsFiles),
processMemMaps_(),
memMaps_(processMemMaps_),
parent_(*this) {};
parent_(*this) {}
VirtualThread(pid_t pid, pid_t tid, VirtualThread &thread,
const std::vector<std::unique_ptr<SymbolsFile>> &symbolsFiles)
@ -110,4 +110,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_VIRTUAL_THREAD_H

View File

@ -322,4 +322,4 @@ private:
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
#endif
#endif // HIPERF_CLIENT_H_

2
interfaces/kits/js/napi/hiperf_client_napi.h Executable file → Normal file
View File

@ -15,4 +15,4 @@
#ifndef HIPERF_CLIENT_NAPI_H
#define HIPERF_CLIENT_NAPI_H
#endif
#endif // HIPERF_CLIENT_NAPI_H

View File

@ -88,4 +88,4 @@ message HiperfRecord {
VirtualThreadInfo thread = 4;
ReportInfo info= 5;
}
}
}

0
script/loadlib_test.py Executable file → Normal file
View File

0
script/make_diff.py Executable file → Normal file
View File

0
script/make_report_sample.py Executable file → Normal file
View File

View File

@ -51,4 +51,4 @@ cp -vf $OHOS_ARM_PATH/hiperf $OHOS_ARM_OUT_PATH
cd $HOST_OUT/../
rm -f hiperf.tar.gz
tar czvf hiperf.tar.gz hiperf
cd -
cd -

0
script/record_control.py Executable file → Normal file
View File

0
script/recv_binary_cache.py Executable file → Normal file
View File

0
script/report-diff.html Executable file → Normal file
View File

2
script/report.html Executable file → Normal file
View File

@ -5406,4 +5406,4 @@ input{
</lit-tabpane>
</lit-tabs>
</div>
<script id="record_data" type="application/json">
<script id="record_data" type="application/json">

0
script/test/__init__.py Executable file → Normal file
View File

0
script/test/test_command_script.py Executable file → Normal file
View File

2
script/test/test_utils.py Executable file → Normal file
View File

@ -71,4 +71,4 @@ class TestUtils(unittest.TestCase):
def test_find_tool_path(self):
result = find_tool_path('hdc')
self.assertEqual(result, 'hdc')
self.assertEqual(result, 'hdc')

0
src/callstack.cpp Executable file → Normal file
View File

2
src/command.cpp Executable file → Normal file
View File

@ -90,4 +90,4 @@ bool Command::DispatchCommand(std::string argument)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/debug_logger.cpp Executable file → Normal file
View File

@ -289,4 +289,4 @@ DebugLogger *DebugLogger::GetInstance()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/dwarf_encoding.cpp Executable file → Normal file
View File

@ -160,4 +160,4 @@ const std::string DwarfEncoding::ApplicationName() const
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/elf_file.cpp Executable file → Normal file
View File

@ -355,4 +355,4 @@ std::string ElfFile::GetSectionName(const uint32_t startIndex)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/elf_header.cpp Executable file → Normal file
View File

@ -191,4 +191,4 @@ bool ElfHeader::ParseElf64Header(unsigned char * const ehdrBuf, const std::size_
} // namespace ELF
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/elf_symbol.cpp Executable file → Normal file
View File

@ -126,4 +126,4 @@ std::unique_ptr<SymbolTable> SymbolTable::MakeUnique(const std::string &symNames
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

View File

@ -158,6 +158,10 @@ const char *ReportGetSymbolFiles(const char *perfFile)
static std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size)
{
if (buffer == nullptr) {
HLOGE("param is null");
return "";
}
std::string descString;
size_t i = 0;
while (i < size) {
@ -288,4 +292,4 @@ int Dump(const char *fileName)
return -1;
}
} // extern "C"
} // extern "C"

View 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -19,4 +19,4 @@ int main(const int argc, const char *argv[])
{
Dump("");
Report("perf.data", "report.txt", "");
}
}

0
src/main.cpp Executable file → Normal file
View File

2
src/option.cpp Executable file → Normal file
View File

@ -177,4 +177,4 @@ bool RegisterMainOption(const std::string &optionName, const std::string &help,
} // namespace Option
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

0
src/option_debug.cpp Executable file → Normal file
View File

0
src/perf_event_record.cpp Executable file → Normal file
View File

0
src/perf_events.cpp Executable file → Normal file
View File

4
src/perf_file_format.cpp Executable file → Normal file
View 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -485,4 +485,4 @@ void PerfFileSectionEventDesc::GetValue(std::vector<AttrWithId> &eventDesces) co
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

4
src/perf_file_reader.cpp Executable file → Normal file
View File

@ -125,7 +125,7 @@ bool PerfFileReader::ReadFileHeader()
std::bitset<SIZE_FETURE_COUNT> features(header_.features[i]);
for (int j = 0; j < SIZE_FETURE_COUNT; 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));
}
}
}
@ -443,4 +443,4 @@ bool PerfFileReader::ReadFeatureSection()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/perf_file_writer.cpp Executable file → Normal file
View File

@ -471,4 +471,4 @@ bool PerfFileWriter::AddSymbolsFeature(
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

4
src/program_header.cpp Executable file → Normal file
View 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -80,4 +80,4 @@ bool ProgramHeader::ParsePrgHeader64(char * const phdrBuf)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

4
src/register.cpp Executable file → Normal file
View 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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -270,4 +270,4 @@ void UpdateRegForABI(ArchType arch, u64 *regs)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/report.cpp Executable file → Normal file
View File

@ -653,4 +653,4 @@ void Report::OutputStdDiff(FILE *output, Report &other)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/report_json_file.cpp Executable file → Normal file
View File

@ -317,4 +317,4 @@ bool ReportJsonFile::OutputJson(FILE *output)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

4
src/report_protobuf_file.cpp Executable file → Normal file
View File

@ -259,7 +259,7 @@ bool ReportProtobufFileReader::Dump(std::string fileName, ProtobufReadBack readB
if (!CheckFileMagic()) {
return false;
}
protpbufInputStream_ =std::make_unique<google::protobuf::io::CopyingInputStreamAdaptor>(this);
protpbufInputStream_ = std::make_unique<google::protobuf::io::CopyingInputStreamAdaptor>(this);
protpbufCodedInputStream_ =
std::make_unique<google::protobuf::io::CodedInputStream>(protpbufInputStream_.get());
uint32_t recordLength = 0;
@ -406,4 +406,4 @@ bool ReportProtobufFileReader::isOpen()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/ring_buffer.cpp Executable file → Normal file
View File

@ -111,4 +111,4 @@ void RingBuffer::EndRead()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/section_header.cpp Executable file → Normal file
View File

@ -103,4 +103,4 @@ bool SectionHeader::ParseSecHeader64(char * const shdrBuf)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

2
src/subcommand.cpp Executable file → Normal file
View File

@ -109,4 +109,4 @@ SubCommand *SubCommand::FindSubCommand(std::string cmdName)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

View File

@ -527,4 +527,4 @@ bool SubCommandDump::RegisterSubCommandDump()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

View File

@ -70,4 +70,4 @@ bool SubCommandHelp::OnHelp(std::vector<std::string> &args)
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

View File

@ -67,4 +67,4 @@ void SubCommandList::RegisterSubCommandList()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

View File

@ -615,4 +615,4 @@ bool SubCommandReport::RegisterSubCommandReport()
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

30
src/symbols_file.cpp Executable file → Normal file
View File

@ -222,6 +222,10 @@ public:
protected:
std::string CovertByteBufferToHexString(const unsigned char *buffer, size_t size) const
{
if (buffer == nullptr) {
HLOGE("param is null");
return "";
}
std::string descString;
size_t i = 0;
while (i < size) {
@ -233,6 +237,10 @@ protected:
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;
HLOGV("size:%zu", size);
@ -554,6 +562,10 @@ private:
bool ReadSymTab(const std::unique_ptr<ElfFile> &elfFile, const ELF::SectionHeader *shdr,
std::vector<Symbol> &symbolsTable) const
{
if (shdr == nullptr) {
HLOGE("param is null");
return false;
}
HLOGV("ParseSymTable");
if (!elfFile->ParseSymTable(shdr)) {
return false;
@ -962,7 +974,7 @@ public:
return true;
}
}
virtual bool LoadSymbols(const std::string &symbolFilePath) override
bool LoadSymbols(const std::string &symbolFilePath) override
{
symbolsLoaded_ = true;
HLOGV("KernelSymbols try read '%s' search paths size %zu, inDeviceRecord %d",
@ -997,7 +1009,7 @@ public:
// try vmlinux
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
return ip;
@ -1015,7 +1027,7 @@ public:
}
~KernelModuleSymbols() override {};
virtual bool LoadSymbols(const std::string &symbolFilePath) override
bool LoadSymbols(const std::string &symbolFilePath) override
{
symbolsLoaded_ = true;
if (module_ == filePath_ and onRecording_) {
@ -1040,7 +1052,7 @@ public:
}
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;
}
@ -1069,14 +1081,14 @@ public:
{
symbolFileType_ = SYMBOL_KERNEL_FILE;
}
virtual bool LoadSymbols(const std::string &symbolFilePath) override
bool LoadSymbols(const std::string &symbolFilePath) override
{
symbolsLoaded_ = true;
return false;
}
~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
{
// this is different with elf
@ -1091,7 +1103,7 @@ public:
{
symbolFileType_ = SYMBOL_KERNEL_FILE;
}
virtual bool LoadSymbols(const std::string &symbolFilePath) override
bool LoadSymbols(const std::string &symbolFilePath) override
{
symbolsLoaded_ = true;
return false;
@ -1105,7 +1117,7 @@ public:
: SymbolsFile(SYMBOL_UNKNOW_FILE, symbolFilePath)
{
}
virtual bool LoadSymbols(const std::string &symbolFilePath) override
bool LoadSymbols(const std::string &symbolFilePath) override
{
symbolsLoaded_ = true;
return false;
@ -1332,4 +1344,4 @@ uint64_t SymbolsFile::GetVaddrInSymbols(uint64_t ip, uint64_t, uint64_t) const
}
} // namespace HiPerf
} // namespace Developtools
} // namespace OHOS
} // namespace OHOS

Some files were not shown because too many files have changed in this diff Show More