Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5305837imm; Tue, 19 Jun 2018 08:19:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJweIWDhhH4R8Krs8vl7lmy2GnCRHqduoNmDgWDVfHorEv2Hz/J0sTIqx4I4A+0qbxq7owj X-Received: by 2002:a17:902:4d:: with SMTP id 71-v6mr19378096pla.317.1529421548001; Tue, 19 Jun 2018 08:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529421547; cv=none; d=google.com; s=arc-20160816; b=M2Jxb4Y3+TXqKq3PQ3q6y3xm6dCkdlBg0yc3ABwL5zRL2raynducimBXV6LROjEhD7 yBsZkv74HLzNoKwe9uFTRwep5fS5hP6iDZc7TOT4nDIqj3Lq96pWOSWQF+tNzqwxCGi5 RdtyWYDu7030EjtPUfRKTc3XiZgXSBtl8iRQx5N/jwCDs2snztzIp2fpePa75Q17rL+0 z8Ac46jM+ZeqCC8pCcY1TYKwppiCuQbFULAwSbycD9N8aX/bDDSwykVC6vBpKAdo0FoV s4Vfdf2evSvP/ZKKytgZrRqWjL7iClWv+EAK8ALTMqgAOjrQMNVeHwsCYHOaV+luS1Pk JgEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=N50QLEJBHL6s6TrxF6FtxjAVLWDJEMjlkkSCXq6xGIc=; b=jqs/fSyl4tbeJ+N4fu5mN6UpsH13CL2/b5W8a11VOmmhw1VJpYZNXCnVqV8skc92gm DUxIPO8fnpSiQ4Cvt+7kXVyVM1Y6QuJ74ufYZqfi5eTOOxAOGeBN7h+ePKOFcYeZNF09 93AU9ZrsysJuN0xSuow/uTYECvALQRJwi/yFtEDnIbFqqhG5MyxuqQKbscu66Be1Fd1y wlci1oDHlM9QL2TNGzHs/lgzTZ7qBMbJlXyJyI0hAPfxxePvY2+HYYdLgTPHJqeUOams ZEdqAKbQid06bN7HkqBGDQT9t8QefYIm5+suUe87cBllVud6doJMvybxEjaHL/6yZttS /rfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TmHPA4Tw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15-v6si17571466plq.180.2018.06.19.08.18.54; Tue, 19 Jun 2018 08:19:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TmHPA4Tw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937652AbeFSPRL (ORCPT + 99 others); Tue, 19 Jun 2018 11:17:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:57808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937547AbeFSPRJ (ORCPT ); Tue, 19 Jun 2018 11:17:09 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB1F720652; Tue, 19 Jun 2018 15:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529421428; bh=5NjKi9jObOdD0d12IuDQ6OCZQOqMt261Tlk6hFuFS80=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TmHPA4TwOczxAIgPaaZ9dsYPO/hKcKTRkqDnBQhcJthH4DCy/zF8/Xc1XBO8Vdys9 jyjY5Qtohx2jC/SHtFxMzHhsi9UJ0rAMnLy7aXAAddVcRJqa7dOnmoNwxor5bnrT7x +bK9DrosSTF9PAHWFKp8wSOlexjpz7FG9+8LO3nA= Received: by jouet.infradead.org (Postfix, from userid 1000) id 933831401E5; Tue, 19 Jun 2018 12:17:06 -0300 (-03) Date: Tue, 19 Jun 2018 12:17:06 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Thomas Richter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com Subject: Re: [PATCH 3/3] perf stat: Remove duplicate event counting Message-ID: <20180619151706.GJ20477@kernel.org> References: <20180614114845.41221-1-tmricht@linux.ibm.com> <20180614114845.41221-3-tmricht@linux.ibm.com> <20180615082124.GG5082@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180615082124.GG5082@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Jun 15, 2018 at 10:21:24AM +0200, Jiri Olsa escreveu: > On Thu, Jun 14, 2018 at 01:48:45PM +0200, Thomas Richter wrote: > > SNIP > > > +static void perf_pmu_assign_str(char *name, const char *field, char **old_str, > > + char **new_str) > > +{ > > + if (!*old_str) > > + goto set_new; > > + > > + if (*new_str) { /* Have new string, check with old */ > > + if (strcasecmp(*old_str, *new_str)) > > + pr_debug("alias %s differs in field '%s'\n", > > + name, field); > > + zfree(old_str); > > + } else /* Nothing new --> keep old string */ > > + return; > > +set_new: > > + *old_str = *new_str; > > + *new_str = NULL; > > +} > > + > > +static void perf_pmu_update_alias(struct perf_pmu_alias *old, > > + struct perf_pmu_alias *newalias) > > +{ > > + perf_pmu_assign_str(old->name, "desc", &old->desc, &newalias->desc); > > + perf_pmu_assign_str(old->name, "long_desc", &old->long_desc, > > + &newalias->long_desc); > > + perf_pmu_assign_str(old->name, "topic", &old->topic, &newalias->topic); > > + perf_pmu_assign_str(old->name, "metric_expr", &old->metric_expr, > > + &newalias->metric_expr); > > + perf_pmu_assign_str(old->name, "metric_name", &old->metric_name, > > + &newalias->metric_name); > > + perf_pmu_assign_str(old->name, "value", &old->str, &newalias->str); > > + old->scale = newalias->scale; > > + old->per_pkg = newalias->per_pkg; > > + old->snapshot = newalias->snapshot; > > + memcpy(old->unit, newalias->unit, sizeof(old->unit)); > > +} > > + > > +/* Delete an alias entry. */ > > +static void perf_pmu_free_alias(struct perf_pmu_alias *newalias) > > +{ > > + zfree(&newalias->name); > > + zfree(&newalias->desc); > > + zfree(&newalias->long_desc); > > + zfree(&newalias->topic); > > + zfree(&newalias->str); > > + zfree(&newalias->metric_expr); > > + zfree(&newalias->metric_name); > > + parse_events_terms__purge(&newalias->terms); > > + free(newalias); > > +} > > + > > +/* Merge an alias, search in alias list. If this name is already > > + * present merge both of them to combine all information. > > + */ > > +static bool perf_pmu_merge_alias(struct perf_pmu_alias *newalias, > > + struct list_head *alist) > > +{ > > + struct perf_pmu_alias *a; > > + > > + list_for_each_entry(a, alist, list) { > > + if (!strcasecmp(newalias->name, a->name)) { > > + perf_pmu_update_alias(a, newalias); > > + perf_pmu_free_alias(newalias); > > + return true; > > + } > > + } > > + return false; > > +} > > ok, I like your change better.. we can rebuilt it to use > rb tree later when we have this fixed Ok, can I take this as an Acked-by or Reviewed-by? - Arnaldo