Re: Average instruction length in x86-built kernel?

From: David Weinehall
Date: Mon Aug 01 2005 - 02:38:59 EST


On Sat, Jul 30, 2005 at 03:57:25PM -0400, Karim Yaghmour wrote:
[snip]
> # Remove non-instruction lines:
> sed /^[^c].*/d $2-dissassembled-kernel > $2-stage-1
>
> # Remove empty lines:
> sed /^'\t'*$/d $2-stage-1 > $2-stage-2
>
> # Remove function names:
> sed /^c[0-9,a-f]*' '\<.*\>:$/d $2-stage-2 > $2-stage-3
>
> # Remove addresses:
> sed s/^c[0-9,a-f]*:'\t'// $2-stage-3 > $2-stage-4
>
> # Remove instruction text:
> sed s/'\t'.*// $2-stage-4 > $2-stage-5
>
> # Remove trailing whitespace:
> sed s/'\s'*$// $2-stage-5 > $2-stage-6

Uhm, you do know that sed allows you to execute several commands after
eachother, right?

sed -e 's/foo/bar/;s/baz/omph/'

That way you should be able to save a few stages.
Also, your script is, as far as I could see, a clean sh-script;
no need for /bin/bash; use /bin/sh instead.


Regards: David Weinehall
--
/) David Weinehall <tao@xxxxxxxxxx> /) Northern lights wander (\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\) http://www.acc.umu.se/~tao/ (/ Full colour fire (/
-
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/