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

Commit 8aae2839 authored by Chirag Pathak's avatar Chirag Pathak
Browse files

Implementing KeyMint performance/benchmark tests.

Test: run VtsAidlKeyMintBenchmarkTest in the adb shell
Bug: b/171287439

Change-Id: I70b2b2a3a1b6707088706326a5fd4a36d1065f5d
parent c3325707
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2021 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.
//

cc_benchmark {
    name: "VtsAidlKeyMintBenchmarkTest",
    defaults: [
        "VtsHalTargetTestDefaults",
        "use_libaidlvintf_gtest_helper_static",
    ],
    srcs: [
        "KeyMintBenchmark.cpp",
    ],
    shared_libs: [
        "libbinder_ndk",
        "libcrypto",
        "libkeymint",
        "libkeymint_support",
    ],
    static_libs: [
        "android.hardware.security.keymint-V1-ndk_platform",
        "android.hardware.security.secureclock-V1-ndk_platform",
        "libcppbor_external",
        "libchrome",
    ],
}
+714 −0

File added.

Preview size limit exceeded, changes collapsed.

+28 −0
Original line number Diff line number Diff line
# KeyMint Benchmark

The KeyMint Benchmark is a standalone tool for measuring the performance of
 KeyMint implementations.

## Building

Build:
`m  VtsAidlKeyMintBenchmarkTest`

Transfer to device/emulator:
`adb sync data`

The benchmark executable will be located at
 `data/benchmarktest/VtsAidlKeyMintBenchmarkTest` on the device.

## Usage

KeyMint Benchmark is built on [Google microbenchmark
library](https://github.com/google/benchmark). All of the commandline arguments
provided by the microbenchmark library are valid, such as
`--benchmark_filter=<regex>` or `benchmark_out_format={json|console|csv}`.
In addition to the command line arguments provided by microbenchmark,
`--service_name=<service_name>` is provided to allow specification of the KeyMint
fully qualified service name, e.g. specify
`--service_name=android.hardware.security.keymint.IKeyMintDevice/default` to
benchmark default implementation of KeyMint.