• Home
  • History
  • Annotate
  • only in /system/extras/perfprofd/tests/
NameDateSize

..11-Jun-20184 KiB

Android.bp11-Jun-2018918

AndroidTest.xml11-Jun-20181.4 KiB

callchain.canned.perf.data11-Jun-2018250.4 KiB

canned.perf.data11-Jun-20181.3 MiB

perfprofd_test.cc11-Jun-201828.7 KiB

perfprofdmockutils.cc11-Jun-20182.2 KiB

perfprofdmockutils.h11-Jun-2018974

README.txt11-Jun-20182 KiB

README.txt

1Native tests for 'perfprofd'. Please run with
2
3   runtest --path=system/extras/perfprofd/tests
4
5(where runtest == $ANDROID_BUILD_TOP"/development/testrunner/runtest.py).
6
7Notes:
8
91. Several of the testpoints in this unit tests perform a live 'simpleperf'
10run on the device (if you are using a userdebug build, simpleperf should
11already be available in /system/xbin/simpleperf).
12
132. Part of the test is a system-wide profile, meaning that you will
14need to run 'adb root' prior to test execution.
15
163. The daemon under test, perfprofd, is broken into a main function, a
17"core" library, and a "utils library. Picture:
18
19	+-----------+   perfprofdmain.o
20	| perfprofd |
21	| main()    |   1-liner; calls perfprofd_main()
22	+-----------+
23	   |
24	   v
25	+-----------+   perfprofdcore.a
26	| perfprofd |
27	| core      |   most of the interesting code is here;
28	|           |   calls into utils library when for
29	+-----------+   operations such as sleep, log, etc
30	   |
31	   v
32	+-----------+   perfprofdutils.a
33	| perfprofd |
34	| utils     |   real implementations of perfprofd_sleep,
35	|           |   perfprofd_log_* etc
36	+-----------+
37
38Because the daemon tends to spend a lot of time sleeping/waiting,
39it is impractical to try to test it directly. Instead we insert a
40mock utilities layer and then have a test driver that invokes the
41daemon main function. Picture for perfprofd_test:
42
43	+----------------+   perfprofd_test.cc
44	| perfprofd_test |
45	|                |   makes calls into perfprofd_main(),
46	+----------------+   then verifies behavior
47	   |
48	   v
49	+-----------+   perfprofdcore.a
50	| perfprofd |
51	| core      |   same as above
52	+-----------+
53	   |
54	   v
55	+-----------+   perfprofdmockutils.a
56	| perfprofd |
57	| mockutils |   mock implementations of perfprofd_sleep,
58	|           |   perfprofd_log_* etc
59	+-----------+
60
61The mockup versions of perfprofd_sleep() and  perfprofd_log_* do
62simply log the fact that they are called; the test driver can
63then examine the log to make sure that the daemon is doing
64what it is supposed to be doing.
65