xref: /aosp_15_r20/hardware/interfaces/tests/msgq/1.0/IBenchmarkMsgQ.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2016 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerinterface IBenchmarkMsgQ {
20*4d7e907cSAndroid Build Coastguard Worker    /**
21*4d7e907cSAndroid Build Coastguard Worker     * This method requests the service to set up Synchronous read/write
22*4d7e907cSAndroid Build Coastguard Worker     * wait-free FMQ with the client as reader.
23*4d7e907cSAndroid Build Coastguard Worker     * @return ret Will be true if the setup was successful, false otherwise.
24*4d7e907cSAndroid Build Coastguard Worker     * @return mqDescIn This structure describes the FMQ that was set up
25*4d7e907cSAndroid Build Coastguard Worker     * by the service. Client can use it to set up the FMQ at its end.
26*4d7e907cSAndroid Build Coastguard Worker     */
27*4d7e907cSAndroid Build Coastguard Worker    configureClientInboxSyncReadWrite()
28*4d7e907cSAndroid Build Coastguard Worker        generates(bool ret, fmq_sync<uint8_t> mqDescIn);
29*4d7e907cSAndroid Build Coastguard Worker
30*4d7e907cSAndroid Build Coastguard Worker    /**
31*4d7e907cSAndroid Build Coastguard Worker     * This method requests the service to set up Synchronous read/write
32*4d7e907cSAndroid Build Coastguard Worker     * wait-free FMQ with the client as writer.
33*4d7e907cSAndroid Build Coastguard Worker     * @return ret Will be true if the setup was successful, false otherwise.
34*4d7e907cSAndroid Build Coastguard Worker     * @return mqDescOut This structure describes the FMQ that was set up
35*4d7e907cSAndroid Build Coastguard Worker     * by the service. Client can use it to set up the FMQ at its end.
36*4d7e907cSAndroid Build Coastguard Worker     */
37*4d7e907cSAndroid Build Coastguard Worker    configureClientOutboxSyncReadWrite()
38*4d7e907cSAndroid Build Coastguard Worker        generates(bool ret, fmq_sync<uint8_t> mqDescOut);
39*4d7e907cSAndroid Build Coastguard Worker
40*4d7e907cSAndroid Build Coastguard Worker    /**
41*4d7e907cSAndroid Build Coastguard Worker     * This method request the service to write into the FMQ.
42*4d7e907cSAndroid Build Coastguard Worker     * @param count Number to messages to write.
43*4d7e907cSAndroid Build Coastguard Worker     * @return ret Will be true if the write operation was successful,
44*4d7e907cSAndroid Build Coastguard Worker     * false otherwise.
45*4d7e907cSAndroid Build Coastguard Worker     */
46*4d7e907cSAndroid Build Coastguard Worker    requestWrite(int32_t count) generates (bool ret);
47*4d7e907cSAndroid Build Coastguard Worker
48*4d7e907cSAndroid Build Coastguard Worker    /**
49*4d7e907cSAndroid Build Coastguard Worker     * This method request the service to read from the FMQ.
50*4d7e907cSAndroid Build Coastguard Worker     * @param count Number to messages to read.
51*4d7e907cSAndroid Build Coastguard Worker     * @ret Will be true if the read operation was successful, false otherwise.
52*4d7e907cSAndroid Build Coastguard Worker     */
53*4d7e907cSAndroid Build Coastguard Worker    requestRead(int32_t count) generates (bool ret);
54*4d7e907cSAndroid Build Coastguard Worker
55*4d7e907cSAndroid Build Coastguard Worker    /**
56*4d7e907cSAndroid Build Coastguard Worker     * This method kicks off a benchmarking experiment where
57*4d7e907cSAndroid Build Coastguard Worker     * the client writes a message into its outbox FMQ,
58*4d7e907cSAndroid Build Coastguard Worker     * the service reads it and writes it into the client's
59*4d7e907cSAndroid Build Coastguard Worker     * inbox FMQ and the client reads the message.
60*4d7e907cSAndroid Build Coastguard Worker     * The average time taken for the experiment is measured.
61*4d7e907cSAndroid Build Coastguard Worker     * @param numIter The number of iterations to run the experiment.
62*4d7e907cSAndroid Build Coastguard Worker     */
63*4d7e907cSAndroid Build Coastguard Worker    benchmarkPingPong(uint32_t numIter);
64*4d7e907cSAndroid Build Coastguard Worker
65*4d7e907cSAndroid Build Coastguard Worker    /**
66*4d7e907cSAndroid Build Coastguard Worker     * This method kicks off a benchmarking experiment where
67*4d7e907cSAndroid Build Coastguard Worker     * the service writes into an FMQ and the client reads the same.
68*4d7e907cSAndroid Build Coastguard Worker     * @param numIter The number of iterations to run the experiment.
69*4d7e907cSAndroid Build Coastguard Worker     */
70*4d7e907cSAndroid Build Coastguard Worker    benchmarkServiceWriteClientRead(uint32_t numIter);
71*4d7e907cSAndroid Build Coastguard Worker
72*4d7e907cSAndroid Build Coastguard Worker    /**
73*4d7e907cSAndroid Build Coastguard Worker     * This method sends a vector of time duration(in ns).
74*4d7e907cSAndroid Build Coastguard Worker     * @param timeData vector of time instants measured by client.
75*4d7e907cSAndroid Build Coastguard Worker     * Each entry is the number of ns between the epoch and a
76*4d7e907cSAndroid Build Coastguard Worker     * std::chrono::time_point.
77*4d7e907cSAndroid Build Coastguard Worker     */
78*4d7e907cSAndroid Build Coastguard Worker    sendTimeData(vec<int64_t> timeData);
79*4d7e907cSAndroid Build Coastguard Worker};
80