Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/5] KernelShark: Add stream name
Date: Tue, 28 Jul 2020 09:21:33 -0400
Message-ID: <20200728092133.5dc59087@oasis.local.home> (raw)
In-Reply-To: <20200727071823.169962-2-tz.stoyanov@gmail.com>

On Mon, 27 Jul 2020 10:18:19 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> 
> There are use cases when multiple streams can be loaded from a single
> file. Ftrace instances are such example. In these cases file name could
> not be used to identify the streams. A new member 'name' is added to the
> 'struct kshark_data_stream', used to identify the streams by the user.
> By default name is equal to the file name, in cases where there is onle

 s/onle/only/

> one stream in the file the behaviour is not changed. When there are
> multiple streams in a single file, the name is formed as
> "file name:stream name".

Reviewed-by: Steven Rostedt (VMware) <rostedt@godmis.org>

-- Steve

> 
> Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> ---
>  src/KsAdvFilteringDialog.cpp   | 2 +-
>  src/KsWidgetsLib.cpp           | 6 +++---
>  src/libkshark-plugin.c         | 2 +-
>  src/libkshark.c                | 2 ++
>  src/libkshark.h                | 3 +++
>  src/plugins/KVMCombo.cpp       | 4 ++--
>  src/plugins/event_field_plot.c | 2 +-
>  src/plugins/latency_plot.c     | 4 ++--
>  8 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/src/KsAdvFilteringDialog.cpp b/src/KsAdvFilteringDialog.cpp
> index 64c4cec..6979903 100644
> --- a/src/KsAdvFilteringDialog.cpp
> +++ b/src/KsAdvFilteringDialog.cpp
> @@ -236,7 +236,7 @@ void KsAdvFilteringDialog::_getFtraceStreams(kshark_context *kshark_ctx)
>  	for (int i = 0; i < kshark_ctx->n_streams; ++i) {
>  		stream = kshark_ctx->stream[streamIds[i]];
>  		if (stream->format == KS_TEP_DATA)
> -			_streamComboBox.addItem(QString(stream->file),
> +			_streamComboBox.addItem(QString(stream->name),
>  						streamIds[i]);
>  	}
>  
> diff --git a/src/KsWidgetsLib.cpp b/src/KsWidgetsLib.cpp
> index e487eb8..f006a13 100644
> --- a/src/KsWidgetsLib.cpp
> +++ b/src/KsWidgetsLib.cpp
> @@ -325,7 +325,7 @@ void KsCheckBoxWidget::_setStream(uint8_t sd)
>  	if (!stream)
>  		return;
>  
> -	_streamName = QString(stream->file);
> +	_streamName = QString(stream->name);
>  
>  	KsUtils::setElidedText(&_stramLabel, _streamName,
>  			       Qt::ElideLeft, width());
> @@ -1148,7 +1148,7 @@ KsDStreamCheckBoxWidget::KsDStreamCheckBoxWidget(QWidget *parent)
>  
>  	for (int i = 0; i < nStreams; ++i) {
>  		stream = kshark_ctx->stream[streamIds[i]];
> -		QString name(stream->file);
> +		QString name(stream->name);
>  		if (name < 40) {
>  			nameItem = new QTableWidgetItem(name);
>  		} else {
> @@ -1235,7 +1235,7 @@ void KsEventFieldSelectWidget::setStreamCombo()
>  		sd = streamIds[i];
>  		stream = kshark_ctx->stream[sd];
>  		if (_streamComboBox.findData(sd) < 0)
> -			_streamComboBox.addItem(QString(stream->file), sd);
> +			_streamComboBox.addItem(QString(stream->name), sd);
>  	}
>  	free(streamIds);
>  }
> diff --git a/src/libkshark-plugin.c b/src/libkshark-plugin.c
> index d341fea..583ea42 100644
> --- a/src/libkshark-plugin.c
> +++ b/src/libkshark-plugin.c
> @@ -584,7 +584,7 @@ static void plugin_init(struct kshark_data_stream *stream,
>  		fprintf(stderr,
>  			"plugin \"%s\" failed to initialize on stream %s\n",
>  			plugin->interface->name,
> -			stream->file);
> +			stream->name);
>  
>  		plugin->status |= KSHARK_PLUGIN_FAILED;
>  		plugin->status &= ~KSHARK_PLUGIN_LOADED;
> diff --git a/src/libkshark.c b/src/libkshark.c
> index 7013d66..375874d 100644
> --- a/src/libkshark.c
> +++ b/src/libkshark.c
> @@ -137,6 +137,7 @@ static void kshark_stream_free(struct kshark_data_stream *stream)
>  
>  	free(stream->calib_array);
>  	free(stream->file);
> +	free(stream->name);
>  	free(stream);
>  }
>  
> @@ -255,6 +256,7 @@ int kshark_stream_open(struct kshark_data_stream *stream, const char *file)
>  		return -EAGAIN;
>  
>  	stream->file = strdup(file);
> +	stream->name = strdup(file);
>  	set_format(kshark_ctx, stream, file);
>  
>  	switch (stream->format) {
> diff --git a/src/libkshark.h b/src/libkshark.h
> index 0b9053d..44bec79 100644
> --- a/src/libkshark.h
> +++ b/src/libkshark.h
> @@ -238,6 +238,9 @@ struct kshark_data_stream {
>  	/** Trace data file pathname. */
>  	char			*file;
>  
> +	/** Stream name. */
> +	char			*name;
> +
>  	/** System clock calibration function. */
>  	time_calib_func		calib;
>  
> diff --git a/src/plugins/KVMCombo.cpp b/src/plugins/KVMCombo.cpp
> index 9b9d7a0..ceb1f47 100644
> --- a/src/plugins/KVMCombo.cpp
> +++ b/src/plugins/KVMCombo.cpp
> @@ -250,7 +250,7 @@ void KsComboPlotDialog::update()
>  		_guestMapCount = ret;
>  
>  	KsUtils::setElidedText(&_hostFileLabel,
> -			       kshark_ctx->stream[_guestMap[0].host_id]->file,
> +			       kshark_ctx->stream[_guestMap[0].host_id]->name,
>  			       Qt::ElideLeft, LABEL_WIDTH);
>  
>  	_guestStreamComboBox.clear();
> @@ -260,7 +260,7 @@ void KsComboPlotDialog::update()
>  		if (sd >= kshark_ctx->n_streams)
>  			continue;
>  
> -		_guestStreamComboBox.addItem(kshark_ctx->stream[sd]->file, sd);
> +		_guestStreamComboBox.addItem(kshark_ctx->stream[sd]->name, sd);
>  		color << colTable[sd];
>  		_guestStreamComboBox.setItemData(i, QBrush(color),
>  						    Qt::BackgroundRole);
> diff --git a/src/plugins/event_field_plot.c b/src/plugins/event_field_plot.c
> index fcc2a19..3c61cbf 100644
> --- a/src/plugins/event_field_plot.c
> +++ b/src/plugins/event_field_plot.c
> @@ -72,7 +72,7 @@ plugin_efp_init_context(struct kshark_data_stream *stream)
>  
>  	if (plugin_ctx->event_id < 0) {
>  		fprintf(stderr, "Event %s not found in stream %s\n",
> -			plugin_ctx->event_name, stream->file);
> +			plugin_ctx->event_name, stream->name);
>  		goto fail;
>  	}
>  
> diff --git a/src/plugins/latency_plot.c b/src/plugins/latency_plot.c
> index bcd27f6..e2238e4 100644
> --- a/src/plugins/latency_plot.c
> +++ b/src/plugins/latency_plot.c
> @@ -75,7 +75,7 @@ plugin_latency_init_context(struct kshark_data_stream *stream)
>  		stream->interface.find_event_id(stream, plugin_ctx->event_name[0]);
>  	if (plugin_ctx->event_id[0] < 0) {
>  		fprintf(stderr, "Event %s not found in stream %s\n",
> -			plugin_ctx->event_name[0], stream->file);
> +			plugin_ctx->event_name[0], stream->name);
>  		goto fail;
>  	}
>  
> @@ -83,7 +83,7 @@ plugin_latency_init_context(struct kshark_data_stream *stream)
>  		stream->interface.find_event_id(stream, plugin_ctx->event_name[1]);
>  	if (plugin_ctx->event_id[1] < 0) {
>  		fprintf(stderr, "Event %s not found in stream %s\n",
> -			plugin_ctx->event_name[1], stream->file);
> +			plugin_ctx->event_name[1], stream->name);
>  		goto fail;
>  	}
>  


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27  7:18 [PATCH 0/5] Add support for opening trace.dat files with multuiple buffers Tzvetomir Stoyanov (VMware)
2020-07-27  7:18 ` [PATCH 1/5] KernelShark: Add stream name Tzvetomir Stoyanov (VMware)
2020-07-28 13:21   ` Steven Rostedt [this message]
2020-07-27  7:18 ` [PATCH 2/5] KernelShark: Fix compilation issues on Fedora 32 Tzvetomir Stoyanov (VMware)
2020-07-28 13:23   ` Steven Rostedt
2020-07-27  7:18 ` [PATCH 3/5] KernelShark: Fix combo plot plugin crash in case of multiple streams Tzvetomir Stoyanov (VMware)
2020-07-28 13:26   ` Steven Rostedt
2020-07-27  7:18 ` [PATCH 4/5] KernelShark: Load trace.dat file with ftrace sub-buffers Tzvetomir Stoyanov (VMware)
2020-07-27  7:18 ` [PATCH 5/5] KernelShark: New libkshark API for loading all entries from given file Tzvetomir Stoyanov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200728092133.5dc59087@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git