Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 202c10b7 authored by sergeyv's avatar sergeyv
Browse files

Move hwuimacro to common native benchmark infrastructure

Change-Id: I2d2b358d205b1ed950ddc9caa57360b68001893b
parent 807cf869
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public:
    struct Options {
        int count = 0;
        int reportFrametimeWeight = 0;
        bool renderOffscreen = false;
        bool renderOffscreen = true;
    };

    template <class T>
+2 −2
Original line number Diff line number Diff line
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
+19 −13
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ void run(const TestScene::Info& info, const TestScene::Options& opts,

static void printHelp() {
    printf(R"(
USAGE: hwuitest [OPTIONS] <TESTNAME>
USAGE: hwuimacro [OPTIONS] <TESTNAME>

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,11 +284,6 @@ 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);
                }
            } else {
            auto pos = TestScene::testMap().find(test);
            if (pos == TestScene::testMap().end()) {
                fprintf(stderr, "Unknown test '%s'\n", test);
@@ -286,10 +291,11 @@ void parseOptions(int argc, char* argv[]) {
            } else {
                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);
        }
    }
}