* [PATCH 1/3]trace-cmd: remove dead code
@ 2011-03-10 9:57 Lai Jiangshan
2011-03-10 14:53 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Lai Jiangshan @ 2011-03-10 9:57 UTC (permalink / raw)
To: Steven Rostedt, LKML
filter_cpu related code is totally dead.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
trace-read.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/trace-read.c b/trace-read.c
index 0e9ced8..1cd9bd3 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -73,7 +73,6 @@ static const char *input_file;
static int multi_inputs;
static int max_file_size;
-static int filter_cpu = -1;
static int *filter_cpus;
static int nr_filter_cpus;
@@ -619,10 +618,6 @@ get_next_record(struct handle_list *handles, int *next_cpu)
record = tracecmd_read_data(handles->handle, next_cpu);
else
record = NULL;
-
- } else if (filter_cpu >= 0) {
- cpu = filter_cpu;
- record = tracecmd_read_data(handles->handle, cpu);
} else
record = tracecmd_read_next_data(handles->handle, &cpu);
@@ -963,10 +958,7 @@ void trace_report (int argc, char **argv)
case 0:
switch(option_index) {
case 0: /* cpu */
- if (filter_cpu)
- add_cpu(optarg);
- else
- filter_cpu = atoi(optarg);
+ add_cpu(optarg);
break;
case 1: /* events */
print_events = 1;
--
1.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/3]trace-cmd: remove dead code
2011-03-10 9:57 [PATCH 1/3]trace-cmd: remove dead code Lai Jiangshan
@ 2011-03-10 14:53 ` Steven Rostedt
2011-03-14 2:30 ` Lai Jiangshan
2011-03-14 2:39 ` [PATCH 1/3 V2]trace-cmd: " Lai Jiangshan
0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2011-03-10 14:53 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: LKML
On Thu, 2011-03-10 at 17:57 +0800, Lai Jiangshan wrote:
> filter_cpu related code is totally dead.
I'll rephrase this, as it is not dead. "dead" code is code that can not
be reached. This code most certainly can be reached. You may think it is
silly code, which it may be. The reason for the separation of one CPU
and multiple CPUs, is I do one CPU more often than I filter multiple,
and I wanted the 1 cpu to still be efficient.
-- Steve
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> trace-read.c | 10 +---------
> 1 files changed, 1 insertions(+), 9 deletions(-)
>
> diff --git a/trace-read.c b/trace-read.c
> index 0e9ced8..1cd9bd3 100644
> --- a/trace-read.c
> +++ b/trace-read.c
> @@ -73,7 +73,6 @@ static const char *input_file;
> static int multi_inputs;
> static int max_file_size;
>
> -static int filter_cpu = -1;
> static int *filter_cpus;
> static int nr_filter_cpus;
>
> @@ -619,10 +618,6 @@ get_next_record(struct handle_list *handles, int *next_cpu)
> record = tracecmd_read_data(handles->handle, next_cpu);
> else
> record = NULL;
> -
> - } else if (filter_cpu >= 0) {
> - cpu = filter_cpu;
> - record = tracecmd_read_data(handles->handle, cpu);
> } else
> record = tracecmd_read_next_data(handles->handle, &cpu);
>
> @@ -963,10 +958,7 @@ void trace_report (int argc, char **argv)
> case 0:
> switch(option_index) {
> case 0: /* cpu */
> - if (filter_cpu)
> - add_cpu(optarg);
> - else
> - filter_cpu = atoi(optarg);
> + add_cpu(optarg);
> break;
> case 1: /* events */
> print_events = 1;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/3]trace-cmd: remove dead code
2011-03-10 14:53 ` Steven Rostedt
@ 2011-03-14 2:30 ` Lai Jiangshan
2011-03-14 13:28 ` Steven Rostedt
2011-03-14 2:39 ` [PATCH 1/3 V2]trace-cmd: " Lai Jiangshan
1 sibling, 1 reply; 5+ messages in thread
From: Lai Jiangshan @ 2011-03-14 2:30 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML
On 03/10/2011 10:53 PM, Steven Rostedt wrote:
> On Thu, 2011-03-10 at 17:57 +0800, Lai Jiangshan wrote:
>> filter_cpu related code is totally dead.
>
> I'll rephrase this, as it is not dead. "dead" code is code that can not
> be reached. This code most certainly can be reached. You may think it is
> silly code, which it may be. The reason for the separation of one CPU
> and multiple CPUs, is I do one CPU more often than I filter multiple,
> and I wanted the 1 cpu to still be efficient.
>
I'm confused, filter_cpu is always -1, how the code can be reached?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3]trace-cmd: remove dead code
2011-03-14 2:30 ` Lai Jiangshan
@ 2011-03-14 13:28 ` Steven Rostedt
0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2011-03-14 13:28 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: LKML
On Mon, 2011-03-14 at 10:30 +0800, Lai Jiangshan wrote:
> On 03/10/2011 10:53 PM, Steven Rostedt wrote:
> > On Thu, 2011-03-10 at 17:57 +0800, Lai Jiangshan wrote:
> >> filter_cpu related code is totally dead.
> >
> > I'll rephrase this, as it is not dead. "dead" code is code that can not
> > be reached. This code most certainly can be reached. You may think it is
> > silly code, which it may be. The reason for the separation of one CPU
> > and multiple CPUs, is I do one CPU more often than I filter multiple,
> > and I wanted the 1 cpu to still be efficient.
> >
>
> I'm confused, filter_cpu is always -1, how the code can be reached?
Ah, you're right. Because of a bug:
- if (filter_cpu)
+ if (filter_cpu >= 0)
add_cpu(optarg);
else
filter_cpu = atoi(optarg);
Was what it was suppose to be.
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3 V2]trace-cmd: remove dead code
2011-03-10 14:53 ` Steven Rostedt
2011-03-14 2:30 ` Lai Jiangshan
@ 2011-03-14 2:39 ` Lai Jiangshan
1 sibling, 0 replies; 5+ messages in thread
From: Lai Jiangshan @ 2011-03-14 2:39 UTC (permalink / raw)
To: Steven Rostedt; +Cc: LKML
filter_cpu related code is totally dead.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
trace-read.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/trace-read.c b/trace-read.c
index 0e9ced8..88b576f 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -73,7 +73,6 @@ static const char *input_file;
static int multi_inputs;
static int max_file_size;
-static int filter_cpu = -1;
static int *filter_cpus;
static int nr_filter_cpus;
@@ -601,7 +600,7 @@ get_next_record(struct handle_list *handles, int *next_cpu)
do {
next = -1;
ts = 0;
- if (filter_cpus) {
+ if (nr_filter_cpus > 1) {
unsigned long long last_stamp = 0;
struct record *precord;
int next_cpu = -1;
@@ -619,9 +618,8 @@ get_next_record(struct handle_list *handles, int *next_cpu)
record = tracecmd_read_data(handles->handle, next_cpu);
else
record = NULL;
-
- } else if (filter_cpu >= 0) {
- cpu = filter_cpu;
+ } else if (nr_filter_cpus == 1) {
+ cpu = filter_cpus[0];
record = tracecmd_read_data(handles->handle, cpu);
} else
record = tracecmd_read_next_data(handles->handle, &cpu);
@@ -963,10 +961,7 @@ void trace_report (int argc, char **argv)
case 0:
switch(option_index) {
case 0: /* cpu */
- if (filter_cpu)
- add_cpu(optarg);
- else
- filter_cpu = atoi(optarg);
+ add_cpu(optarg);
break;
case 1: /* events */
print_events = 1;
--
1.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-14 13:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10 9:57 [PATCH 1/3]trace-cmd: remove dead code Lai Jiangshan
2011-03-10 14:53 ` Steven Rostedt
2011-03-14 2:30 ` Lai Jiangshan
2011-03-14 13:28 ` Steven Rostedt
2011-03-14 2:39 ` [PATCH 1/3 V2]trace-cmd: " Lai Jiangshan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox