From 202c10b7b54a7a344415b19d4c3f93266de4ad25 Mon Sep 17 00:00:00 2001 From: sergeyv Date: Mon, 11 Jul 2016 17:53:45 -0700 Subject: [PATCH] Move hwuimacro to common native benchmark infrastructure Change-Id: I2d2b358d205b1ed950ddc9caa57360b68001893b --- libs/hwui/Android.mk | 8 ++------ libs/hwui/tests/common/TestScene.h | 2 +- libs/hwui/tests/macrobench/how_to_run.txt | 4 ++-- libs/hwui/tests/macrobench/main.cpp | 32 ++++++++++++++++++------------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk index 95b28d3e8c26..eaea05163b03 100644 --- a/libs/hwui/Android.mk +++ b/libs/hwui/Android.mk @@ -283,19 +283,15 @@ include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/local/tmp -LOCAL_MODULE:= hwuitest +LOCAL_MODULE:= hwuimacro LOCAL_MODULE_TAGS := tests -LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := hwuitest -LOCAL_MODULE_STEM_64 := hwuitest64 LOCAL_CFLAGS := $(hwui_cflags) LOCAL_C_INCLUDES := $(hwui_c_includes) # set to libhwui_static_debug to skip actual GL commands LOCAL_WHOLE_STATIC_LIBRARIES := libhwui_static LOCAL_SHARED_LIBRARIES := libmemunreachable -LOCAL_STATIC_LIBRARIES := libgoogle-benchmark LOCAL_SRC_FILES += \ $(hwui_test_common_src_files) \ @@ -303,7 +299,7 @@ LOCAL_SRC_FILES += \ tests/macrobench/main.cpp include $(LOCAL_PATH)/hwui_static_deps.mk -include $(BUILD_EXECUTABLE) +include $(BUILD_NATIVE_BENCHMARK) # ------------------------ # Micro-bench app diff --git a/libs/hwui/tests/common/TestScene.h b/libs/hwui/tests/common/TestScene.h index 4813ff0de174..daeb9ea635d3 100644 --- a/libs/hwui/tests/common/TestScene.h +++ b/libs/hwui/tests/common/TestScene.h @@ -33,7 +33,7 @@ public: struct Options { int count = 0; int reportFrametimeWeight = 0; - bool renderOffscreen = false; + bool renderOffscreen = true; }; template diff --git a/libs/hwui/tests/macrobench/how_to_run.txt b/libs/hwui/tests/macrobench/how_to_run.txt index b051768f3262..3c3d36a8977f 100644 --- a/libs/hwui/tests/macrobench/how_to_run.txt +++ b/libs/hwui/tests/macrobench/how_to_run.txt @@ -1,5 +1,5 @@ mmm -j8 frameworks/base/libs/hwui/ && - adb push $OUT/data/local/tmp/hwuitest /data/local/tmp/hwuitest && - adb shell /data/local/tmp/hwuitest +adb push $OUT/data/benchmarktest/hwuimacro/hwuimacro /data/benchmarktest/hwuimacro/hwuimacro && +adb shell /data/benchmarktest/hwuimacro/hwuimacro shadowgrid2 --onscreen Pass --help to get help diff --git a/libs/hwui/tests/macrobench/main.cpp b/libs/hwui/tests/macrobench/main.cpp index ffeef4599774..ebc1dd7516c2 100644 --- a/libs/hwui/tests/macrobench/main.cpp +++ b/libs/hwui/tests/macrobench/main.cpp @@ -49,7 +49,7 @@ void run(const TestScene::Info& info, const TestScene::Options& opts, static void printHelp() { printf(R"( -USAGE: hwuitest [OPTIONS] +USAGE: hwuimacro [OPTIONS] OPTIONS: -c, --count=NUM NUM loops a test should run (example, number of frames) @@ -63,6 +63,10 @@ OPTIONS: moving average frametime. Weight is optional, default is 10 --cpuset=name Adds the test to the specified cpuset before running Not supported on all devices and needs root + --offscreen Render tests off device screen. This option is on by default + --onscreen Render tests on device screen. By default tests + are offscreen rendered + --benchmark_format Set output format. Possible values are tabular, json, csv )"); } @@ -150,6 +154,7 @@ enum { ReportFrametime, CpuSet, BenchmarkFormat, + Onscreen, Offscreen, }; } @@ -163,6 +168,7 @@ static const struct option LONG_OPTIONS[] = { { "report-frametime", optional_argument, nullptr, LongOpts::ReportFrametime }, { "cpuset", required_argument, nullptr, LongOpts::CpuSet }, { "benchmark_format", required_argument, nullptr, LongOpts::BenchmarkFormat }, + { "onscreen", no_argument, nullptr, LongOpts::Onscreen }, { "offscreen", no_argument, nullptr, LongOpts::Offscreen }, { 0, 0, 0, 0 } }; @@ -247,6 +253,10 @@ void parseOptions(int argc, char* argv[]) { } break; + case LongOpts::Onscreen: + gOpts.renderOffscreen = false; + break; + case LongOpts::Offscreen: gOpts.renderOffscreen = true; break; @@ -274,22 +284,18 @@ void parseOptions(int argc, char* argv[]) { if (optind < argc) { do { const char* test = argv[optind++]; - if (!strcmp(test, "all")) { - for (auto& iter : TestScene::testMap()) { - gRunTests.push_back(iter.second); - } + auto pos = TestScene::testMap().find(test); + if (pos == TestScene::testMap().end()) { + fprintf(stderr, "Unknown test '%s'\n", test); + exit(EXIT_FAILURE); } else { - auto pos = TestScene::testMap().find(test); - if (pos == TestScene::testMap().end()) { - fprintf(stderr, "Unknown test '%s'\n", test); - exit(EXIT_FAILURE); - } else { - gRunTests.push_back(pos->second); - } + gRunTests.push_back(pos->second); } } while (optind < argc); } else { - gRunTests.push_back(TestScene::testMap()["shadowgrid"]); + for (auto& iter : TestScene::testMap()) { + gRunTests.push_back(iter.second); + } } } -- 2.11.0