From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 07/20] kernel-shark: Add basic methods for Data streams
Date: Tue, 3 Nov 2020 15:38:33 +0200 [thread overview]
Message-ID: <fcb51e5e-c60f-0b58-198a-6f9d01942a76@gmail.com> (raw)
In-Reply-To: <20201029215734.2531c5af@oasis.local.home>
On 30.10.20 г. 3:57 ч., Steven Rostedt wrote:
> On Thu, 29 Oct 2020 16:49:03 +0200
> "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
>
>> Maybe I don't understand your idea very well, but I think what you
>> suggest has very different behavior. What I want is the implementation
>> of the interface to stay in the same header file (libkshark.h). In the
>> future we can add more interfaces but this will be again in the same
>> header (libkshark.h).
>
> Maybe I got confused ;-)
>
> Is there going to be different interface structures? Why the "void *"
> and not just supply a "struct kshark_data_stream *"?
Hi Steven,
Yes, my idea is that in the future we may decide to change something in
the interface, or to have a second completely different interface, while
we may still need to keep the interface version that we have now for
backward compatibility.
>
> That way at least you have some kind of type checking when tasks move
> things around. I try to avoid using "void *" because it can easily be
> the source of unwanted bugs, due to the lack of type checking.
What if we define the interface to start with an integer identifier?
/** Data interface identifier. */
typedef enum kshark_data_interface_id {
/** An interface with unknown type. */
KS_INVALIDE_INTERFACE,
/** Generic interface suitable Ftrace data. */
KS_GENERIC_DATA_INTERFACE,
} kshark_data_interface_id;
/**
* Structure representing the interface of methods used to operate over
* the data from a given stream.
*/
struct kshark_generic_stream_interface {
/** Interface version identifier. */
int type; /* MUST BE FIRST ENTRY */
/** Method used to retrieve the Process Id of the entry. */
stream_get_int_func get_pid;
/** Method used to retrieve the Event Id of the entry. */
stream_get_int_func get_event_id;
....
and it can be used like this:
char *kshark_get_aux_field(const struct kshark_entry *entry)
{
struct kshark_generic_stream_interface *interface;
struct kshark_data_stream *stream =
kshark_get_stream_from_entry(entry);
....
interface = stream->interface;
if (interface->type == KS_GENERIC_DATA_INTERFACE &&
interface->aux_field)
return interface->aux_field(stream, entry);
return NULL;
}
What do you think?
Thanks a lot!
Yordan
>
> -- Steve
>
next prev parent reply other threads:[~2020-11-03 13:38 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 13:35 [PATCH v2 00/20] Start KernelShark v2 transformation Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 01/20] kernel-shark: Start introducing KernelShark 2.0 Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 02/20] kernel-shark: Use only signed types in kshark_entry Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 03/20] kernel-shark: Introduce libkshark-hash Yordan Karadzhov (VMware)
2020-10-12 14:05 ` Steven Rostedt
2020-10-12 14:05 ` Steven Rostedt
2020-10-12 14:18 ` Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 04/20] kernel-shark: Introduce Data streams Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 05/20] kernel-shark: Add stream_id to kshark_entry Yordan Karadzhov (VMware)
2020-10-13 0:05 ` Steven Rostedt
2020-10-29 10:08 ` Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 06/20] kernel-shark: Rename static methods in libkshark Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 07/20] kernel-shark: Add basic methods for Data streams Yordan Karadzhov (VMware)
2020-10-13 0:18 ` Steven Rostedt
2020-10-29 10:10 ` Yordan Karadzhov (VMware)
2020-10-29 14:04 ` Steven Rostedt
2020-10-29 14:49 ` Yordan Karadzhov (VMware)
2020-10-30 1:57 ` Steven Rostedt
2020-11-03 13:38 ` Yordan Karadzhov (VMware) [this message]
2020-11-04 15:41 ` Steven Rostedt
2020-11-05 14:35 ` Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 08/20] kernel-shark: Housekeeping before implementing stream interface Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 09/20] kernel-shark: Add stream interface for trace-cmd data Yordan Karadzhov (VMware)
2020-10-13 0:44 ` Steven Rostedt
2020-10-29 11:16 ` Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 10/20] kernel-shark: Start using data streams Yordan Karadzhov (VMware)
2020-10-14 18:56 ` Steven Rostedt
2020-11-05 14:58 ` Yordan Karadzhov (VMware)
2020-11-05 18:17 ` Steven Rostedt
2020-11-06 14:31 ` Yordan Karadzhov (VMware)
2020-11-06 15:18 ` Steven Rostedt
2020-11-09 14:49 ` Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 11/20] kernel-shark: Remove dead code Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 12/20] kernel-shark: Redesign the plugin interface Yordan Karadzhov (VMware)
2020-10-14 21:09 ` Steven Rostedt
2020-10-12 13:35 ` [PATCH v2 13/20] kernel-shark: Complete the stream integration Yordan Karadzhov (VMware)
2020-10-14 23:52 ` Steven Rostedt
2020-10-12 13:35 ` [PATCH v2 14/20] kernel-shark: Provide merging of multiple data streams Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 15/20] kernel-shark: Integrate the stream definitions with data model Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 16/20] kernel-shark: Use only signed types for model defs Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 17/20] kernel-shark: Add ksmodel_get_bin() Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 18/20] kernel-shark: Protect ksmodel_set_in_range_bining() Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 19/20] kernel-shark: Add methods for time calibration Yordan Karadzhov (VMware)
2020-10-12 13:35 ` [PATCH v2 20/20] kernel-shark: Integrate streams with libkshark-configio Yordan Karadzhov (VMware)
2020-11-05 19:22 ` Steven Rostedt
2020-11-09 14:55 ` Yordan Karadzhov (VMware)
2020-11-09 15:28 ` Steven Rostedt
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=fcb51e5e-c60f-0b58-198a-6f9d01942a76@gmail.com \
--to=y.karadz@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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).