From patchwork Wed Mar 13 15:07:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10851337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B78371575 for ; Wed, 13 Mar 2019 15:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39BE2877E for ; Wed, 13 Mar 2019 15:07:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97E8E29276; Wed, 13 Mar 2019 15:07:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E3482877E for ; Wed, 13 Mar 2019 15:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725876AbfCMPHt (ORCPT ); Wed, 13 Mar 2019 11:07:49 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34341 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfCMPHt (ORCPT ); Wed, 13 Mar 2019 11:07:49 -0400 Received: by mail-wm1-f66.google.com with SMTP id o10so4670443wmc.1 for ; Wed, 13 Mar 2019 08:07:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vEMKkG3s/JUgNbpBXoysD3tEBH/BFsvtW/Te48muOrc=; b=jTYqkSKrlWvpdRChuC/fl+IytTK2P1MRmLHWNfWQihneQt/kAx+LolcgYyNDG6mayB J0yGV7p5noGMjaesOPQEy0a4iMo+g8BwRxx2MrzLM3Cw7mmlYVx+Qh5AmICLI4WdMd/6 6x9kmn8HFhn1/4OVOKrObAqR0P9Anyqcfk16GV6zum+WZbIL3wqUbBa1RmL9khjKv7Io MlLto0vjOJKjRzwel6wxKo21fMIzl2FvL0BIVS3dtqFFTLBC8fawGSyAOkzoeDLgPk7m pkAjFoauEniGymkX+GpddX5K0wnGeVGLc8iDfWb0u6YLKwUxiV+Kx32Ioh9MG328Sk1G Nl8g== X-Gm-Message-State: APjAAAVdvYb3ifVvHxN7Lm9JksMP3pXGVTE/5T2lx/vPwLhsbokT6DHS iJtK431FkRrLxHyyVqA+I22eMu4z3k4= X-Google-Smtp-Source: APXvYqyzi+Swt6NC5qK/f/UVu/5HG4OiVkuku9b8pJK8qFl4tgpUrCGNIZVZ6M064U2JG9iXZJBRWw== X-Received: by 2002:a1c:7903:: with SMTP id l3mr2801560wme.22.1552489667586; Wed, 13 Mar 2019 08:07:47 -0700 (PDT) Received: from localhost.localdomain ([95.87.198.56]) by smtp.gmail.com with ESMTPSA id f6sm22515103wrs.45.2019.03.13.08.07.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Mar 2019 08:07:47 -0700 (PDT) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH v2 1/4] kernel-shark: Define addPlugins method for KsPluginManager Date: Wed, 13 Mar 2019 17:07:14 +0200 Message-Id: <20190313150717.21345-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313150717.21345-1-ykaradzhov@vmware.com> References: <20190313150717.21345-1-ykaradzhov@vmware.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The method can be used to register and load user-defined plugins. All other previously loaded plugins will be reinitialized and the data will be reloaded. Signed-off-by: Yordan Karadzhov --- kernel-shark/src/KsUtils.cpp | 23 +++++++++++++++++++++++ kernel-shark/src/KsUtils.hpp | 3 +++ 2 files changed, 26 insertions(+) diff --git a/kernel-shark/src/KsUtils.cpp b/kernel-shark/src/KsUtils.cpp index 3585cca..6af0c66 100644 --- a/kernel-shark/src/KsUtils.cpp +++ b/kernel-shark/src/KsUtils.cpp @@ -596,6 +596,29 @@ void KsPluginManager::unregisterPlugin(const QString &plugin) } } +/** @brief Add to the list and initialize user-provided plugins. All other + * previously loaded plugins will be reinitialized and the data will be + * reloaded. + * + * @param fileNames: the library files (.so) of the plugins. +*/ +void KsPluginManager::addPlugins(const QStringList &fileNames) +{ + kshark_context *kshark_ctx(nullptr); + + if (!kshark_instance(&kshark_ctx)) + return; + + kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_CLOSE); + + for (auto const &p: fileNames) + registerPlugin(p); + + kshark_handle_plugins(kshark_ctx, KSHARK_PLUGIN_INIT); + + emit dataReload(); +} + /** Unload all plugins. */ void KsPluginManager::unloadAll() { diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp index cb95b4f..c8b5e88 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 addPlugins(const QStringList &fileNames); + void unloadAll(); void updatePlugins(QVector pluginId);