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

Commit 8a1bacaf authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Benchmark: stats_write"

parents 7841ff5e 3410634f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -242,7 +242,8 @@ LOCAL_MODULE := statsd_benchmark
LOCAL_SRC_FILES := $(statsd_common_src) \
                   benchmark/main.cpp \
                   benchmark/hello_world_benchmark.cpp \
                   benchmark/log_event_benchmark.cpp
                   benchmark/log_event_benchmark.cpp \
                   benchmark/stats_write_benchmark.cpp

LOCAL_C_INCLUDES := $(statsd_common_c_includes)

@@ -261,7 +262,8 @@ LOCAL_STATIC_LIBRARIES := \
    $(statsd_common_static_libraries)

LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
    libgtest_prod
    libgtest_prod \
    libstatslog

LOCAL_PROTOC_OPTIMIZE_TYPE := lite

+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * 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
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "benchmark/benchmark.h"
#include <statslog.h>

namespace android {
namespace os {
namespace statsd {

static void BM_StatsWrite(benchmark::State& state) {
    const char* reason = "test";
    int64_t boot_end_time = 1234567;
    int64_t total_duration = 100;
    int64_t bootloader_duration = 10;
    int64_t time_since_last_boot = 99999999;
    while (state.KeepRunning()) {
        android::util::stats_write(
                android::util::BOOT_SEQUENCE_REPORTED, reason, reason,
                boot_end_time, total_duration, bootloader_duration, time_since_last_boot);
        total_duration++;
    }
}
BENCHMARK(BM_StatsWrite);

}  //  namespace statsd
}  //  namespace os
}  //  namespace android