1*49cdfc7eSAndroid Build Coastguard Worker 2*49cdfc7eSAndroid Build Coastguard WorkerTEST SUITE: 3*49cdfc7eSAndroid Build Coastguard Worker 4*49cdfc7eSAndroid Build Coastguard WorkerThe directory cpuctl contains the tests related to the cpu controller. 5*49cdfc7eSAndroid Build Coastguard WorkerThere are total 10 testcases that have been added till date. 6*49cdfc7eSAndroid Build Coastguard WorkerMore testcases are expected to be added in future. 7*49cdfc7eSAndroid Build Coastguard Worker 8*49cdfc7eSAndroid Build Coastguard WorkerTESTS AIM: 9*49cdfc7eSAndroid Build Coastguard Worker 10*49cdfc7eSAndroid Build Coastguard WorkerThe aim of the tests is to test cpu controller functionality. 11*49cdfc7eSAndroid Build Coastguard Worker 12*49cdfc7eSAndroid Build Coastguard WorkerFILES DESCRIPTION: 13*49cdfc7eSAndroid Build Coastguard Worker 14*49cdfc7eSAndroid Build Coastguard Workercpuctl_testN.c 15*49cdfc7eSAndroid Build Coastguard Worker--------------- 16*49cdfc7eSAndroid Build Coastguard WorkerThese are the tasks to run for cpu controller testing. 17*49cdfc7eSAndroid Build Coastguard WorkerThe tasks have been automated in the sense that they can assign themselves to 18*49cdfc7eSAndroid Build Coastguard Workerthe appropriate group, can modify their group shares, can migrate etc. 19*49cdfc7eSAndroid Build Coastguard WorkerEach task runs for an interval TIME_INTERVAL seconds and reports the total time 20*49cdfc7eSAndroid Build Coastguard Workerit could run on all cpus in an interval of INTERVAL seconds. (for convinience 21*49cdfc7eSAndroid Build Coastguard Workercalculate cpu time is given in % and seconds both). 22*49cdfc7eSAndroid Build Coastguard WorkerA task can call a library routine from libcontrollers library to calculate 23*49cdfc7eSAndroid Build Coastguard Workertotal amount of shares of all the groups, total number of tasks in it's group etc. 24*49cdfc7eSAndroid Build Coastguard WorkerAnd thus a task knows what is the expected cpu time it should get to run. 25*49cdfc7eSAndroid Build Coastguard Worker 26*49cdfc7eSAndroid Build Coastguard WorkerAfter say n SETS it modifies it's parameters and again report the cpu 27*49cdfc7eSAndroid Build Coastguard Workerusage. 28*49cdfc7eSAndroid Build Coastguard WorkerMaximum effort has been used to reuse the code and keep total code size low. 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Workerparameters.sh 31*49cdfc7eSAndroid Build Coastguard Worker---------- 32*49cdfc7eSAndroid Build Coastguard WorkerThis file contains the functions which do setup for the test. It creates a 33*49cdfc7eSAndroid Build Coastguard Worker/dev/cpuctl directory, mounts cgroup filesystem on it with cpu. It then creates 34*49cdfc7eSAndroid Build Coastguard Workera number(n) of groups in /dev/cpuctl. The cleanup function does a complete cleanup 35*49cdfc7eSAndroid Build Coastguard Workerof the system. 36*49cdfc7eSAndroid Build Coastguard Worker(*However most of the error scenarios have been tested for a sane cleanup, still if 37*49cdfc7eSAndroid Build Coastguard Workersometime it is unable to do it justt manualy execute the commands written in cleanup 38*49cdfc7eSAndroid Build Coastguard Workerfunction) 39*49cdfc7eSAndroid Build Coastguard Worker 40*49cdfc7eSAndroid Build Coastguard Workerrun_cpuctl_test.sh 41*49cdfc7eSAndroid Build Coastguard Worker------------------ 42*49cdfc7eSAndroid Build Coastguard WorkerThis script creates different scenarios for cpu controller testing and fires (n) tasks 43*49cdfc7eSAndroid Build Coastguard Workerin different groups to run at the same time. It waits for the return status from 44*49cdfc7eSAndroid Build Coastguard Workertasks and reports test pass/fail accordingly. 45*49cdfc7eSAndroid Build Coastguard Worker 46*49cdfc7eSAndroid Build Coastguard WorkerMakefile 47*49cdfc7eSAndroid Build Coastguard Worker-------- 48*49cdfc7eSAndroid Build Coastguard Worker 49*49cdfc7eSAndroid Build Coastguard WorkerThe usual makefile for this directory 50*49cdfc7eSAndroid Build Coastguard Worker 51*49cdfc7eSAndroid Build Coastguard Worker$LTPROOT/output/cpuctl_resultsN.txt 52*49cdfc7eSAndroid Build Coastguard Worker-------------- 53*49cdfc7eSAndroid Build Coastguard WorkerThis file will be created to log the results once the test is run. It contains the test 54*49cdfc7eSAndroid Build Coastguard Workerresults which are numbers and following is a description which will help to understand 55*49cdfc7eSAndroid Build Coastguard Workerthe results. 56*49cdfc7eSAndroid Build Coastguard Worker 57*49cdfc7eSAndroid Build Coastguard WorkerThere are two common major expected outcomes of all the tests: 58*49cdfc7eSAndroid Build Coastguard Worker 59*49cdfc7eSAndroid Build Coastguard Worker1. A group should get cpu time in the same ratio as it's shares. 60*49cdfc7eSAndroid Build Coastguard Worker 61*49cdfc7eSAndroid Build Coastguard Worker2. This time should not change with the changes in share values while the ratio in those 62*49cdfc7eSAndroid Build Coastguard Worker values is same. 63*49cdfc7eSAndroid Build Coastguard Worker 64*49cdfc7eSAndroid Build Coastguard WorkerThe results file are straight forward to read. To keep things very simple just look at 65*49cdfc7eSAndroid Build Coastguard Workerthe two fields calc:- and exp:- in % as below: 66*49cdfc7eSAndroid Build Coastguard Worker 67*49cdfc7eSAndroid Build Coastguard WorkerCPU TIME{calc:- 60.01(s)i.e. 50.01(%) exp:- 50.00(%)} 68*49cdfc7eSAndroid Build Coastguard Worker 69*49cdfc7eSAndroid Build Coastguard WorkerPASS/FAIL CRITERIO: 70*49cdfc7eSAndroid Build Coastguard Worker================== 71*49cdfc7eSAndroid Build Coastguard WorkerA major difference in the two % values is a failure of cpu controller. 72*49cdfc7eSAndroid Build Coastguard WorkerAlso the difference between consecutive runs under similar conditions is fail. 73*49cdfc7eSAndroid Build Coastguard WorkerBecause of some feature which is not currently developed in kernel it is not 74*49cdfc7eSAndroid Build Coastguard Workerpossible to create an ideal scenario and hence the decision of PASS/FAIL is 75*49cdfc7eSAndroid Build Coastguard Workernot taken for all the tests at the moment. The statistics is generated in the 76*49cdfc7eSAndroid Build Coastguard Workerresults file and a quick look on it gives a proper understanding. 77*49cdfc7eSAndroid Build Coastguard Worker 78*49cdfc7eSAndroid Build Coastguard WorkerNOTE: In current scenario a variation of 1-3 % is acceptable. 79*49cdfc7eSAndroid Build Coastguard Worker 80*49cdfc7eSAndroid Build Coastguard WorkerREADME: 81*49cdfc7eSAndroid Build Coastguard Worker-------- 82*49cdfc7eSAndroid Build Coastguard WorkerThe one you have gone through. 83*49cdfc7eSAndroid Build Coastguard Worker 84