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

Commit ae119af5 authored by Paul Duffin's avatar Paul Duffin Committed by Gerrit Code Review
Browse files

Merge "Switch to the latest version of Caliper"

parents 9f6a2ae6 76a6cec9
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
# -*- mode: makefile -*-
# Copyright (C) 2015 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.

LOCAL_PATH:= $(call my-dir)

# build framework base core benchmarks
# ============================================================

include $(CLEAR_VARS)
LOCAL_MODULE := frameworks-base-core-benchmarks
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_SRC_FILES := $(call all-java-files-under, src/)
LOCAL_NO_STANDARD_LIBRARIES := true

LOCAL_JAVA_LIBRARIES := \
  caliper-api-target \
  framework

include $(BUILD_JAVA_LIBRARY)
+3 −5
Original line number Diff line number Diff line
@@ -16,10 +16,10 @@

package android.net;

import com.google.caliper.BeforeExperiment;
import com.google.caliper.Param;
import com.google.caliper.SimpleBenchmark;

public class NetworkStatsBenchmark extends SimpleBenchmark {
public class NetworkStatsBenchmark {
    private static final String UNDERLYING_IFACE = "wlan0";
    private static final String TUN_IFACE = "tun0";
    private static final int TUN_UID = 999999999;
@@ -28,10 +28,8 @@ public class NetworkStatsBenchmark extends SimpleBenchmark {
    private int mSize;
    private NetworkStats mNetworkStats;

    @Override
    @BeforeExperiment
    protected void setUp() throws Exception {
        super.setUp();

        mNetworkStats = new NetworkStats(0, mSize + 2);
        int uid = 0;
        NetworkStats.Entry recycle = new NetworkStats.Entry();
+1 −3
Original line number Diff line number Diff line
@@ -16,9 +16,7 @@

package android.net;

import com.google.caliper.SimpleBenchmark;

public class TrafficStatsBenchmark extends SimpleBenchmark {
public class TrafficStatsBenchmark {
    public void timeGetUidRxBytes(int reps) {
        for (int i = 0; i < reps; i++) {
            TrafficStats.getUidRxBytes(android.os.Process.myUid());
+5 −5
Original line number Diff line number Diff line
@@ -16,10 +16,11 @@

package android.os;

import com.google.caliper.AfterExperiment;
import com.google.caliper.BeforeExperiment;
import com.google.caliper.Param;
import com.google.caliper.SimpleBenchmark;

public class ParcelArrayBenchmark extends SimpleBenchmark {
public class ParcelArrayBenchmark {

    @Param({ "1", "10", "100", "1000" })
    private int mSize;
@@ -34,7 +35,7 @@ public class ParcelArrayBenchmark extends SimpleBenchmark {
    private Parcel mIntParcel;
    private Parcel mLongParcel;

    @Override
    @BeforeExperiment
    protected void setUp() {
        mWriteParcel = Parcel.obtain();

@@ -50,7 +51,7 @@ public class ParcelArrayBenchmark extends SimpleBenchmark {
        mLongParcel.writeLongArray(mLongArray);
    }

    @Override
    @AfterExperiment
    protected void tearDown() {
        mWriteParcel.recycle();
        mWriteParcel = null;
@@ -118,5 +119,4 @@ public class ParcelArrayBenchmark extends SimpleBenchmark {
            mLongParcel.readLongArray(mLongArray);
        }
    }

}
+5 −4
Original line number Diff line number Diff line
@@ -16,18 +16,19 @@

package android.os;

import com.google.caliper.SimpleBenchmark;
import com.google.caliper.AfterExperiment;
import com.google.caliper.BeforeExperiment;

public class ParcelBenchmark extends SimpleBenchmark {
public class ParcelBenchmark {

    private Parcel mParcel;

    @Override
    @BeforeExperiment
    protected void setUp() {
        mParcel = Parcel.obtain();
    }

    @Override
    @AfterExperiment
    protected void tearDown() {
        mParcel.recycle();
        mParcel = null;
Loading