From: Slavomir Kaslev <slavomir.kaslev@gmail.com>
To: Yordan Karadzhov <ykaradzhov@vmware.com>
Cc: Steven Rostedt <rostedt@goodmis.org>, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/4] kernel-shark: Define addPlugin method for KsPluginManager
Date: Mon, 11 Mar 2019 14:31:02 +0200 [thread overview]
Message-ID: <CAE0o1Nv7xkKyFnpYYT4vfpwpQYc_LiNKPuv7aAf7PYUoEUkCTQ@mail.gmail.com> (raw)
In-Reply-To: <20190308171405.15266-2-ykaradzhov@vmware.com>
On Fri, Mar 8, 2019 at 7:14 PM Yordan Karadzhov <ykaradzhov@vmware.com> wrote:
>
> The method can be used to register and load a user-defined plugin.
> All other previously loaded plugins will be reloaded.
>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> ---
> kernel-shark/src/KsUtils.cpp | 17 +++++++++++++++++
> kernel-shark/src/KsUtils.hpp | 3 +++
> 2 files changed, 20 insertions(+)
>
> diff --git a/kernel-shark/src/KsUtils.cpp b/kernel-shark/src/KsUtils.cpp
> index d7b1753..4d05bda 100644
> --- a/kernel-shark/src/KsUtils.cpp
> +++ b/kernel-shark/src/KsUtils.cpp
> @@ -596,6 +596,23 @@ void KsPluginManager::unregisterPlugin(const QString &plugin)
> }
> }
>
> +/** @brief Add to the list and load a user-provided plugin. All other
> + * previously loaded plugins will be reloaded.
> + *
> + * @param fileName: the library file (.so) of the plugin.
> +*/
> +void KsPluginManager::addPlugin(const QString &fileName)
> +{
> + kshark_context *kshark_ctx(nullptr);
> +
> + if (!kshark_instance(&kshark_ctx))
> + return;
> +
> + kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_CLOSE);
> + registerPlugin(fileName);
> + kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_INIT);
> +}
Calling addPlugin() several times in a row will reinitialize all
already registered plugins several times and lead to quadratic
complexity. This seems wrong to me.
Maybe we should split adding plugins from (re-)initializing them so
that one can add several plugins and then have initialized once when
they are actually needed to run. Wdyt?
--Slavi
> +
> /** Unload all plugins. */
> void KsPluginManager::unloadAll()
> {
> diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp
> index cb95b4f..ae7f6d1 100644
> --- a/kernel-shark/src/KsUtils.hpp
> +++ b/kernel-shark/src/KsUtils.hpp
> @@ -210,6 +210,9 @@ public:
>
> void registerPlugin(const QString &plugin);
> void unregisterPlugin(const QString &plugin);
> +
> + void addPlugin(const QString &fileName);
> +
> void unloadAll();
>
> void updatePlugins(QVector<int> pluginId);
> --
> 2.19.1
>
--
Slavomir Kaslev
next prev parent reply other threads:[~2019-03-11 12:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 17:14 [PATCH 0/4] Add dialog for loading user-defined plugins Yordan Karadzhov
2019-03-08 17:14 ` [PATCH 1/4] kernel-shark: Define addPlugin method for KsPluginManager Yordan Karadzhov
2019-03-11 12:31 ` Slavomir Kaslev [this message]
2019-03-11 17:39 ` Yordan Karadzhov
2019-03-11 22:08 ` Steven Rostedt
2019-03-08 17:14 ` [PATCH 2/4] kernel-shark: Add dialog for user-defined plugin to the Tools menu Yordan Karadzhov
2019-03-08 17:14 ` [PATCH 3/4] kernel-shark: Rename the manu action for managing registered plugins Yordan Karadzhov
2019-03-08 17:14 ` [PATCH 4/4] kernel-shark: Add icons for "Add plugin" and "Manage plugins" Yordan Karadzhov
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=CAE0o1Nv7xkKyFnpYYT4vfpwpQYc_LiNKPuv7aAf7PYUoEUkCTQ@mail.gmail.com \
--to=slavomir.kaslev@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=ykaradzhov@vmware.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).