Skip to contentSkip to conversation

Don't spam trace report about missing fields

PATCH In review Avi Kivity 2 participants 3 messages Nov 29, 2010 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 Don't spam trace report about missing fields

Instead of spamming the output with complaints about missing fields, simply return an error to the caller, which can print something out or do something more intelligent about them.

Fixes kvm plugin tracing older kernels.

---
 parse-events.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
parse-events.c +3 -12
index f0b0324..7a4c3a6 100644
@@ -4446,17 +4446,11 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
 		  const char *name, struct record *record,
 		  unsigned long long *val, int err)
 {
-	if (!field) {
-		if (err)
-			trace_seq_printf(s, "<CANT FIND FIELD %s>", name);
+	if (!field)
 		return -1;
-	}
 
-	if (pevent_read_number_field(field, record->data, val)) {
-		if (err)
-			trace_seq_printf(s, " %s=INVALID", name);
+	if (pevent_read_number_field(field, record->data, val))
 		return -1;
-	}
 
 	return 0;
 }
@@ -4489,11 +4483,8 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
 
 	field = pevent_find_field(event, name);
 
-	if (!field) {
-		if (err)
-			trace_seq_printf(s, "<CANT FIND FIELD %s>", name);
+	if (!field)
 		return NULL;
-	}
 
 	/* Allow @len to be NULL */
 	if (!len)
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · Avi Kivity

Instead of spamming the output with complaints about missing fields, simply return an error to the caller, which can print something out or do something more intelligent about them.

Fixes kvm plugin tracing older kernels.

Hmm, what about just passing in err=0?

-- Steve

Quoted 43 lines
---
 parse-events.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
parse-events.c +3 -12
index f0b0324..7a4c3a6 100644
@@ -4446,17 +4446,11 @@ int get_field_val(struct trace_seq *s, struct format_field *field,
 		  const char *name, struct record *record,
 		  unsigned long long *val, int err)
 {
-	if (!field) {
-		if (err)
-			trace_seq_printf(s, "<CANT FIND FIELD %s>", name);
+	if (!field)
 		return -1;
-	}
 
-	if (pevent_read_number_field(field, record->data, val)) {
-		if (err)
-			trace_seq_printf(s, " %s=INVALID", name);
+	if (pevent_read_number_field(field, record->data, val))
 		return -1;
-	}
 
 	return 0;
 }
@@ -4489,11 +4483,8 @@ void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
 
 	field = pevent_find_field(event, name);
 
-	if (!field) {
-		if (err)
-			trace_seq_printf(s, "<CANT FIND FIELD %s>", name);
+	if (!field)
 		return NULL;
-	}
 
 	/* Allow @len to be NULL */
 	if (!len)
author
#2 lore raw
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · Avi Kivity

Instead of spamming the output with complaints about missing fields, simply return an error to the caller, which can print something out or do something more intelligent about them.

Fixes kvm plugin tracing older kernels.

Hmm, what about just passing in err=0?

I was just patching the printk out it mindlessly. Will send a new patch.

Signature · 1 line
error compiling committee.c: too many arguments to function