• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

Android.bpD22-Nov-2023798 4337

Android.mkD22-Nov-2023672 2615

README.txtD22-Nov-20232 KiB6554

callchain.canned.perf.dataD22-Nov-2023250.4 KiB

canned.perf.dataD22-Nov-20231.3 MiB

perfprofd_test.ccD22-Nov-202328.7 KiB875593

perfprofdmockutils.ccD22-Nov-20232.2 KiB10773

perfprofdmockutils.hD22-Nov-2023974 323

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