All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Sumera Priyadarsini <sylphrenadin@gmail.com>,
	Coccinelle <cocci@systeme.lip6.fr>
Cc: Michal Marek <michal.lkml@markovi.net>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	kernel-janitors@vger.kernel.org,
	Nicolas Palix <nicolas.palix@imag.fr>,
	linux-kernel@vger.kernel.org, Julia Lawall <Julia.Lawall@lip6.fr>
Subject: Re: [Cocci] Determination of an usage statistic for macro calls “for_each…node…”
Date: Sun, 18 Oct 2020 13:16:34 +0200	[thread overview]
Message-ID: <1727796.Akdtb4oiQ5@sonne> (raw)
In-Reply-To: <1980390.yx7ZeylQeb@sonne>

> Would you like to look for software configuration alternatives for better parallel data processing?

I would like to share another source code analysis approach.
I hope that this contribution can trigger further helpful software development ideas.


@initialize:python@
@@
import sys

def write_identifier(source, loop):
    names = []
    for x in source:
       names.append(loop)

    sys.stdout.write("\n".join(names) + "\n")

@find@
identifier fe, x;
iterator name for_each_node_by_name,
              for_each_node_by_type,
              for_each_node_with_property,
              for_each_matching_node,
              for_each_matching_node_and_match,
              for_each_compatible_node,
              for_each_child_of_node,
              for_each_available_child_of_node;
position pos;
statement s;
type t;
@@
 t x(...)
 {
 <+...
(for_each_child_of_node@fe@pos(...) s
|for_each_available_child_of_node@fe@pos(...) s
|for_each_compatible_node@fe@pos(...) s
|for_each_node_by_name@fe@pos(...) s
|for_each_node_by_type@fe@pos(...) s
|for_each_matching_node@fe@pos(...) s
|for_each_matching_node_and_match@fe@pos(...) s
|for_each_node_with_property@fe@pos(...) s
)
 ...+>
 }

@script:python collection@
fe << find.fe;
place << find.pos;
@@
write_identifier(place, fe)


Test result:
elfring@Sonne:~/Projekte/Linux/next-patched> git checkout next-20201016 && XX=$(date) && time spatch --python python3 --jobs 4 --include-headers --no-includes --dir . ~/Projekte/Coccinelle/janitor/report_for_each_node_macro_calls5.cocci | echo "$(echo 'call' && cat)" | csvsql --query 'select call, count(*) from stdin group by call'; YY=$(date) && echo "$XX | $YY"
…
523 files match
…
call,count(*)
for_each_available_child_of_node,158
for_each_child_of_node,359
for_each_compatible_node,80
for_each_matching_node,22
for_each_matching_node_and_match,16
for_each_node_by_name,59
for_each_node_by_type,53
for_each_node_with_property,6

real	0m47,779s
user	2m19,285s
sys	0m1,541s
So 18. Okt 13:13:02 CEST 2020 | So 18. Okt 13:13:50 CEST 2020


Can such facts influence the specification of efficient SmPL disjunctions any more?

Regards,
Markus


_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

      reply	other threads:[~2020-10-18 11:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <42184243.d196fk2T0j@sonne>
2020-10-17  5:38 ` [Cocci] Determination of an usage statistic for macro calls “for_each…node…” Markus Elfring
2020-10-18 11:16   ` Markus Elfring [this message]

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=1727796.Akdtb4oiQ5@sonne \
    --to=markus.elfring@web.de \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=sylphrenadin@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.