From patchwork Tue Mar 5 14:39:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10839553 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 4C1651390 for ; Tue, 5 Mar 2019 14:39:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38EA22C0BD for ; Tue, 5 Mar 2019 14:39:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D77F2C0BF; Tue, 5 Mar 2019 14:39:55 +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 CE86D2C0BE for ; Tue, 5 Mar 2019 14:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727424AbfCEOjy (ORCPT ); Tue, 5 Mar 2019 09:39:54 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41929 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbfCEOjy (ORCPT ); Tue, 5 Mar 2019 09:39:54 -0500 Received: by mail-wr1-f67.google.com with SMTP id n2so9727730wrw.8 for ; Tue, 05 Mar 2019 06:39:53 -0800 (PST) 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=0rVlCilypZXtg7OYqP+ypxxyEEBDfl2mZysOVwhRsAE=; b=nlBRYEJGe0TWRr4GDYU8JE+B2vhBA/z0JRkmoBJGACMNGinfaD9qCgmyDjHo5lMSfA dEeRhAt51MDJlDfjZa5TEafFyFsGjGf/qbwekoeCDzGF6bIrGpvcylPOb+wIBN2UUknL qSOT2rgovzcCf8X9y9EEFcN6iyvrXCOLJGCvtnXp4zxn0sGaZltUZPU5gQ8zAnBsX2wt xBXdAmdau0ABX+l4PWR6O/YhTKQ8zVvOnkhNDtYLaAZJDKk1GC+++jwC9rezwREPgaOZ HlYt7gCnKHKfID/PMhdmvWFwTo6tq/1UHCgiBo0K69ziv1Ve86MFMtYMIvHrvirLmmdh H7LQ== X-Gm-Message-State: APjAAAXJwlqDrmlwWFSsa36Q3RKFq1H0C2iQORLQG06JsYEZQv+1v4Ay 1EC93mrt9bf0QKvWcIs9dX5zBgR7 X-Google-Smtp-Source: APXvYqxi2eBUEiYGgT67UCpbx3UayGBXz82mDPn94kft+Le8ZiK27DEtV4AwwcMJRN/cJ4MCKWWUgA== X-Received: by 2002:a5d:6785:: with SMTP id v5mr17914891wru.59.1551796792654; Tue, 05 Mar 2019 06:39:52 -0800 (PST) Received: from mamba.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id o12sm31908915wre.0.2019.03.05.06.39.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 06:39:52 -0800 (PST) From: Yordan Karadzhov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, Yordan Karadzhov Subject: [PATCH 1/3] kernel-shark: Define free_contex function for the sched_events plugin Date: Tue, 5 Mar 2019 16:39:22 +0200 Message-Id: <20190305143924.11056-2-ykaradzhov@vmware.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190305143924.11056-1-ykaradzhov@vmware.com> References: <20190305143924.11056-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 This static helper function makes the code of the plugin cleaner and easier to read. Signed-off-by: Yordan Karadzhov Reviewed-by: Slavomir Kaslev --- kernel-shark/src/plugins/sched_events.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c index 68734d4..0d6de2d 100644 --- a/kernel-shark/src/plugins/sched_events.c +++ b/kernel-shark/src/plugins/sched_events.c @@ -39,6 +39,17 @@ static bool define_wakeup_event(struct tep_handle *tep, const char *wakeup_name, return true; } +static void plugin_free_context(struct plugin_sched_context *plugin_ctx) +{ + if (!plugin_ctx) + return; + + tracecmd_filter_id_hash_free(plugin_ctx->second_pass_hash); + kshark_free_collection_list(plugin_ctx->collections); + + free(plugin_ctx); +} + static bool plugin_sched_init_context(struct kshark_context *kshark_ctx) { struct plugin_sched_context *plugin_ctx; @@ -339,10 +350,7 @@ static int plugin_sched_close(struct kshark_context *kshark_ctx) plugin_sched_action, plugin_draw); - tracecmd_filter_id_hash_free(plugin_ctx->second_pass_hash); - - kshark_free_collection_list(plugin_ctx->collections); - free(plugin_ctx); + plugin_free_context(plugin_ctx); plugin_sched_context_handler = NULL; return 1;