• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /**
31      * Measures the write rate for writing the given file, creating the file if necessary
32      *
33      * @return The write rate in MB/s.
34      */
measureWriteRate(String filename, long size_bytes)35     double measureWriteRate(String filename, long size_bytes);
36 
37     /** Returns an entry from /proc/meminfo. */
getMemInfoEntry(String name)38     long getMemInfoEntry(String name);
39 
40     /** Allocates anonymous memory and returns the raw pointer. */
allocAnonMemory(long mb)41     long allocAnonMemory(long mb);
42 
43     /**
44      * Initializes the vsock server on VM.
45      * @return the server socket file descriptor.
46      */
initVsockServer(int port)47     int initVsockServer(int port);
48 
49     /** Runs the vsock server on VM and receives data. */
runVsockServerAndReceiveData(int serverFd, int numBytesToReceive)50     void runVsockServerAndReceiveData(int serverFd, int numBytesToReceive);
51 }
52