From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bp@suse.de, tglx@linutronix.de, acme@redhat.com,
dzickus@redhat.com, mingo@kernel.org, adrian.hunter@intel.com,
namhyung@kernel.org, jolsa@redhat.com,
linux-kernel@vger.kernel.org, fweisbec@gmail.com,
dsahern@gmail.com, hpa@zytor.com, eranian@google.com
Subject: [tip:perf/core] perf ordered_events: Adopt queue() method
Date: Sat, 14 Mar 2015 00:02:11 -0700 [thread overview]
Message-ID: <tip-mfihndzaumx44h6y37ng2irb@git.kernel.org> (raw)
Commit-ID: 4a6b362f36e68618ee4d3cdb361d05a5e80af023
Gitweb: http://git.kernel.org/tip/4a6b362f36e68618ee4d3cdb361d05a5e80af023
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Tue, 3 Mar 2015 13:02:24 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 12 Mar 2015 12:39:51 -0300
perf ordered_events: Adopt queue() method
>From perf_session, will be used in 'trace'.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-mfihndzaumx44h6y37ng2irb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/ordered-events.c | 34 ++++++++++++++++++++++++++++++++--
tools/perf/util/ordered-events.h | 4 ++--
tools/perf/util/session.c | 28 +---------------------------
3 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index 0d8cea9..6002fa3 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -131,8 +131,8 @@ static struct ordered_event *alloc_event(struct ordered_events *oe,
return new;
}
-struct ordered_event *
-ordered_events__new(struct ordered_events *oe, u64 timestamp,
+static struct ordered_event *
+ordered_events__new_event(struct ordered_events *oe, u64 timestamp,
union perf_event *event)
{
struct ordered_event *new;
@@ -153,6 +153,36 @@ void ordered_events__delete(struct ordered_events *oe, struct ordered_event *eve
free_dup_event(oe, event->event);
}
+int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
+ struct perf_sample *sample, u64 file_offset)
+{
+ u64 timestamp = sample->time;
+ struct ordered_event *oevent;
+
+ if (!timestamp || timestamp == ~0ULL)
+ return -ETIME;
+
+ if (timestamp < oe->last_flush) {
+ pr_oe_time(timestamp, "out of order event\n");
+ pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
+ oe->last_flush_type);
+
+ oe->evlist->stats.nr_unordered_events++;
+ }
+
+ oevent = ordered_events__new_event(oe, timestamp, event);
+ if (!oevent) {
+ ordered_events__flush(oe, OE_FLUSH__HALF);
+ oevent = ordered_events__new_event(oe, timestamp, event);
+ }
+
+ if (!oevent)
+ return -ENOMEM;
+
+ oevent->file_offset = file_offset;
+ return 0;
+}
+
static int __ordered_events__flush(struct ordered_events *oe)
{
struct list_head *head = &oe->events;
diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h
index c6cf0ba..173e13f 100644
--- a/tools/perf/util/ordered-events.h
+++ b/tools/perf/util/ordered-events.h
@@ -49,8 +49,8 @@ struct ordered_events {
bool copy_on_queue;
};
-struct ordered_event *ordered_events__new(struct ordered_events *oe, u64 timestamp,
- union perf_event *event);
+int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
+ struct perf_sample *sample, u64 file_offset);
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
void ordered_events__init(struct ordered_events *oe, struct machines *machines,
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 703a370..adf0740 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -541,33 +541,7 @@ static int process_finished_round(struct perf_tool *tool __maybe_unused,
int perf_session__queue_event(struct perf_session *s, union perf_event *event,
struct perf_sample *sample, u64 file_offset)
{
- struct ordered_events *oe = &s->ordered_events;
-
- u64 timestamp = sample->time;
- struct ordered_event *new;
-
- if (!timestamp || timestamp == ~0ULL)
- return -ETIME;
-
- if (timestamp < oe->last_flush) {
- pr_oe_time(timestamp, "out of order event\n");
- pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
- oe->last_flush_type);
-
- s->evlist->stats.nr_unordered_events++;
- }
-
- new = ordered_events__new(oe, timestamp, event);
- if (!new) {
- ordered_events__flush(oe, OE_FLUSH__HALF);
- new = ordered_events__new(oe, timestamp, event);
- }
-
- if (!new)
- return -ENOMEM;
-
- new->file_offset = file_offset;
- return 0;
+ return ordered_events__queue(&s->ordered_events, event, sample, file_offset);
}
static void callchain__lbr_callstack_printf(struct perf_sample *sample)
reply other threads:[~2015-03-14 7:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=tip-mfihndzaumx44h6y37ng2irb@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=bp@suse.de \
--cc=dsahern@gmail.com \
--cc=dzickus@redhat.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/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).