1 /* 2 * Copyright 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.microdroid.testservice; 18 19 /** {@hide} */ 20 interface IBenchmarkService { 21 const int PORT = 5677; 22 23 /** 24 * Measures the read rate for reading the given file. 25 * 26 * @return The read rate in MB/s. 27 */ measureReadRate(String filename, boolean isRand)28 double measureReadRate(String filename, boolean isRand); 29 30 /** Returns an entry from /proc/meminfo. */ getMemInfoEntry(String name)31 long getMemInfoEntry(String name); 32 33 /** Allocates anonymous memory and returns the raw pointer. */ allocAnonMemory(long mb)34 long allocAnonMemory(long mb); 35 36 /** 37 * Initializes the vsock server on VM. 38 * @return the server socket file descriptor. 39 */ initVsockServer(int port)40 int initVsockServer(int port); 41 42 /** Runs the vsock server on VM and receives data. */ runVsockServerAndReceiveData(int serverFd, int numBytesToReceive)43 void runVsockServerAndReceiveData(int serverFd, int numBytesToReceive); 44 } 45