Skip to contentSkip to conversation

trace-cmd: fix report not working with instances

PATCH New Josef Bacik 1 participant 1 message Jul 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: fix report not working with instances

We unconditionally call trace_init_profile in read_data_info, even if we don't have profile set. This causes trace-cmd report to fail out if you recorded using instances because the profile stuff doesn't find the handle for the instance when it does the record. So do 2 things

1) Only call trace_init_profile if we actually specified --profile.

2) Make sure to call trace_init_profile for all of the instance handles so that we get all the info we want and don't bail out.

With this patch I can now do trace-cmd report on a trace.dat file that only had events in instances. Thanks,

---
 trace-read.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
trace-read.c +4 -1
index 103bc0c..50e7a5d 100644
@@ -1066,7 +1066,6 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
 			last_hook->next = tracecmd_hooks(handles->handle);
 		else
 			hooks = tracecmd_hooks(handles->handle);
-		trace_init_profile(handles->handle, hooks, global);
 
 		process_filters(handles);
 
@@ -1087,7 +1086,11 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
 					continue;
 				}
 				add_handle(new_handle, name);
+				if (profile)
+					trace_init_profile(new_handle, hooks, global);
 			}
+		} else if (profile) {
+			trace_init_profile(handles->handle, hooks, global);
 		}
 	}
 
Signature · 1 line
2.1.0