From a27a1a576c31012553f1ff7aa20ecbc9feaf81ac Mon Sep 17 00:00:00 2001 From: wenlong12 Date: Fri, 1 Apr 2022 16:11:28 +0800 Subject: [PATCH] fix us test failed issue Signed-off-by: wenlong12 Signed-off-by: wenlong12 --- BUILD.gn | 4 ++++ include/perf_events.h | 4 ++++ .../common/native/subcommand_record_test.cpp | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index ea414a0..584c197 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -59,6 +59,10 @@ config("hiperf_inner_config") { ] } + if (product_name == "Hi3516DV300") { + defines += [ "LITTLE_MEMORY" ] + } + if (hiperf_check_time) { defines += [ "HIPERF_DEBUG_TIME" ] } diff --git a/include/perf_events.h b/include/perf_events.h index e85c311..a5cf5ed 100644 --- a/include/perf_events.h +++ b/include/perf_events.h @@ -228,7 +228,11 @@ public: static constexpr uint64_t DEFAULT_SAMPLE_PERIOD = 1; static constexpr uint64_t DEFAULT_TIMEOUT = 10 * 1000; static constexpr size_t MIN_BUFFER_SIZE = 64 * 1024 * 1024; +#ifdef LITTLE_MEMORY + static constexpr size_t MAX_BUFFER_SIZE = 128 * 1024 * 1024; +#else static constexpr size_t MAX_BUFFER_SIZE = 256 * 1024 * 1024; +#endif static constexpr size_t BUFFER_LOW_LEVEL = 10 * 1024 * 1024; static constexpr size_t BUFFER_CRITICAL_LEVEL = 5 * 1024 * 1024; diff --git a/test/unittest/common/native/subcommand_record_test.cpp b/test/unittest/common/native/subcommand_record_test.cpp index 03edc0d..d149818 100644 --- a/test/unittest/common/native/subcommand_record_test.cpp +++ b/test/unittest/common/native/subcommand_record_test.cpp @@ -129,6 +129,18 @@ HWTEST_F(SubCommandRecordTest, StopSecondsMaxErr, TestSize.Level1) TestRecordCommand(opt, false); } +// system wide +HWTEST_F(SubCommandRecordTest, SystemWide, TestSize.Level1) +{ + TestRecordCommand("-d 2 -a ", true, false); +} + +// exclude hiperf +HWTEST_F(SubCommandRecordTest, ExcludePerf, TestSize.Level1) +{ + TestRecordCommand("-d 2 -a --exclude-hiperf ", true, false); +} + // select cpu HWTEST_F(SubCommandRecordTest, SelectCpu, TestSize.Level1) {