blob: 65bd4a48f7f5bc7b7407e90d4c2abb32675bda53 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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
17package android.test;
18
19/**
20 * More complex interface performance for test cases.
Stephan Linznerb51617f2016-01-27 18:09:50 -080021 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022 * If you want your test to be used as a performance test, you must
23 * implement this interface.
24 */
Stephan Linznerb51617f2016-01-27 18:09:50 -080025@Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026public interface PerformanceTestCase
27{
28 /**
29 * Callbacks for {@link PerformanceTestCase}.
30 */
31 public interface Intermediates
32 {
33 void setInternalIterations(int count);
34 void startTiming(boolean realTime);
35 void addIntermediate(String name);
36 void addIntermediate(String name, long timeInNS);
37 void finishTiming(boolean realTime);
38 }
39
40 /**
Stephan Linznerb51617f2016-01-27 18:09:50 -080041 * Set up to begin performance tests. The 'intermediates' is a
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042 * communication channel to send back intermediate performance numbers --
43 * if you use it, you will probably want to ensure your test is only
44 * executed once by returning 1. Otherwise, return 0 to allow the test
45 * harness to decide the number of iterations.
Stephan Linznerb51617f2016-01-27 18:09:50 -080046 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047 * <p>If you return a non-zero iteration count, you should call
48 * {@link Intermediates#startTiming intermediates.startTiming} and
49 * {@link Intermediates#finishTiming intermediates.endTiming} to report the
50 * duration of the test whose performance should actually be measured.
Stephan Linznerb51617f2016-01-27 18:09:50 -080051 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052 * @param intermediates Callback for sending intermediate results.
Stephan Linznerb51617f2016-01-27 18:09:50 -080053 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080054 * @return int Maximum number of iterations to run, or 0 to let the caller
Stephan Linznerb51617f2016-01-27 18:09:50 -080055 * decide.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 */
57 int startPerformance(Intermediates intermediates);
Stephan Linznerb51617f2016-01-27 18:09:50 -080058
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080059 /**
60 * This method is used to determine what modes this test case can run in.
Stephan Linznerb51617f2016-01-27 18:09:50 -080061 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062 * @return true if this test case can only be run in performance mode.
63 */
64 boolean isPerformanceOnly();
65}
66