Re: Average instruction length in x86-built kernel?

From: Jan Engelhardt
Date: Mon Aug 01 2005 - 01:27:49 EST



>> Here's a script that does what I was looking for:
><snip>

Mmmmh, perlgolf?

>#!/bin/bash
>for a in "$@"
>do
> objdump -d "$a" -j .text
>done | perl -ne'
>BEGIN{%h=();$b=0};
>END{if($b){$h{$b}++};print map("$_: $h{$_}\n", sort(keys(%h)))};
>if(/\tnop $/){$h{nop}++}
>elsif(/^[\s0-9a-f]{8}:\t([^\t]+) (\t?)/){
> $b+=split(" ",$1);if($2){$h{$b}++;$b=0}}'

objdump -j .text -d "$@" | perl -ne '
END{$h{$b}++if$b;print map"$_: $h{$_}\n",sort keys%h};
if(/\tnop\s*$/){$h{nop}++}
elsif(/^.*?:\t([^\t]+) (\t?)/){
$b+=split/ /,$1;if($2){$h{$b}++;$b=0}}'



Jan Engelhardt
--
| Alphagate Systems, http://alphagate.hopto.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/