Re: [PATCH v2] coccicheck: add parallel execution

From: Nicolas Palix
Date: Wed Jul 27 2011 - 02:18:52 EST


On Wed, Jul 27, 2011 at 12:36 AM, Greg Dietsche
<Gregory.Dietsche@xxxxxxx> wrote:
> For example to process 6 SmPL patches at the same time:
> Â Â Â Âmake coccicheck PARALLEL=6
>
> Results are held in /tmp until the scripts finish. By doing this the
> script is able to collate the results from each SmPL patch instead of
> interleaving them in the output.
>
> Version 2: change pkill -P $$ to pkill -s 0
>
> Signed-off-by: Greg Dietsche <Gregory.Dietsche@xxxxxxx>
Acked-by: Nicolas Palix <npalix.work@xxxxxxxxx>
> ---
> Âscripts/coccicheck | Â 27 ++++++++++++++++++++++++++-
> Â1 files changed, 26 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 1bb1a1b..c2a04c2 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -97,10 +97,35 @@ coccinelle () {
>
> Â}
>
> +parallel_cleanup () {
> + Â Â Â pkill -s 0 > /dev/null
> + Â Â Â rm /tmp/cocci_parallel_$$_* 2>/dev/null
> + Â Â Â exit
> +}
> +
> +trap parallel_cleanup SIGINT
> +PARALLEL_ID=0
> +
> Âif [ "$COCCI" = "" ] ; then
> Â Â for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
> - Â Â Â coccinelle $f
> + Â Â Â if [ "$PARALLEL" -eq "$PARALLEL" 2>/dev/null ] ; then
> + Â Â Â Â Â Â Â if [ "$ONLINE" = "0" ] ; then
> + Â Â Â Â Â Â Â Â Â Â Â echo Processing: `basename $f`
> + Â Â Â Â Â Â Â fi
> + Â Â Â Â Â Â Â coccinelle $f>/tmp/cocci_parallel_$$_$PARALLEL_ID 2>&1 &
> + Â Â Â Â Â Â Â PARALLEL_ID=$(($PARALLEL_ID + 1))
> + Â Â Â Â Â Â Â while [ "`jobs -p | wc -l`" -ge "$PARALLEL" ] ; do
> + Â Â Â Â Â Â Â Â Â Â Â sleep 3
> + Â Â Â Â Â Â Â done
> + Â Â Â else
> + Â Â Â Â Â Â Â coccinelle $f
> + Â Â Â fi
> Â Â done
> + Â Âwait
> + Â Âif [ "$PARALLEL_ID" -ge "0" ] ; then
> + Â Â Â cat /tmp/cocci_parallel_$$_*
> + Â Â Â parallel_cleanup
> + Â Âfi
> Âelse
> Â Â coccinelle $COCCI
> Âfi
> --
> 1.7.2.5
>
>



--
Nicolas Palix
http://sardes.inrialpes.fr/~npalix/
--
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/