Home | History | Annotate | only in /frameworks/base/tests/ActivityManagerPerfTests
Up to higher level directory
NameDateSize
README.txt21-Aug-20182.8K
test-app/21-Aug-2018
tests/21-Aug-2018
utils/21-Aug-2018

README.txt

      1 ActivityManagerPerfTests
      2 
      3 Performance tests for various ActivityManager components, e.g. Services, Broadcasts
      4 * These are only for tests that don't require a target package to test against
      5 * Self-contained perf tests should go in frameworks/base/apct-tests/perftests
      6 
      7 Command to run tests
      8 * atest -v ActivityManagerPerfTests
      9 
     10 Overview
     11 * The numbers we are trying to measure are end-to-end numbers
     12   * For example, the time it takes from sending an Intent to start a Service
     13     to the time the Service runs its callbacks
     14 * System.nanoTime() is monotonic and consistent between processes, so we use that for measuring time
     15 * If the test app is involved, it will measure the time and send it back to the instrumentation test
     16   * The time is sent back through a Binder interface in the Intent with the help of Utils.sendTime()
     17   * Each sent time is tagged with an id since there can be multiple events that send back a time
     18 * Each test will run multiple times to account for variation in test runs
     19 
     20 Structure
     21 * tests
     22   * Instrumentation test which runs the various performance tests and reports the results
     23 * test-app
     24   * Target package which contains the Services, BroadcastReceivers, etc. to test against
     25   * Sends the time it measures back to the test package
     26 * utils
     27   * Utilities that both the instrumentation test and test app can use
     28 
     29 Adding tests
     30 * Example
     31   * Look at tests/src/com/android/frameworks/perftests/am/BroadcastPerfTest and
     32     test-app/src/com/android/frameworks/perftests/amteststestapp/TestBroadcastReceiver
     33     for simple examples using this framework
     34 * Steps
     35   * Add any components you will test against in the target package under
     36     test-app/src/com/android/frameworks/perftests/amteststestapp/
     37   * Add the test class under tests/src/com/android/frameworks/perftests/am/tests/
     38     * The class should extend BasePerfTest
     39     * Each test should call runPerfFunction() returning the elapsed time for a single iteration
     40     * The test has access to a Context through mContext
     41   * If you are measuring the time elapsed of something that either starts or ends in the target
     42     package
     43     * The target package can report the time it measures through an ITimeReceiverCallback passed
     44       through an Intent through Utils.sendTime(intent, "tag")
     45       (or however a Binder needs to be passed to the target package)
     46     * The instrumentation test can collect that time by calling getReceivedTimeNs("tag") and
     47       calculate the elapsed time
     48     * Each timestamp sent to the instrumentation test is tagged with a tag since multiple timestamps
     49       can be reported in an iteration
     50   * If the target package should be running before your test logic starts, add startTargetPackage();
     51     at the beginning of the iteration
     52 
     53 * Reporting
     54   * Look at internal documentation for how to add new tests to dashboards and receive notification
     55     on regressions
     56