From patchwork Tue Feb 7 08:51:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Pricope X-Patchwork-Id: 93519 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp2135834obz; Tue, 7 Feb 2017 00:51:17 -0800 (PST) X-Received: by 10.107.38.145 with SMTP id m139mr3106645iom.56.1486457477796; Tue, 07 Feb 2017 00:51:17 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id c129si6631991ita.83.2017.02.07.00.51.17; Tue, 07 Feb 2017 00:51:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D88B362DC3; Tue, 7 Feb 2017 08:51:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9758660746; Tue, 7 Feb 2017 08:51:08 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0801960746; Tue, 7 Feb 2017 08:51:06 +0000 (UTC) Received: from mail-ot0-f172.google.com (mail-ot0-f172.google.com [74.125.82.172]) by lists.linaro.org (Postfix) with ESMTPS id 65D3C60DC9 for ; Tue, 7 Feb 2017 08:51:02 +0000 (UTC) Received: by mail-ot0-f172.google.com with SMTP id 32so81223709oth.3 for ; Tue, 07 Feb 2017 00:51:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DjOXtbu+yiv5iuiYhUtuyGzm6uP7wtJ1XkxrOf/Gpx8=; b=CMit8Cu3z3XHkpgk+crfbqljSWQUNk4+4oIEAOsx5FGh9iaARxQFLmJZtSk0R7N02H O3Za+kyJ4QG7B5KevqG3q0j/h1MUIpvLTcR1e2aAzuphzAyLeULK2GZIchj50VPugYpA pHC8Y5oyPGazh749YnnJAYKX6/hz7/hixLCNQ6nk+lkIIWKORmoEMeapflV4JggBL5sw rLuGwUYfSORpJkEEYyv3JHqJrB72PL8uY9GFr02No6qdnUuYdt68LpClFVyzYn29fAVu wyLgghzNGDNqfT/oFN7aI8HOMKzgfnRw4P8av1K249iFqbMOqr2rWRXzXpLshRe1bRtU wxFA== X-Gm-Message-State: AIkVDXJECtCWsR4Q22yGqhIcXLenA3bwtTSZnLvwXOT99zTeXo8JvZBJCone+d2ZYu79AyPK1MED65qRAF6P7LXwRZg= X-Received: by 10.157.37.54 with SMTP id k51mr6573333otb.271.1486457461666; Tue, 07 Feb 2017 00:51:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.56.81 with HTTP; Tue, 7 Feb 2017 00:51:01 -0800 (PST) From: Bogdan Pricope Date: Tue, 7 Feb 2017 10:51:01 +0200 Message-ID: To: lng-odp-forward Subject: [lng-odp] [PATCH 1/1] test: generator: Updated global stats calculation to provide useful/easy-to-parse information X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Bogdan Pricope --- example/generator/odp_generator.c | 58 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) -- 1.9.1 diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index ccd47f6..39bf026 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -569,7 +569,10 @@ static int gen_recv_thread(void *arg) static void print_global_stats(int num_workers) { odp_time_t cur, wait, next; - uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0; + uint64_t pkts_snd = 0, pkts_snd_prev = 0; + uint64_t pps_snd = 0, maximum_pps_snd = 0; + uint64_t pkts_rcv = 0, pkts_rcv_prev = 0; + uint64_t pps_rcv = 0, maximum_pps_rcv = 0; int verbose_interval = 20; odp_thrmask_t thrd_mask; @@ -590,30 +593,39 @@ static void print_global_stats(int num_workers) continue; next = odp_time_sum(cur, wait); - - if (args->appl.mode == APPL_MODE_RCV) { - pkts = odp_atomic_load_u64(&counters.udp); - printf(" total receive(UDP: %" PRIu64 ")\n", pkts); - continue; - } - - if (args->appl.mode == APPL_MODE_PING) { - pkts = odp_atomic_load_u64(&counters.icmp); - printf(" total receive(ICMP: %" PRIu64 ")\n", pkts); + switch (args->appl.mode) + { + case APPL_MODE_RCV: + pkts_rcv = odp_atomic_load_u64(&counters.ip); + break; + case APPL_MODE_PING: + pkts_snd = odp_atomic_load_u64(&counters.seq); + pkts_rcv = odp_atomic_load_u64(&counters.icmp); + break; + case APPL_MODE_UDP: + pkts_snd = odp_atomic_load_u64(&counters.seq); + break; + default: + continue; } - pkts = odp_atomic_load_u64(&counters.seq); - printf(" total sent: %" PRIu64 ", drops: %" PRIu64 "\n", pkts, - odp_atomic_load_u64(&counters.tx_drops)); - - if (args->appl.mode == APPL_MODE_UDP) { - pps = (pkts - pkts_prev) / verbose_interval; - if (pps > maximum_pps) - maximum_pps = pps; - printf(" %" PRIu64 " pps, %" PRIu64 " max pps\n", - pps, maximum_pps); - pkts_prev = pkts; - } + pps_snd = (pkts_snd - pkts_snd_prev) / verbose_interval; + pkts_snd_prev = pkts_snd; + if (pps_snd > maximum_pps_snd) + maximum_pps_snd = pps_snd; + + pps_rcv = (pkts_rcv - pkts_rcv_prev) / verbose_interval; + pkts_rcv_prev = pkts_rcv; + if (pps_rcv > maximum_pps_rcv) + maximum_pps_rcv = pps_rcv; + + printf("sent: %" PRIu64 ", drops: %" PRIu64 ", " + "send rate: %" PRIu64 " pps, max send rate: %" PRIu64 " pps, " + "rcv: %" PRIu64 ", " + "recv rate: %" PRIu64 " pps, max recv rate: %" PRIu64 " pps\n", + pkts_snd, odp_atomic_load_u64(&counters.tx_drops), + pps_snd, maximum_pps_snd, + pkts_rcv, pps_rcv, maximum_pps_rcv); } }