Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp901492ybl; Wed, 28 Aug 2019 07:00:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6jR2ayg7xWZ6m+XpPFm2t7agccntmkSQhW3U2LRzNmEplkZvGaOJqvdPccSM1PejtgAV6 X-Received: by 2002:a17:902:b20c:: with SMTP id t12mr4456685plr.205.1567000836703; Wed, 28 Aug 2019 07:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567000836; cv=none; d=google.com; s=arc-20160816; b=ZWNIfNKRYIgqlMU1p4tpAtoXfhA7qsmUq34lOqpieu+/peHpOXCf4M1mbtRiDf3Ip2 4n9PRdcNH7GjDtjBpUtb5Eju76r6omjlavR3Tia7BRWGfj9TDGBmtBxtS46O8FYZ/HOa yhe3idOBrsq7oOLlt6P0Bz+ARyN5t7p1ejAjLagDzPJhbeFFomI3wc5ahBZaB/OnvEP4 YpcBZIpjKNwCjdH5jRS7eey3z7tXqcwW6hRQpW21xIhURb4NNGPZ7UKIQR204/HrmuD8 s8suq8hQb8ODaVa9fCU8eHJFTBOFTYZ9ZSS8PMs1qaSG683TPQwW/d0+fEMbmKOLuTZ/ l8Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4KlOiYAcvUWTdh/ZOfWZZOecRz3lriGr8jL6uI7RFYU=; b=IQpADw1U7GuLDxNIz0GUZnmdlMGjSfQGdHO5NGorF8tm4ITtJz3EHWTDYx8eEhmR2/ qVhxBkeSHuIKWxaEMasQGqy49q1S3eClm4mtjeTr/I458DdN/p55yIE3vUFcNt+idVgZ 9P5U0JxUJ1UM27o/r1Ukrn/phvrsWNRGrrhPbJnEJBFe6YgtF/Q5tgSJ+PxfzFYz5MM8 UnETYHtLh++D9TF9vhW8OqYFoeTbCD2swb6c9CvXF/ogIoJNjf05+ujBhwHBVFbZXg7A WSnsxBg4IkyCGluzuB6EsVOqsPjWZz6WEUtXHDnOUURTcYSho/2LkZIvL/AqJ56vK0jH eEaA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 e18si1870851pjr.107.2019.08.28.07.00.20; Wed, 28 Aug 2019 07:00:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbfH1N5h (ORCPT + 99 others); Wed, 28 Aug 2019 09:57:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58036 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726802AbfH1N5e (ORCPT ); Wed, 28 Aug 2019 09:57:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10AD2308FC20; Wed, 28 Aug 2019 13:57:34 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AB921001B00; Wed, 28 Aug 2019 13:57:32 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 07/23] libperf: Add PERF_RECORD_ID_INDEX 'struct id_index_event' to perf/event.h Date: Wed, 28 Aug 2019 15:57:01 +0200 Message-Id: <20190828135717.7245-8-jolsa@kernel.org> In-Reply-To: <20190828135717.7245-1-jolsa@kernel.org> References: <20190828135717.7245-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 28 Aug 2019 13:57:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the PERF_RECORD_ID_INDEX event definition to libperf's event.h. In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used events to their generic '__u*' versions. Adding PRI_ld64 define, so we can use it in printf output. Link: http://lkml.kernel.org/n/tip-rfqlci30hjrzropnxjnwoz12@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/lib/include/perf/event.h | 13 +++++++++++++ tools/perf/util/event.h | 15 ++------------- tools/perf/util/session.c | 8 ++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h index 5e6b6d16793c..c68523c4fa01 100644 --- a/tools/perf/lib/include/perf/event.h +++ b/tools/perf/lib/include/perf/event.h @@ -188,4 +188,17 @@ struct build_id_event { char filename[]; }; +struct id_index_entry { + __u64 id; + __u64 idx; + __u64 cpu; + __u64 tid; +}; + +struct id_index_event { + struct perf_event_header header; + __u64 nr; + struct id_index_entry entries[0]; +}; + #endif /* __LIBPERF_EVENT_H */ diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 4b6cf89f31db..82315d2845fe 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -22,9 +22,11 @@ */ #define PRI_lu64 "l" PRIu64 #define PRI_lx64 "l" PRIx64 +#define PRI_ld64 "l" PRId64 #else #define PRI_lu64 PRIu64 #define PRI_lx64 PRIx64 +#define PRI_ld64 PRId64 #endif #define PERF_SAMPLE_MASK \ @@ -330,19 +332,6 @@ struct events_stats { u32 nr_proc_map_timeout; }; -struct id_index_entry { - u64 id; - u64 idx; - u64 cpu; - u64 tid; -}; - -struct id_index_event { - struct perf_event_header header; - u64 nr; - struct id_index_entry entries[0]; -}; - struct auxtrace_info_event { struct perf_event_header header; u32 type; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 5786e9c807c5..daa8aed27eae 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -2392,10 +2392,10 @@ int perf_event__process_id_index(struct perf_session *session, struct perf_sample_id *sid; if (dump_trace) { - fprintf(stdout, " ... id: %"PRIu64, e->id); - fprintf(stdout, " idx: %"PRIu64, e->idx); - fprintf(stdout, " cpu: %"PRId64, e->cpu); - fprintf(stdout, " tid: %"PRId64"\n", e->tid); + fprintf(stdout, " ... id: %"PRI_lu64, e->id); + fprintf(stdout, " idx: %"PRI_lu64, e->idx); + fprintf(stdout, " cpu: %"PRI_ld64, e->cpu); + fprintf(stdout, " tid: %"PRI_ld64"\n", e->tid); } sid = perf_evlist__id2sid(evlist, e->id); -- 2.21.0