Re: [PATCH] kernel-shark-2.alpha: Use new tracecmd API to open guest tracing file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1.04.20 г. 19:45 ч., Tzvetomir Stoyanov (VMware) wrote:
From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@xxxxxxxxx>

The new tracecmd API tracecmd_open_merge() is used to open guest
tracing file and synchronize it to the host file.
This change is for testing purposes only, to test the new per CPU
timestamps synchronization logic.
It assumes that the stream with id 0 is the host one, and all others are
guest streams.
This change depends on commit:
  "trace-cmd: Add new API to merge two trace files"
where the new tracecmd API is introduced.

Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@xxxxxxxxx>
---
  src/libkshark-tepdata.c | 13 +++++++++++--
  1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/libkshark-tepdata.c b/src/libkshark-tepdata.c
index 8678e12..b80b945 100644
--- a/src/libkshark-tepdata.c
+++ b/src/libkshark-tepdata.c
@@ -1008,8 +1008,17 @@ int kshark_tep_init_input(struct kshark_data_stream *stream,
  	tep_handle = calloc(1, sizeof(*tep_handle));
  	if (!tep_handle)
  		return -EFAULT;
-
-	tep_handle->input = tracecmd_open(file);

Hi Ceco,

Is it possible to avoid the hard-coded ID number of the primary stream (zero in this case)?

Maybe we can add data field to "struct tepdata_handle" that can be used to indicate if the stream is "primary" or not. Note that "struct tepdata_handle" is defined only for "libkshark-tepdata.c".

Also do we consider a case when we will need to load more than one "primary" stream?

Thanks!
Yordan


+	if (stream->stream_id > 0) {
+		struct kshark_data_stream *primary;
+
+		primary = kshark_get_data_stream(kshark_ctx, 0);
+		if (primary && primary->file)
+			tep_handle->input = tracecmd_open_merge(file,
+								primary->file);
+		else
+			tep_handle->input = tracecmd_open(file);
+	} else
+		tep_handle->input = tracecmd_open(file);
  	if (!tep_handle->input) {
  		free(tep_handle);
  		stream->interface.handle = NULL;




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux