From patchwork Tue Jun 26 23:56:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wysochanski X-Patchwork-Id: 10490321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28FED60325 for ; Tue, 26 Jun 2018 23:56:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A6B128702 for ; Tue, 26 Jun 2018 23:56:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EEB828708; Tue, 26 Jun 2018 23:56:29 +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 AEAA828702 for ; Tue, 26 Jun 2018 23:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751018AbeFZX40 (ORCPT ); Tue, 26 Jun 2018 19:56:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48260 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907AbeFZX4Z (ORCPT ); Tue, 26 Jun 2018 19:56:25 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0F0230832D1 for ; Tue, 26 Jun 2018 23:56:25 +0000 (UTC) Received: from f27-node1.dwysocha.net (dhcp145-42.rdu.redhat.com [10.13.145.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DFC88C9A1 for ; Tue, 26 Jun 2018 23:56:25 +0000 (UTC) From: Dave Wysochanski To: linux-nfs@vger.kernel.org Subject: [RFC PATCH 2/3] sunrpc: Add _add_rpc_iostats() to add rpc_iostats metrics Date: Tue, 26 Jun 2018 19:56:22 -0400 Message-Id: <20180626235623.26898-3-dwysocha@redhat.com> In-Reply-To: <20180626235623.26898-1-dwysocha@redhat.com> References: <20180626235623.26898-1-dwysocha@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 26 Jun 2018 23:56:25 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a helper function to add the metrics in two rpc_iostats structures. Signed-off-by: Dave Wysochanski --- net/sunrpc/stats.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 6606d7b3113a..32adddd7fb78 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -208,6 +208,18 @@ static void _print_name(struct seq_file *seq, unsigned int op, seq_printf(seq, "\t%12u: ", op); } +static void _add_rpc_iostats(struct rpc_iostats *a, struct rpc_iostats *b) +{ + a->om_ops += b->om_ops; + a->om_ntrans += b->om_ntrans; + a->om_timeouts += b->om_timeouts; + a->om_bytes_sent += b->om_bytes_sent; + a->om_bytes_recv += b->om_bytes_recv; + a->om_queue = ktime_add(a->om_queue, b->om_queue); + a->om_rtt = ktime_add(a->om_rtt, b->om_rtt); + a->om_execute = ktime_add(a->om_execute, b->om_execute); +} + static void _print_rpc_iostats(struct seq_file *seq, struct rpc_iostats *stats, int op, const struct rpc_procinfo *procs) {