[PATCH 04/18] perf tools: Rename ordered_events_queue members

2014-06-18 Thread Jiri Olsa
Rename 'struct ordered_events_queue' members to better
fit the ordered events pattern.

Cc: Arnaldo Carvalho de Melo 
Cc: Corey Ashford 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Jean Pihet 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Signed-off-by: Jiri Olsa 
---
 tools/perf/util/session.c | 108 +++---
 tools/perf/util/session.h |  12 +++---
 2 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 315d522..fc4da58 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -76,8 +76,8 @@ struct perf_session *perf_session__new(struct perf_data_file 
*file,
goto out;
 
session->repipe = repipe;
-   INIT_LIST_HEAD(>ordered_events.samples);
-   INIT_LIST_HEAD(>ordered_events.sample_cache);
+   INIT_LIST_HEAD(>ordered_events.events);
+   INIT_LIST_HEAD(>ordered_events.cache);
INIT_LIST_HEAD(>ordered_events.to_free);
machines__init(>machines);
 
@@ -455,12 +455,12 @@ struct ordered_event {
 
 static void perf_session_free_sample_buffers(struct perf_session *session)
 {
-   struct ordered_events_queue *os = >ordered_events;
+   struct ordered_events_queue *q = >ordered_events;
 
-   while (!list_empty(>to_free)) {
+   while (!list_empty(>to_free)) {
struct ordered_event *sq;
 
-   sq = list_entry(os->to_free.next, struct ordered_event, list);
+   sq = list_entry(q->to_free.next, struct ordered_event, list);
list_del(>list);
free(sq);
}
@@ -475,12 +475,12 @@ static int perf_session_deliver_event(struct perf_session 
*session,
 static int ordered_events_flush(struct perf_session *s,
   struct perf_tool *tool)
 {
-   struct ordered_events_queue *os = >ordered_events;
-   struct list_head *head = >samples;
+   struct ordered_events_queue *q = >ordered_events;
+   struct list_head *head = >events;
struct ordered_event *tmp, *iter;
struct perf_sample sample;
-   u64 limit = os->next_flush;
-   u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
+   u64 limit = q->next_flush;
+   u64 last_ts = q->last ? q->last->timestamp : 0ULL;
bool show_progress = limit == ULLONG_MAX;
struct ui_progress prog;
int ret;
@@ -489,7 +489,7 @@ static int ordered_events_flush(struct perf_session *s,
return 0;
 
if (show_progress)
-   ui_progress__init(, os->nr_samples, "Processing time 
ordered events...");
+   ui_progress__init(, q->nr_events, "Processing time ordered 
events...");
 
list_for_each_entry_safe(iter, tmp, head, list) {
if (session_done())
@@ -508,21 +508,19 @@ static int ordered_events_flush(struct perf_session *s,
return ret;
}
 
-   os->last_flush = iter->timestamp;
+   q->last_flush = iter->timestamp;
list_del(>list);
-   list_add(>list, >sample_cache);
-   os->nr_samples--;
+   list_add(>list, >cache);
+   q->nr_events--;
 
if (show_progress)
ui_progress__update(, 1);
}
 
-   if (list_empty(head)) {
-   os->last_sample = NULL;
-   } else if (last_ts <= limit) {
-   os->last_sample =
-   list_entry(head->prev, struct ordered_event, list);
-   }
+   if (list_empty(head))
+   q->last = NULL;
+   else if (last_ts <= limit)
+   q->last = list_entry(head->prev, struct ordered_event, list);
 
return 0;
 }
@@ -580,46 +578,46 @@ static int process_finished_round(struct perf_tool *tool,
 /* The queue is ordered by time */
 static void __queue_event(struct ordered_event *new, struct perf_session *s)
 {
-   struct ordered_events_queue *os = >ordered_events;
-   struct ordered_event *sample = os->last_sample;
+   struct ordered_events_queue *q = >ordered_events;
+   struct ordered_event *last = q->last;
u64 timestamp = new->timestamp;
struct list_head *p;
 
-   ++os->nr_samples;
-   os->last_sample = new;
+   ++q->nr_events;
+   q->last = new;
 
-   if (!sample) {
-   list_add(>list, >samples);
-   os->max_timestamp = timestamp;
+   if (!last) {
+   list_add(>list, >events);
+   q->max_timestamp = timestamp;
return;
}
 
/*
-* last_sample might point to some random place in the list as it's
-* the last queued event. We expect that the new event is close to
+* last event might point to some random place in the list as it's
+* the last queued event. We expect that the new event is clqe to
 * this.
 */

[PATCH 04/18] perf tools: Rename ordered_events_queue members

2014-06-18 Thread Jiri Olsa
Rename 'struct ordered_events_queue' members to better
fit the ordered events pattern.

Cc: Arnaldo Carvalho de Melo a...@kernel.org
Cc: Corey Ashford cjash...@linux.vnet.ibm.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Jean Pihet jean.pi...@linaro.org
Cc: Namhyung Kim namhy...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Signed-off-by: Jiri Olsa jo...@kernel.org
---
 tools/perf/util/session.c | 108 +++---
 tools/perf/util/session.h |  12 +++---
 2 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 315d522..fc4da58 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -76,8 +76,8 @@ struct perf_session *perf_session__new(struct perf_data_file 
*file,
goto out;
 
session-repipe = repipe;
-   INIT_LIST_HEAD(session-ordered_events.samples);
-   INIT_LIST_HEAD(session-ordered_events.sample_cache);
+   INIT_LIST_HEAD(session-ordered_events.events);
+   INIT_LIST_HEAD(session-ordered_events.cache);
INIT_LIST_HEAD(session-ordered_events.to_free);
machines__init(session-machines);
 
@@ -455,12 +455,12 @@ struct ordered_event {
 
 static void perf_session_free_sample_buffers(struct perf_session *session)
 {
-   struct ordered_events_queue *os = session-ordered_events;
+   struct ordered_events_queue *q = session-ordered_events;
 
-   while (!list_empty(os-to_free)) {
+   while (!list_empty(q-to_free)) {
struct ordered_event *sq;
 
-   sq = list_entry(os-to_free.next, struct ordered_event, list);
+   sq = list_entry(q-to_free.next, struct ordered_event, list);
list_del(sq-list);
free(sq);
}
@@ -475,12 +475,12 @@ static int perf_session_deliver_event(struct perf_session 
*session,
 static int ordered_events_flush(struct perf_session *s,
   struct perf_tool *tool)
 {
-   struct ordered_events_queue *os = s-ordered_events;
-   struct list_head *head = os-samples;
+   struct ordered_events_queue *q = s-ordered_events;
+   struct list_head *head = q-events;
struct ordered_event *tmp, *iter;
struct perf_sample sample;
-   u64 limit = os-next_flush;
-   u64 last_ts = os-last_sample ? os-last_sample-timestamp : 0ULL;
+   u64 limit = q-next_flush;
+   u64 last_ts = q-last ? q-last-timestamp : 0ULL;
bool show_progress = limit == ULLONG_MAX;
struct ui_progress prog;
int ret;
@@ -489,7 +489,7 @@ static int ordered_events_flush(struct perf_session *s,
return 0;
 
if (show_progress)
-   ui_progress__init(prog, os-nr_samples, Processing time 
ordered events...);
+   ui_progress__init(prog, q-nr_events, Processing time ordered 
events...);
 
list_for_each_entry_safe(iter, tmp, head, list) {
if (session_done())
@@ -508,21 +508,19 @@ static int ordered_events_flush(struct perf_session *s,
return ret;
}
 
-   os-last_flush = iter-timestamp;
+   q-last_flush = iter-timestamp;
list_del(iter-list);
-   list_add(iter-list, os-sample_cache);
-   os-nr_samples--;
+   list_add(iter-list, q-cache);
+   q-nr_events--;
 
if (show_progress)
ui_progress__update(prog, 1);
}
 
-   if (list_empty(head)) {
-   os-last_sample = NULL;
-   } else if (last_ts = limit) {
-   os-last_sample =
-   list_entry(head-prev, struct ordered_event, list);
-   }
+   if (list_empty(head))
+   q-last = NULL;
+   else if (last_ts = limit)
+   q-last = list_entry(head-prev, struct ordered_event, list);
 
return 0;
 }
@@ -580,46 +578,46 @@ static int process_finished_round(struct perf_tool *tool,
 /* The queue is ordered by time */
 static void __queue_event(struct ordered_event *new, struct perf_session *s)
 {
-   struct ordered_events_queue *os = s-ordered_events;
-   struct ordered_event *sample = os-last_sample;
+   struct ordered_events_queue *q = s-ordered_events;
+   struct ordered_event *last = q-last;
u64 timestamp = new-timestamp;
struct list_head *p;
 
-   ++os-nr_samples;
-   os-last_sample = new;
+   ++q-nr_events;
+   q-last = new;
 
-   if (!sample) {
-   list_add(new-list, os-samples);
-   os-max_timestamp = timestamp;
+   if (!last) {
+   list_add(new-list, q-events);
+   q-max_timestamp = timestamp;
return;
}
 
/*
-* last_sample might point to some random place in the list as it's
-