From patchwork Fri Jun 15 07:55:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 9316 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 16F3123E49 for ; Fri, 15 Jun 2012 07:55:46 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id BC5BEA18A26 for ; Fri, 15 Jun 2012 07:55:45 +0000 (UTC) Received: by yhpp61 with SMTP id p61so2396411yhp.11 for ; Fri, 15 Jun 2012 00:55:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:message-id :date:from:user-agent:mime-version:to:cc:subject:references :in-reply-to:content-type:x-gm-message-state; bh=uig/YRUrw8IgVTu5UIFikvzmlL9Zucv1if7JIZqoYf0=; b=aBkySfLXexv1d4WUMcJLKtU9WXLEDsE+eek6t1anLv28XJ8j40MqYMVw4Lk2f1nUir NBsqlYORdd9cOEda6xvNyZ00bcx5y51GfXbadXm5mUidrLlu12BlbZiQNUNfrgQQSLV+ PL+jsk7m0qR6eYmXI1aWRPilyNNIRIAWZFIm+sDV9JTWs4zj68VmRI5OtDs2NQGxpV75 WBhdMuLomUDk8RyMznLnLH+x7GUpprtEhO3BbWGTcT7PARfeTFy3ZzMemPq0Jxvp9686 7g11kzdMfP0CmviL4KmOTCiscQ1wkHpKQFCh3BEKaPC4kDQitg/k35CavxA2SVSUPGun oNRg== Received: by 10.50.87.227 with SMTP id bb3mr678343igb.57.1339746945015; Fri, 15 Jun 2012 00:55:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp130416ibb; Fri, 15 Jun 2012 00:55:44 -0700 (PDT) Received: by 10.152.113.199 with SMTP id ja7mr4607296lab.10.1339746943741; Fri, 15 Jun 2012 00:55:43 -0700 (PDT) Received: from mail-lpp01m010-f50.google.com (mail-lpp01m010-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id a9si8783994lbh.50.2012.06.15.00.55.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jun 2012 00:55:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) client-ip=209.85.215.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) smtp.mail=dmitry.antipov@linaro.org Received: by lahm15 with SMTP id m15so2412456lah.37 for ; Fri, 15 Jun 2012 00:55:43 -0700 (PDT) Received: by 10.112.83.229 with SMTP id t5mr2206720lby.8.1339746942931; Fri, 15 Jun 2012 00:55:42 -0700 (PDT) Received: from [192.168.0.171] ([213.148.21.55]) by mx.google.com with ESMTPS id j1sm5805913lby.8.2012.06.15.00.55.41 (version=SSLv3 cipher=OTHER); Fri, 15 Jun 2012 00:55:42 -0700 (PDT) Message-ID: <4FDAEA7D.2080502@linaro.org> Date: Fri, 15 Jun 2012 11:55:41 +0400 From: Dmitry Antipov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo CC: Namhyung Kim , David Ahern , Jiri Olsa , linaro-dev@lists.linaro.org, patches@linaro.org Subject: Re: [RFC] tmp.perf/core branch with event_name changes and some more References: <20120612170513.GB5816@infradead.org> In-Reply-To: <20120612170513.GB5816@infradead.org> X-Gm-Message-State: ALoCoQl/UV1YDrqfcse9IuKhV8r0zDq/+bnd7YAehFuLmB24Ckrq3YKKN8LtR3aNWqZTzVDeOpwY On 06/12/2012 09:05 PM, Arnaldo Carvalho de Melo wrote: > Could you please check out if my tmp.perf/core branch fixes the > problems reported lately about event name mismatches from perf.data > files collected in other machines, etc. As of a8dfce8b37b2e0d216860191cd50fde501eeb036, perf sched replay doesn't work because (perf_evlist__set_tracepoints_handlers): ... err = trace_event__id(assocs[i].name); <-- err is host id, not from perf.data if (err < 0) goto out; evsel = perf_evlist__find_tracepoint_by_id(evlist, err); <-- oops! ... Assuming event names are set, can we just lookup by name? Dmitry >From 5e1fbde04a2a8745711f439f4d4682b2215119b2 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 15 Jun 2012 11:49:47 +0400 Subject: [PATCH] perf: lookup by event name Assuming event names are set, lookup tracepoint by name instead of ID. Signed-off-by: Dmitry Antipov --- tools/perf/util/evlist.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 7400fb3..d6b7262 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -225,13 +225,13 @@ out_free_attrs: } static struct perf_evsel * - perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id) + perf_evlist__find_tracepoint_by_name(struct perf_evlist *evlist, const char *name) { struct perf_evsel *evsel; list_for_each_entry(evsel, &evlist->entries, node) { if (evsel->attr.type == PERF_TYPE_TRACEPOINT && - (int)evsel->attr.config == id) + !strcmp(evsel->name, name)) return evsel; } @@ -247,11 +247,7 @@ int perf_evlist__set_tracepoints_handlers(struct perf_evlist *evlist, size_t i; for (i = 0; i < nr_assocs; i++) { - err = trace_event__id(assocs[i].name); - if (err < 0) - goto out; - - evsel = perf_evlist__find_tracepoint_by_id(evlist, err); + evsel = perf_evlist__find_tracepoint_by_name(evlist, assocs[i].name); if (evsel == NULL) continue;