linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Michael Petlan <mpetlan@redhat.com>
Subject: [PATCH 05/12] libperf: Add fork_event to perf/event.h
Date: Sun, 25 Aug 2019 20:17:45 +0200	[thread overview]
Message-ID: <20190825181752.722-6-jolsa@kernel.org> (raw)
In-Reply-To: <20190825181752.722-1-jolsa@kernel.org>

Moving fork_event event definition into libperf's event.h
header include.

In order to keep libperf simple, we switch 'u64/u32/u16/u8'
types used events to their generic '__u*' versions.

Perf added 'u*' types mainly to ease up printing __u64 values
as stated in the linux/types.h comment:

  /*
   * We define u64 as uint64_t for every architecture
   * so that we can print it with "%"PRIx64 without getting warnings.
   *
   * typedef __u64 u64;
   * typedef __s64 s64;
   */

Adding and using new PRI_lu64 and PRI_lx64 macros to be used for
that.  Using extra '_' to ease up the reading and differentiate
them from standard PRI*64 macros.

Link: http://lkml.kernel.org/n/tip-p4ooh7midl03a03o03xcsqws@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/lib/include/perf/event.h | 7 +++++++
 tools/perf/util/event.h             | 7 -------
 tools/perf/util/python.c            | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h
index 265bb01029f0..7a34221abbba 100644
--- a/tools/perf/lib/include/perf/event.h
+++ b/tools/perf/lib/include/perf/event.h
@@ -43,4 +43,11 @@ struct namespaces_event {
 	struct perf_ns_link_info link_info[];
 };
 
+struct fork_event {
+	struct perf_event_header header;
+	__u32 pid, ppid;
+	__u32 tid, ptid;
+	__u64 time;
+};
+
 #endif /* __LIBPERF_EVENT_H */
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index e8c57c23aa24..817f12643f11 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -16,13 +16,6 @@
 #define PRI_lu64 "l" PRIu64
 #define PRI_lx64 "l" PRIx64
 
-struct fork_event {
-	struct perf_event_header header;
-	u32 pid, ppid;
-	u32 tid, ptid;
-	u64 time;
-};
-
 struct lost_event {
 	struct perf_event_header header;
 	u64 id;
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 55ff0c3182d6..8bdadb24f6ba 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -170,7 +170,7 @@ static PyMemberDef pyrf_task_event__members[] = {
 static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent)
 {
 	return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, "
-				   "ptid: %u, time: %" PRIu64 "}",
+				   "ptid: %u, time: %" PRI_lu64 "}",
 				   pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit",
 				   pevent->event.fork.pid,
 				   pevent->event.fork.ppid,
-- 
2.21.0


  parent reply	other threads:[~2019-08-25 18:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-25 18:17 [PATCH 00/12] libperf: Add events to perf/event.h Jiri Olsa
2019-08-25 18:17 ` [PATCH 01/12] libperf: Add mmap_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_MMAP 'struct mmap_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 02/12] libperf: Add mmap2_event " Jiri Olsa
2019-08-25 18:17 ` [PATCH 03/12] libperf: Add comm_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_COMM 'struct comm_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 04/12] libperf: Add namespaces_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_NAMESPACES 'struct namespaces_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` Jiri Olsa [this message]
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_FORK 'struct fork_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 06/12] libperf: Add lost_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_LOST 'struct lost_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 07/12] libperf: Add lost_samples_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_LOST_SAMPLES 'struct lost_samples_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 08/12] libperf: Add read_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_READ 'struct read_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 09/12] libperf: Add throttle_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_THROTTLE 'struct throttle_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 10/12] libperf: Add ksymbol_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_KSYMBOL 'struct ksymbol_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 11/12] libperf: Add bpf_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_BPF_EVENT 'struct bpf_event' " tip-bot2 for Jiri Olsa
2019-08-25 18:17 ` [PATCH 12/12] libperf: Add sample_event " Jiri Olsa
2019-08-27  8:26   ` [tip: perf/core] libperf: Add PERF_RECORD_SAMPLE 'struct sample_event' " tip-bot2 for Jiri Olsa
2019-08-26 15:41 ` [PATCH 00/12] libperf: Add events " Arnaldo Carvalho de Melo
2019-08-26 16:47   ` Jiri Olsa
2019-08-26 22:08     ` Arnaldo Carvalho de Melo
2019-08-26 16:06 ` Arnaldo Carvalho de Melo
2019-08-26 16:18   ` Arnaldo Carvalho de Melo
2019-08-26 16:58     ` Jiri Olsa
2019-08-26 22:14       ` Arnaldo Carvalho de Melo
2019-08-26 22:41         ` Arnaldo Carvalho de Melo
2019-08-27  7:41           ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190825181752.722-6-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).