mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2025-02-17 06:39:21 +00:00
commit
002dcd8d80
@ -156,7 +156,7 @@ public:
|
||||
" must be a power of two, rang[2,1024], default is 1024.\n"
|
||||
" --app <package_name>\n"
|
||||
" Collect profile info for an OHOS app, the app must be debuggable.\n"
|
||||
" Record will exit if the process is not started within 10 seconds.\n"
|
||||
" Record will exit if the process is not started within 20 seconds.\n"
|
||||
" --chkms <millisec>\n"
|
||||
" Set the interval of querying the <package_name>.\n"
|
||||
" <millisec> is in range [1-200], default is 10.\n"
|
||||
|
@ -31,6 +31,7 @@ namespace Developtools {
|
||||
namespace HiPerf {
|
||||
const int FETURE_MAX = 256;
|
||||
const int SIZE_FETURE_COUNT = 8;
|
||||
constexpr char UNCOMPRESS_TMP_FILE[] = "/data/local/tmp/.perf.data";
|
||||
|
||||
std::unique_ptr<PerfFileReader> PerfFileReader::Instance(const std::string &fileName)
|
||||
{
|
||||
@ -48,11 +49,11 @@ std::unique_ptr<PerfFileReader> PerfFileReader::Instance(const std::string &file
|
||||
fclose(fp);
|
||||
reader->fp_ = nullptr;
|
||||
|
||||
CHECK_TRUE(!UncompressFile(fileName, ".perf.data"), nullptr, 1,
|
||||
CHECK_TRUE(!UncompressFile(fileName, UNCOMPRESS_TMP_FILE), nullptr, 1,
|
||||
"Fail to UncompressFile(%s)", fileName.c_str());
|
||||
|
||||
// open the uncompressed hidden file .perf.data
|
||||
FILE *fp2 = fopen(".perf.data", "rb");
|
||||
FILE *fp2 = fopen(UNCOMPRESS_TMP_FILE, "rb");
|
||||
if (fp2 == nullptr) {
|
||||
HLOGE("fail to open uncompressed file .perf.data");
|
||||
return nullptr;
|
||||
@ -95,7 +96,7 @@ PerfFileReader::~PerfFileReader()
|
||||
|
||||
// remove the uncompressed .perf.data
|
||||
if (compressData_) {
|
||||
if (remove(".perf.data") != 0) {
|
||||
if (remove(UNCOMPRESS_TMP_FILE) != 0) {
|
||||
HLOGE("Fail to remove uncompressed file .perf.data");
|
||||
perror("Fail to remove temp file");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user