LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: perf: util: session:  Remove unused function
@ 2015-01-01 17:50 Rickard Strandqvist
  2015-01-02  8:04 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2015-01-01 17:50 UTC (permalink / raw
  To: Peter Zijlstra, Paul Mackerras
  Cc: Rickard Strandqvist, Ingo Molnar, Arnaldo Carvalho de Melo,
	Jiri Olsa, David Ahern, Adrian Hunter, linux-kernel

Remove the function perf_session__peek_event() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 tools/perf/util/session.c |   55 ---------------------------------------------
 tools/perf/util/session.h |    5 -----
 2 files changed, 60 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 6702ac2..f861788 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -902,61 +902,6 @@ static void event_swap(union perf_event *event, bool sample_id_all)
 		swap(event, sample_id_all);
 }
 
-int perf_session__peek_event(struct perf_session *session, off_t file_offset,
-			     void *buf, size_t buf_sz,
-			     union perf_event **event_ptr,
-			     struct perf_sample *sample)
-{
-	union perf_event *event;
-	size_t hdr_sz, rest;
-	int fd;
-
-	if (session->one_mmap && !session->header.needs_swap) {
-		event = file_offset - session->one_mmap_offset +
-			session->one_mmap_addr;
-		goto out_parse_sample;
-	}
-
-	if (perf_data_file__is_pipe(session->file))
-		return -1;
-
-	fd = perf_data_file__fd(session->file);
-	hdr_sz = sizeof(struct perf_event_header);
-
-	if (buf_sz < hdr_sz)
-		return -1;
-
-	if (lseek(fd, file_offset, SEEK_SET) == (off_t)-1 ||
-	    readn(fd, &buf, hdr_sz) != (ssize_t)hdr_sz)
-		return -1;
-
-	event = (union perf_event *)buf;
-
-	if (session->header.needs_swap)
-		perf_event_header__bswap(&event->header);
-
-	if (event->header.size < hdr_sz)
-		return -1;
-
-	rest = event->header.size - hdr_sz;
-
-	if (readn(fd, &buf, rest) != (ssize_t)rest)
-		return -1;
-
-	if (session->header.needs_swap)
-		event_swap(event, perf_evlist__sample_id_all(session->evlist));
-
-out_parse_sample:
-
-	if (sample && event->header.type < PERF_RECORD_USER_TYPE_START &&
-	    perf_evlist__parse_sample(session->evlist, event, sample))
-		return -1;
-
-	*event_ptr = event;
-
-	return 0;
-}
-
 static s64 perf_session__process_event(struct perf_session *session,
 				       union perf_event *event,
 				       struct perf_tool *tool,
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index a4be851..1d60297 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -44,11 +44,6 @@ void perf_session__delete(struct perf_session *session);
 
 void perf_event_header__bswap(struct perf_event_header *hdr);
 
-int perf_session__peek_event(struct perf_session *session, off_t file_offset,
-			     void *buf, size_t buf_sz,
-			     union perf_event **event_ptr,
-			     struct perf_sample *sample);
-
 int __perf_session__process_events(struct perf_session *session,
 				   u64 data_offset, u64 data_size, u64 size,
 				   struct perf_tool *tool);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools: perf: util: session:  Remove unused function
  2015-01-01 17:50 [PATCH] tools: perf: util: session: Remove unused function Rickard Strandqvist
@ 2015-01-02  8:04 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2015-01-02  8:04 UTC (permalink / raw
  To: Rickard Strandqvist
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Jiri Olsa, David Ahern, linux-kernel

On 01/01/15 19:50, Rickard Strandqvist wrote:
> Remove the function perf_session__peek_event() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---

It was added in preparation for Intel PT and is still needed. Please do not
remove.

For example it is used here:

	http://marc.info/?l=linux-kernel&m=141839228619389


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-02  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 17:50 [PATCH] tools: perf: util: session: Remove unused function Rickard Strandqvist
2015-01-02  8:04 ` Adrian Hunter

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 read-only IMAP folder(s) and NNTP newsgroup(s).