summaryrefslogtreecommitdiff
path: root/scripts/stackdelta
blob: 44d2dfd6216fdb092b9a1dd221b9756b79b0fad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0

# Read two files produced by the stackusage script, and show the
# delta between them.
#
# Currently, only shows changes for functions listed in both files. We
# could add an option to show also functions which have vanished or
# appeared (which would often be due to gcc making other inlining
# decisions).
#
# Another possible option would be a minimum absolute value for the
# delta.
#
# A third possibility is for sorting by delta, but that can be
# achieved by piping to sort -k5,5g.

sub read_stack_usage_file {
    my %su;
    my $f = shift;
    open(my $fh, '<', $f)
	or die "cannot open $f: $!";
    while (<$fh>) {
	chomp;
	my ($file, $func, $size, $type) = split;
	# Old versions of gcc (at least 4.7) have an annoying quirk in
	# that a (static) function whose name has been changed into
	# for example ext4_find_unwritten_pgoff.isra.11 will show up
	# in the .su file with a name of just "11". Since such a
	# numeric suffix is likely to change across different
	# commits/compilers/.configs or whatever else we're trying to
	# tweak, we can't really track those functions, so we just
	# silently skip them.
	#
	# Newer gcc (at least 5.0) report the full name, so again,
	# since the suffix is likely to change, we strip it.
	next if $func =~ m/^[0-9]+$/;
	$func =~ s/\..*$//;
	# Line numbers are likely to change; strip those.
	$file =~ s/:[0-9]+$//;
	$su{"${file}\t${func}"} = {size => $size, type => $type};
    }
    close($fh);
    return \%su;
}

@ARGV == 2
    or die "usage: $0 <old> <new>";

my $old = read_stack_usage_file($ARGV[0]);
my $new = read_stack_usage_file($ARGV[1]);
my @common = sort grep {exists $new->{$_}} keys %$old;
for (@common) {
    my $x = $old->{$_}{size};
    my $y = $new->{$_}{size};
    my $delta = $y - $x;
    if ($delta) {
	printf "%s\t%d\t%d\t%+d\n", $_, $x, $y, $delta;
    }
}
nd 2018-07-21ARM: qcom_defconfig: Enable QCOM NAND related configsAbhishek Sahu 2017-12-21ARM: qcom_defconfig: Enable Frambuffer console supportSrinivas Kandagatla 2017-12-21ARM: qcom_defconfig: enable MSM IOMMU for displaySrinivas Kandagatla 2017-12-21ARM: qcom_defconfig: Enable DRM for 8064 displaySrinivas Kandagatla 2017-10-11ARM: qcom_defconfig: Enable Z2 Tablet related optionsBjorn Andersson 2017-10-11ARM: qcom_defconfig: Disable DEBUG_GPIOBjorn Andersson 2017-10-11ARM: qcom_defconfig: Enable configs for USB on apq8064/msm8974Stephen Boyd 2017-10-11ARM: qcom_defconfig: Resync with new Kconfig optionsBjorn Andersson 2017-07-18ARM: qcom_defconfig: Cleanup from non-existing optionsKrzysztof Kozlowski 2017-06-29Merge tag 'qcom-defconfig-for-4.13-2' of git://git.kernel.org/pub/scm/linux/k...Arnd Bergmann 2017-06-23ARM: qcom_defconfig: enable RPMSG_QCOM_SMDBhushan Shah 2017-06-23Merge tag 'samsung-defconfig-4.13-2' of git://git.kernel.org/pub/scm/linux/ke...Arnd Bergmann 2017-06-10ARM: defconfig: Cleanup from old Kconfig optionsKrzysztof Kozlowski 2017-06-05ARM: qcom_defconfig: Enable IPQ4019 clock and pinctrlAbhishek Sahu 2017-03-28ARM: qcom_defconfig: Enable Qualcomm remoteproc and related driversJonathan Neuschäfer 2017-01-13ARM: defconfig: qcom: add APQ8060 DragonBoard devicesLinus Walleij 2017-01-13ARM: qcom_defconfig: enable thermal sensorsSrinivas Kandagatla 2017-01-13ARM: qcom_defconfig: add ahci configsSrinivas Kandagatla 2017-01-13ARM: qcom_defconfig: add pcie and atl1c ethernet configsSrinivas Kandagatla 2017-01-13ARM: qcom_defconfig: add usb related configsSrinivas Kandagatla 2017-01-13ARM: qcom_defconfig: Enable RPM/RPM-SMD clocksGeorgi Djakov 2016-12-15Merge tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git...Linus Torvalds 2016-11-21mfd: qcom-pm8xxx: Clean up PM8XXX namespaceLinus Walleij 2016-10-24ARM: qcom_defconfig: Fix MDM9515 LCC and GCC configNeil Armstrong 2016-06-27ARM: configs: qualcomm: Add MDM9615 missing defconfigsNeil Armstrong 2016-06-24ARM: defconfig: enable the MSM8660 pin controllerLinus Walleij 2015-12-16ARM: defconfig: qcom: Enable SSBI driversStephen Boyd 2015-12-16ARM: defconfig: Update qcom_defconfigBjorn Andersson 2015-12-08ARM: qcom_defconfig: Enable HAVE_ARM_ARCH_TIMERStephen Boyd 2015-10-08ARM: qcom_defconfig: Enable SMD-RPM regulatorsAndy Gross 2015-07-24ARM: qcom_defconfig: Enable options for KS8851 ethernetStephen Boyd 2015-04-28ARM: config: Update qcom_defconfig to enable cpuidleLina Iyer 2015-03-25ARM: qcom: Increase MMC_BLOCK_MINORS in defconfigGeorgi Djakov 2015-03-16arm: qcom: Update defconfigStephen Boyd 2015-03-16arm: qcom: Enable lpass clock driver in defconfigRajendra Nayak