mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Palix <Nicolas.Palix@inria.fr>
To: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Cc: joe@perches.com, julia@diku.dk, Gilles.Muller@lip6.fr,
	rdunlap@xenotime.net, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, cocci@diku.dk, mmarek@suse.cz
Subject: Re: [PATCH v2] coccicheck: add parallel execution
Date: Wed, 27 Jul 2011 08:18:42 +0200	[thread overview]
Message-ID: <CAAxaTiPVhXxZczhovbsB8osaP2T3v297z1OOO2YCJsaeVdryXw@mail.gmail.com> (raw)
In-Reply-To: <1311719817-11336-1-git-send-email-Gregory.Dietsche@cuw.edu>

On Wed, Jul 27, 2011 at 12:36 AM, Greg Dietsche
<Gregory.Dietsche@cuw.edu> 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@cuw.edu>
Acked-by: Nicolas Palix <npalix.work@gmail.com>
> ---
>  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/

  reply	other threads:[~2011-07-27  6:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13  1:26 [PATCH 0/3] coccinelle: " Greg Dietsche
2011-07-13  1:26 ` [PATCH 1/3] coccinelle.txt: add overview section Greg Dietsche
2011-07-26 14:46   ` Nicolas Palix
2011-07-13  1:26 ` [PATCH 2/3] coccinelle.txt: add documentation of PARALLEL= flag Greg Dietsche
2011-07-27  6:19   ` Nicolas Palix
2011-07-13  1:26 ` [PATCH 3/3] coccicheck: add parallel execution Greg Dietsche
2011-07-13  2:42   ` Joe Perches
2011-07-14  2:14     ` Greg Dietsche
2011-07-26 13:33       ` Nicolas Palix
2011-07-26 13:53         ` Michal Marek
2011-07-26 22:46           ` Greg Dietsche
2011-07-26 22:36         ` [PATCH v2] " Greg Dietsche
2011-07-27  6:18           ` Nicolas Palix [this message]
2011-07-14  9:37 ` [PATCH 0/3] coccinelle: " Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAxaTiPVhXxZczhovbsB8osaP2T3v297z1OOO2YCJsaeVdryXw@mail.gmail.com \
    --to=nicolas.palix@inria.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Gregory.Dietsche@cuw.edu \
    --cc=cocci@diku.dk \
    --cc=joe@perches.com \
    --cc=julia@diku.dk \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome