Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756230Ab3DWIfg (ORCPT ); Tue, 23 Apr 2013 04:35:36 -0400 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:61602 "EHLO LGEMRELSE7Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755174Ab3DWIbQ (ORCPT ); Tue, 23 Apr 2013 04:31:16 -0400 X-AuditID: 9c930197-b7bb3ae000000fa9-8b-517646d1cdc5 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Namhyung Kim , LKML , Steven Rostedt , Frederic Weisbecker , Jiri Olsa , David Ahern , Stephane Eranian Subject: [PATCH 02/14] perf util: Use evsel->name to get tracepoint_paths Date: Tue, 23 Apr 2013 17:31:00 +0900 Message-Id: <1366705872-12132-3-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1366705872-12132-1-git-send-email-namhyung@kernel.org> References: <1366705872-12132-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1669 Lines: 57 From: Namhyung Kim Most tracepoint events already have their system and event name in ->name field so that searching whole event tracing directory for each evsel to match given id is suboptimal. Cc: Jiri Olsa Cc: Frederic Weisbecker Signed-off-by: Namhyung Kim --- tools/perf/util/trace-event-info.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index ab18bf12d54a..dcfc1869c9af 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -414,12 +414,31 @@ get_tracepoints_path(struct list_head *pattrs) if (pos->attr.type != PERF_TYPE_TRACEPOINT) continue; ++nr_tracepoints; + + if (pos->name && strchr(pos->name, ':')) { + char *str = strchr(pos->name, ':'); + + ppath->next = zalloc(sizeof(path)); + if (!ppath->next) + goto error; + + ppath->next->system = strndup(pos->name, str - pos->name); + ppath->next->name = strdup(str+1); + + if (!ppath->next->system || !ppath->next->name) + goto error; + + goto next; + } + ppath->next = tracepoint_id_to_path(pos->attr.config); if (!ppath->next) { +error: pr_debug("No memory to alloc tracepoints list\n"); put_tracepoints_path(&path); return NULL; } +next: ppath = ppath->next; } -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/