From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v3 2/6] kernel-shark-qt: Introduce the visualization model used by the Qt-based KS
Date: Fri, 3 Aug 2018 17:48:52 -0400 [thread overview]
Message-ID: <20180803174852.6ee5c889@gandalf.local.home> (raw)
In-Reply-To: <20180803142937.3970-3-y.karadz@gmail.com>
On Fri, 3 Aug 2018 17:29:33 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> --- /dev/null
> +++ b/kernel-shark-qt/src/libkshark-model.h
> @@ -0,0 +1,149 @@
> +/* SPDX-License-Identifier: LGPL-2.1 */
> +
> +/*
> + * Copyright (C) 2017 VMware Inc, Yordan Karadzhov <y.karadz@gmail.com>
> + */
> +
> + /**
> + * @file libkshark-model.h
> + * @brief Visualization model for FTRACE (trace-cmd) data.
> + */
> +
> +#ifndef _LIB_KSHARK_MODEL_H
> +#define _LIB_KSHARK_MODEL_H
> +
> +// KernelShark
> +#include "libkshark.h"
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif // __cplusplus
> +
> +/**
> + * Overflow Bin identifiers. The two overflow bins are used to hold the data
> + * outside the visualized range.
> + */
> +enum OverflowBin {
> + /**
> + * Identifier of the Upper Overflow Bin. This bin is used to hold the data
> + * before (in time) the beginning of the visualized range.
> + */
> + UPPER_OVERFLOW_BIN = -1,
> +
> + /** Identifier of the Lower Overflow Bin. This bin is used to hold the data
> + * after (in time) the end of the visualized range.*/
> + LOWER_OVERFLOW_BIN = -2,
Wait, I thought the upper overflow bin was to store the data after the
visualized range and the lower overnflow bin the time before?
> +};
> +
> +/** Structure describing the current state of the visualization model. */
> +static size_t ksmodel_set_lower_edge(struct kshark_trace_histo *histo)
> +{
> + /*
> + * Find the index of the first entry inside
> + * the range (timestamp > min).
> + */
> + ssize_t row = kshark_find_entry_by_time(histo->min,
> + histo->data,
> + 0,
> + histo->data_size - 1);
> +
> + assert(row != BSEARCH_ALL_SMALLER);
> +
> + if (row == BSEARCH_ALL_GREATER || row == 0) {
LOB(hist) is set by the lower row (which is less in time isn't it?)
> + /* Lower Overflow bin is empty. */
> + histo->map[LOB(histo)] = KS_EMPTY_BIN;
> + histo->bin_count[LOB(histo)] = 0;
> + row = 0;
> + } else {
> + /*
> + * The first entry inside the range is not the first entry
> + * of the dataset. This means that the Lower Overflow bin
> + * contains data.
> + */
> +
> + /* Lower Overflow bin starts at "0". */
> + histo->map[LOB(histo)] = 0;
> +
> + /*
> + * The number of entries inside the Lower Overflow bin is
> + * equal to the index of the first entry inside the range.
> + */
> + histo->bin_count[LOB(histo)] = row;
> + }
> +
> + /*
> + * Now check if the first entry inside the range falls into the
> + * first bin.
> + */
> + if (histo->data[row]->ts < histo->min + histo->bin_size) {
> + /*
> + * It is inside the first bin. Set the beginning
> + * of the first bin.
> + */
> + histo->map[0] = row;
> + } else {
> + /* The first bin is empty. */
> + histo->map[0] = KS_EMPTY_BIN;
> + }
> +
> + return row;
> +}
> +
> +static size_t ksmodel_set_upper_edge(struct kshark_trace_histo *histo)
> +{
> + /*
> + * Find the index of the first entry outside the range
> + * (timestamp > max). Remember that kshark_find_entry_by_time returns
> + * the first entry which is equal or greater than the reference time.
> + */
> + ssize_t row = kshark_find_entry_by_time(histo->max + 1,
> + histo->data,
> + 0,
> + histo->data_size - 1);
> +
> + assert(row != BSEARCH_ALL_GREATER);
> +
> + if (row == BSEARCH_ALL_SMALLER || row == histo->data_size - 1) {
UOB(histo) is set by the highest row. Right?
-- Steve
> + /* Upper Overflow bin is empty. */
> + histo->map[UOB(histo)] = KS_EMPTY_BIN;
> + histo->bin_count[UOB(histo)] = 0;
> + } else {
> + /*
> + * The Upper Overflow bin contains data. Set its beginning
> + * and the number of entries.
> + */
> + histo->map[UOB(histo)] = row;
> + histo->bin_count[UOB(histo)] = histo->data_size - row;
> + }
> +
> + return row;
> +}
> +
next prev parent reply other threads:[~2018-08-03 23:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-03 14:29 [PATCH v3 0/6] Add visualization model for the Qt-based KernelShark Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 1/6] kernel-shark-qt: Add generic instruments for searching inside the trace data Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 2/6] kernel-shark-qt: Introduce the visualization model used by the Qt-based KS Yordan Karadzhov (VMware)
2018-08-03 18:43 ` Steven Rostedt
2018-08-03 21:48 ` Steven Rostedt [this message]
2018-08-06 14:24 ` Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 3/6] kernel-shark-qt: Add an example showing how to manipulate the Vis. model Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 4/6] kernel-shark-qt: Define Data collections Yordan Karadzhov (VMware)
2018-08-04 2:27 ` Steven Rostedt
2018-08-06 16:08 ` Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 5/6] kernel-shark-qt: Make the Vis. model use " Yordan Karadzhov (VMware)
2018-08-03 14:29 ` [PATCH v3 6/6] 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=20180803174852.6ee5c889@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=y.karadz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).