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: Thu, 2 Aug 2018 15:59:39 +0300	[thread overview]
Message-ID: <a886af06-9a25-7c4a-e147-d970e9b9fd08@gmail.com> (raw)
In-Reply-To: <20180801142244.3ed8a35c@gandalf.local.home>



On  1.08.2018 21:22, Steven Rostedt wrote:
>> +	/*
>> +	 * Calculate the new range of the histo. Use the bin of the marker
>> +	 * as a focal point for the zoomout. With this the maker will stay
>> +	 * inside the same bin in the new histo.
>> +	 */
>> +	range = histo->max - histo->min;
>> +	delta_tot = range * r;
>> +	delta_min = delta_tot * mark / histo->n_bins;
>> +
>> +	min = histo->min - delta_min;
>> +	max = histo->max + (size_t) delta_tot - delta_min;
> Took me a bit to figure out what exactly the above is doing. Let me
> explain what I think it is doing and you can correct me if I'm wrong.
> 
> We set delta_tot to increase by the percentage requested (easy).
> 
> Now we make delta_min equal to a percentage of delta_tot based on where
> mark is in the original bins. If mark is zero, then mark was at 0% of
> the original bins, if it was at histo->n_bins - 1, it was at (almost)
> 100%. If it is half way, then we place delta_min at %50 of delta_tot.
> 
> Then we subtract the original min by the delta_tot * mark/n_bins
> percentage, and add the max by delta_tot * (1 - mark/n_bins).
> 
> Sound right? Maybe we can add a comment saying such?
> 

Yes, this is a correct explanation. I will use it as a comment in the code.

Thanks!
Yordan

  reply	other threads:[~2018-08-02 14:50 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) [this message]
2018-08-01 18:44   ` Steven Rostedt
2018-08-03 14:01     ` Yordan Karadzhov (VMware)
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=a886af06-9a25-7c4a-e147-d970e9b9fd08@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.