Bumping manifests a=b2g-bump
[gecko.git] / tools / footprint / linear-regression.awk
blob9d38f5c6108656f982e93aa901ebd1aa1b65d4df
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 function regress(DATAPOINTS,SX,SY,SXY,SX2)
7 b1 = (DATAPOINTS * SXY - SX * SY) / (DATAPOINTS * SX2 - SX * SX);
8 b0 = (SY - b1 * SX ) / DATAPOINTS;
9 return b1 " * x + " b0;
12 BEGIN {
13 if (!Skip) Skip = 0;
14 if (Interval)
16 Count = 0;
17 IntervalCount = 0;
21 NR>Skip {
22 sx += $1;
23 sy += $2;
24 sxy += $1 * $2;
25 sx2 += $1 * $1;
26 #print NR " " sx " " sy " " sxy " " sx2
28 if (Interval)
30 if(Count == Interval-1)
32 IntervalCount += 1;
34 print NR-Count, "-", NR, ": ", regress(Count,isx,isy,isxy,isx2);
36 Count = 0;
37 isx = 0;
38 isy = 0;
39 isxy = 0;
40 isx2 = 0;
42 else
44 Count += 1;
45 isx += $1;
46 isy += $2;
47 isxy += $1 * $2;
48 isx2 += $1 * $1;
53 END {
54 if(Interval) {
55 print NR-Count, "-", NR, ": ", regress(Count,isx,isy,isxy,isx2);
57 print regress(NR-Skip, sx, sy, sxy, sx2);