From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 221E92935 for ; Thu, 13 Jul 2017 08:56:17 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C5DBC20C03; Thu, 13 Jul 2017 02:56:16 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 13 Jul 2017 02:56:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=uyIpaj1kHMrGomA /DkZHctA1jnTG2BPf13TrqWY099E=; b=ksY2i4we3wXTuTBB81kv3V2Pwap3Uls QAuCIgth919g9WJsaGqFfXWpQfJeZkspxR51uidai92bOlCFU0x8PEFM5R16vwWD y6MQeKkvhA+FCct+3gZSpf+5ZMYD12vpDhki4j1LWBFJuambW2l7rjVWkpWpqZfv BjVvXkckhRYU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=uyIpaj1kHMrGomA/DkZHctA1jnTG2BPf13TrqWY099E=; b=E7KIjMiz b9CaT0kfffoW8ykn4sMEXQ4aOtS4fAyGoIOGNofjZ/A2dTxVF5DgqtW9RUKPUkPW kwHKY9XyFj5RVnQ1ca1BYW4RD/nNmXMmzlc4DoXADNJX82XGdVuuRig7ylc0rUOU vQnMTQYbHlveTkAd7m0nlN59cpUdCN3lkMggSepRHShmbnVhNtxZ8By2nIqslpo0 nEUNKgnw6rt944N9hTC8NNSMIn+Uj0SUX9qrMW/p4h9OPKLbSS7nu0K2/QvS+8kn BkSreeqKA0JK9qxxF27sDEuYQXxqZLc/Qww2KGTAUQ/pEu3ukUmsgM4WOR3lX1QF Oh4IYf+rRessKA== X-ME-Sender: X-Sasl-enc: h+z9ZCi13x0D+iUbtMJJ7344QV6ev6yluxOQRju2poPd 1499928976 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 7FCC17E51B; Thu, 13 Jul 2017 02:56:16 -0400 (EDT) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org Date: Thu, 13 Jul 2017 08:56:15 +0200 Message-ID: <7177425.p9cP4Rfg1a@xps> In-Reply-To: <20170712145925.2dfe5be1@xeon-e3> References: <20170711185546.26138-1-stephen@networkplumber.org> <2203089.SAOtEojdoZ@xps> <20170712145925.2dfe5be1@xeon-e3> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 01/19] devtools: add simple script to find duplicate includes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jul 2017 06:56:17 -0000 12/07/2017 23:59, Stephen Hemminger: > On Tue, 11 Jul 2017 22:33:55 +0200 > Thomas Monjalon wrote: > > > Thank you for this script, but... it is written in Perl! > > I don't think it is a good idea to add yet another language to DPDK. > > We already have shell and python scripts. > > And I am not sure a lot of (young) people are able to parse it ;) > > > > I would like to propose this shell script: > > > > dirs='app buildtools drivers examples lib test' > > pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*' > > > > for file in $(git ls $dirs) ; do > > dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) > > [ -n "$dups" ] || continue > > echo "$file" > > echo "$dups" | sed 's,^,\t,' > > done > > There is no "git ls" command in current version, > > Using find instead works. Yes, both work if specifying source code directories as above. > plus shell is 7x slower. > > $ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" > real 0m0.765s > user 0m1.220s > sys 0m0.155s > $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" > real 0m0.131s > user 0m0.118s > sys 0m0.014s I don't think speed is really relevant here :) > How about some python code. I don't really care between shell or python. I thought a shell script would be really concise and without Python 2/3 compat issues.