From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933518AbcGJLKE (ORCPT ); Sun, 10 Jul 2016 07:10:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42122 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757102AbcGJLIJ (ORCPT ); Sun, 10 Jul 2016 07:08:09 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: [PATCH 02/10] perf tools: Introduce trace_event__tp_format_id function Date: Sun, 10 Jul 2016 13:07:54 +0200 Message-Id: <1468148882-10362-3-git-send-email-jolsa@kernel.org> In-Reply-To: <1468148882-10362-1-git-send-email-jolsa@kernel.org> References: <1468148882-10362-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 10 Jul 2016 11:08:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To get struct event_format object from tracepoint ID. It will be used in following patches. Link: http://lkml.kernel.org/n/tip-0omstcxuxa8npi3otondl4m8@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/trace-event.c | 9 +++++++++ tools/perf/util/trace-event.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c index 8ae051e0ec79..883caa8941a9 100644 --- a/tools/perf/util/trace-event.c +++ b/tools/perf/util/trace-event.c @@ -105,3 +105,12 @@ trace_event__tp_format(const char *sys, const char *name) return tp_format(sys, name); } + +struct event_format* +trace_event__tp_format_id(int id) +{ + if (!tevent_initialized && trace_event__init2()) + return ERR_PTR(-ENOMEM); + + return pevent_find_event(tevent.pevent, id); +} diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index bce5b1dac268..b0af9c81bb0d 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h @@ -23,6 +23,8 @@ int trace_event__register_resolver(struct machine *machine, struct event_format* trace_event__tp_format(const char *sys, const char *name); +struct event_format *trace_event__tp_format_id(int id); + int bigendian(void); void event_format__fprintf(struct event_format *event, -- 2.4.11