2016-08-30 20:27:56 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 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.
|
|
|
|
*/
|
|
|
|
|
2016-08-11 21:52:43 +02:00
|
|
|
package android.hardware.tests.foo@1.0;
|
|
|
|
|
2016-08-14 08:05:56 +02:00
|
|
|
//import IFoo;
|
|
|
|
|
2016-08-11 21:52:43 +02:00
|
|
|
interface IFooCallback {
|
2016-08-14 08:05:56 +02:00
|
|
|
//heyItsMe(IFoo cb);
|
|
|
|
heyItsYou(IFooCallback cb);
|
2016-08-14 22:37:02 +02:00
|
|
|
heyItsYouIsntIt(IFooCallback cb) generates (bool yesOrNo);
|
2016-08-14 08:05:56 +02:00
|
|
|
oneway heyItsTheMeaningOfLife(uint8_t tmol);
|
android.hardware.tests.foo@1.0::IFooCallback: add instrumentation
Add two instrumentation methods to IFooCallback, to help with timing
measurements in gTest.
The first one, reportResults(), blocks the caller for a given length of
time while waiting for all the other methods to execute, then reports
whether these methods were executed within this length of time, for how
long their caller was blocked, and also how long the execution of the
bodies of each of them took. Note that the execution time for a
method's body is independent of whether it is a oneway or a blocking
method. For example, heyItsTheMeaningOfLife() is a oneway method, so it
returns immediately to the caller (so the caller-blocked time should be
very small). However, if its body takes several seconds to run, then
this is the information that will be returned for
heyItsTheMeaningOfLife() as well.
The second instrumentation method, youBlockedMeFor(), is used by the
caller of IFooCallback to report how long the caller was blocked for.
This information is saved and passed by reportResults() as described
above.
b/30855757 Convert hidl test to gTest
Change-Id: I35ac708e424bcb143fce959609fcc747f1ec37fb
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-08-21 01:44:50 +02:00
|
|
|
|
|
|
|
// The next two methods are for instrumentation purposes.
|
|
|
|
|
|
|
|
// Block the caller for up to ns nanosesonds and return the number
|
|
|
|
// of nanoseconds it took to invoke each of the three methods
|
|
|
|
// above, both from the point of view of the caller (callerBlockedNs) and
|
|
|
|
// from the point of view of IFooCallback itself (timeNs). timeNs measures
|
|
|
|
// how long a method's body took to execute, regardless of whether the
|
|
|
|
// method was oneway or two-way. callerBlockedNs reflects the amount of
|
|
|
|
// time the caller was blocked before the method returned. For two-way
|
|
|
|
// methods, callerBlockedNs should be slightly higher than timeNs. For
|
|
|
|
// one-way calls, callerBlockedNs will be very low, and unrelated to
|
|
|
|
// timeNs.
|
|
|
|
|
|
|
|
struct InvokeInfo {
|
|
|
|
bool invoked;
|
|
|
|
int64_t callerBlockedNs;
|
|
|
|
int64_t timeNs;
|
|
|
|
};
|
|
|
|
reportResults(int64_t ns) generates (int64_t leftNs, InvokeInfo[3] invokeInfo);
|
|
|
|
|
|
|
|
// This method is used by the caller of IFooCallback to tell IFooCallback
|
|
|
|
// how long the three methods above took, from the point of view of that
|
|
|
|
// caller. IFooCallback adds this information to the one reported by
|
|
|
|
// reportResults in InvokeInfo.
|
|
|
|
|
|
|
|
youBlockedMeFor(int64_t[3] callerBlockedInfo);
|
2016-08-11 21:52:43 +02:00
|
|
|
};
|