All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
Subject: Re: [PATCH v2 3/7] kernel-shark-qt: Introduce the visualization model used by the Qt-based KS
Date: Fri, 3 Aug 2018 17:01:45 +0300	[thread overview]
Message-ID: <f89ed00a-2411-7540-bfea-8c40a6d3dcac@gmail.com> (raw)
In-Reply-To: <20180801144413.227e0dea@gandalf.local.home>



On  1.08.2018 21:44, Steven Rostedt wrote:
>> +
>> +/**
>> + * @brief In a given bin, start from the front end of the bin and go towards
>> + *	  the back end, searching for an entry satisfying the Matching
>> + *	  condition defined by a Matching condition function.
>> + * @param histo: Input location for the model descriptor.
>> + * @param bin: Bin id.
>> + * @param vis_only: If true, a visible entry is requested.
>> + * @param func: Matching condition function.
>> + * @param val: Matching condition value, used by the Matching condition
>> + *	       function.
>> + * @param index: Optional output location for the index of the requested
>> + *		 entry inside the array.
>> + * @returns Pointer ot a kshark_entry, if an entry has been found. Else NULL.
>> + */
>> +const struct kshark_entry *
>> +ksmodel_get_entry_front(struct kshark_trace_histo *histo,
>> +			int bin, bool vis_only,
>> +			matching_condition_func func, int val,
>> +			ssize_t *index)
>> +{
>> +	struct kshark_entry_request *req;
>> +	const struct kshark_entry *entry;
>> +
>> +	if (index)
>> +		*index = KS_EMPTY_BIN;
>> +
>> +	/* Set the position at the beginning of the bin and go forward. */
>> +	req = ksmodel_entry_front_request_alloc(histo, bin, vis_only,
>> +							    func, val);
>> +	if (!req)
>> +		return NULL;
>> +
>> +	entry = kshark_get_entry_front(req, histo->data, index);
>> +	free(req);
>> +
>> +	return entry;
>> +}
> We could save on the allocation if we were to create the following:
> 
> void
> kshark_entry_request_set(struct kshark_entry_request *req,
> 			 size_t first, size_t n,
> 			 matching_condition_func cond, int val,
> 			 bool vis_only, int vis_mask)
> {
> 	req->first = first;
> 	req->n = n;
> 	req->cond = cond;
> 	req->val = val;
> 	req->vis_only = vis_only;
> 	req->vis_mask = vis_mask;
> }
> 
> bool
> ksmodel_entry_front_request_set(struct kshark_trace_histo *histo,
> 				struct kshark_entry_request *req,
> 				int bin, bool vis_only,
> 				matching_condition_func func, int val)
> {
> 	size_t first, n;
> 
> 	/* Get the number of entries in this bin. */
> 	n = ksmodel_bin_count(histo, bin);
> 	if (!n)
> 		return false;
> 
> 	first = ksmodel_first_index_at_bin(histo, bin);
> 
> 	kshark_entry_request_set(first, n,
> 			       func, val,
> 			       vis_only, KS_GRAPH_VIEW_FILTER_MASK);
> 
> 	return true;
> }
> 
> const struct kshark_entry *
> ksmodel_get_entry_front(struct kshark_trace_histo *histo,
> 			int bin, bool vis_only,
> 			matching_condition_func func, int val,
> 			ssize_t *index)
> {
> 	struct kshark_entry_request req;
> 	const struct kshark_entry *entry;
> 	bool ret;
> 
> 	if (index)
> 		*index = KS_EMPTY_BIN;
> 
> 	/* Set the position at the beginning of the bin and go forward. */
> 	ret = ksmodel_entry_front_request_set(histo, bin, vis_only,
> 							    func, val);
> 	if (!ret)
> 		return NULL;
> 
> 	entry = kshark_get_entry_front(req, histo->data, index);
> 
> 	return entry;
> }
> 

Hi Steven,
I have tried implementing this, but it becomes a bit ugly in the 
following patches where the single request is transformed into a linked 
list of requests.

Thanks!
Yordan

  reply	other threads:[~2018-08-03 15:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 13:52 [PATCH v2 0/7] Add visualization model for the Qt-based KernelShark Yordan Karadzhov (VMware)
2018-07-31 13:52 ` [PATCH v2 1/7] kernel-shark-qt: Change the type of the fields in struct kshark_entry Yordan Karadzhov (VMware)
2018-07-31 13:52 ` [PATCH v2 2/7] kernel-shark-qt: Add generic instruments for searching inside the trace data Yordan Karadzhov (VMware)
2018-07-31 21:43   ` Steven Rostedt
2018-07-31 13:52 ` [PATCH v2 3/7] kernel-shark-qt: Introduce the visualization model used by the Qt-based KS Yordan Karadzhov (VMware)
2018-08-01  0:51   ` Steven Rostedt
2018-08-01 16:10     ` Yordan Karadzhov
2018-08-03 18:48     ` Steven Rostedt
2018-08-01  1:43   ` Steven Rostedt
2018-08-01 18:22   ` Steven Rostedt
2018-08-02 12:59     ` Yordan Karadzhov (VMware)
2018-08-01 18:44   ` Steven Rostedt
2018-08-03 14:01     ` Yordan Karadzhov (VMware) [this message]
2018-08-03 16:00       ` Steven Rostedt
2018-08-01 18:50   ` Steven Rostedt
2018-08-01 19:06     ` Yordan Karadzhov
2018-08-01 19:11       ` Steven Rostedt
2018-07-31 13:52 ` [PATCH v2 4/7] kernel-shark-qt: Add an example showing how to manipulate the Vis. model Yordan Karadzhov (VMware)
2018-07-31 13:52 ` [PATCH v2 5/7] kernel-shark-qt: Define Data collections Yordan Karadzhov (VMware)
2018-07-31 13:52 ` [PATCH v2 6/7] kernel-shark-qt: Make the Vis. model use " Yordan Karadzhov (VMware)
2018-07-31 13:52 ` [PATCH v2 7/7] kernel-shark-qt: Changed the KernelShark version identifier Yordan Karadzhov (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=f89ed00a-2411-7540-bfea-8c40a6d3dcac@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.