#!/usr/bin/perl # 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; } } ref='/cgit.cgi/linux/net-next.git/tree/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>tree</a><a class='active' href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/sound/soc/codecs/max9877.c'> <input type='hidden' name='id' value='424414947da3dd5cb0d60e4f299f7c51e472ae77'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>soc</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>codecs</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>max9877.c</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='424414947da3dd5cb0d60e4f299f7c51e472ae77'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'> <tr><th>author</th><td>Greg Kroah-Hartman <gregkh@linuxfoundation.org></td><td class='right'>2017-02-03 22:19:15 +0100</td></tr> <tr><th>committer</th><td>Greg Kroah-Hartman <gregkh@linuxfoundation.org></td><td class='right'>2017-02-03 22:19:15 +0100</td></tr> <tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>424414947da3dd5cb0d60e4f299f7c51e472ae77</a> (<a href='/cgit.cgi/linux/net-next.git/patch/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>patch</a>)</td></tr> <tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>a4067480c4256c80ae8f8438a3e4bb88e32050bc</a> /<a href='/cgit.cgi/linux/net-next.git/tree/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>sound/soc/codecs/max9877.c</a></td></tr> <tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/max9877.c?id=a3683e0c1410c5c8136a7a93b0336ce88d3b893a'>a3683e0c1410c5c8136a7a93b0336ce88d3b893a</a> (<a href='/cgit.cgi/linux/net-next.git/diff/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77&id2=a3683e0c1410c5c8136a7a93b0336ce88d3b893a'>diff</a>)</td></tr><tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/max9877.c?id=d07830db1bdb254e4b50d366010b219286b8c937'>d07830db1bdb254e4b50d366010b219286b8c937</a> (<a href='/cgit.cgi/linux/net-next.git/diff/sound/soc/codecs/max9877.c?id=424414947da3dd5cb0d60e4f299f7c51e472ae77&id2=d07830db1bdb254e4b50d366010b219286b8c937'>diff</a>)</td></tr></table> <div class='commit-subject'>Merge tag 'usb-serial-4.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus</div><div class='commit-msg'>Johan writes: USB-serial fixes for v4.10-rc7 One more device ID for pl2303. Signed-off-by: Johan Hovold <johan@kernel.org> </div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=424414947da3dd5cb0d60e4f299f7c51e472ae77'>Diffstat</a> (limited to 'sound/soc/codecs/max9877.c')</div><table summary='diffstat' class='diffstat'>