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 Worker//import IFoo; 20*4d7e907cSAndroid Build Coastguard Worker 21*4d7e907cSAndroid Build Coastguard Workerinterface IFooCallback { 22*4d7e907cSAndroid Build Coastguard Worker //heyItsMe(IFoo cb); 23*4d7e907cSAndroid Build Coastguard Worker heyItsYou(IFooCallback cb); 24*4d7e907cSAndroid Build Coastguard Worker heyItsYouIsntIt(IFooCallback cb) generates (bool yesOrNo); 25*4d7e907cSAndroid Build Coastguard Worker oneway heyItsTheMeaningOfLife(uint8_t tmol); 26*4d7e907cSAndroid Build Coastguard Worker 27*4d7e907cSAndroid Build Coastguard Worker // The next two methods are for instrumentation purposes. 28*4d7e907cSAndroid Build Coastguard Worker 29*4d7e907cSAndroid Build Coastguard Worker // Block the caller for up to ns nanosesonds and return the number 30*4d7e907cSAndroid Build Coastguard Worker // of nanoseconds it took to invoke each of the three methods 31*4d7e907cSAndroid Build Coastguard Worker // above, both from the point of view of the caller (callerBlockedNs) and 32*4d7e907cSAndroid Build Coastguard Worker // from the point of view of IFooCallback itself (timeNs). timeNs measures 33*4d7e907cSAndroid Build Coastguard Worker // how long a method's body took to execute, regardless of whether the 34*4d7e907cSAndroid Build Coastguard Worker // method was oneway or two-way. callerBlockedNs reflects the amount of 35*4d7e907cSAndroid Build Coastguard Worker // time the caller was blocked before the method returned. For two-way 36*4d7e907cSAndroid Build Coastguard Worker // methods, callerBlockedNs should be slightly higher than timeNs. For 37*4d7e907cSAndroid Build Coastguard Worker // one-way calls, callerBlockedNs will be very low, and unrelated to 38*4d7e907cSAndroid Build Coastguard Worker // timeNs. 39*4d7e907cSAndroid Build Coastguard Worker 40*4d7e907cSAndroid Build Coastguard Worker struct InvokeInfo { 41*4d7e907cSAndroid Build Coastguard Worker bool invoked; 42*4d7e907cSAndroid Build Coastguard Worker int64_t callerBlockedNs; 43*4d7e907cSAndroid Build Coastguard Worker int64_t timeNs; 44*4d7e907cSAndroid Build Coastguard Worker }; 45*4d7e907cSAndroid Build Coastguard Worker reportResults(int64_t ns) generates (int64_t leftNs, InvokeInfo[3] invokeInfo); 46*4d7e907cSAndroid Build Coastguard Worker 47*4d7e907cSAndroid Build Coastguard Worker // This method is used by the caller of IFooCallback to tell IFooCallback 48*4d7e907cSAndroid Build Coastguard Worker // how long the three methods above took, from the point of view of that 49*4d7e907cSAndroid Build Coastguard Worker // caller. IFooCallback adds this information to the one reported by 50*4d7e907cSAndroid Build Coastguard Worker // reportResults in InvokeInfo. 51*4d7e907cSAndroid Build Coastguard Worker 52*4d7e907cSAndroid Build Coastguard Worker youBlockedMeFor(int64_t[3] callerBlockedInfo); 53*4d7e907cSAndroid Build Coastguard Worker}; 54