From patchwork Tue Feb 7 09:12:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Pricope X-Patchwork-Id: 93526 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp2142684obz; Tue, 7 Feb 2017 01:12:23 -0800 (PST) X-Received: by 10.55.212.157 with SMTP id s29mr14812800qks.240.1486458743459; Tue, 07 Feb 2017 01:12:23 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id t58si2481080qta.240.2017.02.07.01.12.23; Tue, 07 Feb 2017 01:12:23 -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 D8AF562DC3; Tue, 7 Feb 2017 09:12:22 +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 EF4A7608D8; Tue, 7 Feb 2017 09:12:20 +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 0445160DF9; Tue, 7 Feb 2017 09:12:19 +0000 (UTC) Received: from mail-oi0-f51.google.com (mail-oi0-f51.google.com [209.85.218.51]) by lists.linaro.org (Postfix) with ESMTPS id 524BF608D4 for ; Tue, 7 Feb 2017 09:12:18 +0000 (UTC) Received: by mail-oi0-f51.google.com with SMTP id j15so61323802oih.2 for ; Tue, 07 Feb 2017 01:12:18 -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=PtKOhBTxOiQ9YmFB+xwQwk1e8AzPa60kik85dWeDonA=; b=kubYHQiLis0eGDa/rrEeZ/kV3/9JYcU8xRvu5IBy12tiiW8b9bqas9rd9Huhef3jgw gvesx3/N3b3JBfRP10KZX3bCedCYHziw+Bke6WRtk/otoqXvk3gOXCEjCENID2JoXbsD l5ZpI7UerUNjpSThJXwC6M9cMsL8C86PqWaK6jeeSaQuKQl7jItOwd72UUQqYLq/T+l1 TF2UnDhf4kOIqV4Gx+C+YGQJVV3vxHa7XD7M3nrfP1oIf5qwDfQHp97ZvKuanQCqUeEO +sxhmylfL4L6xQ3QW8CpB/vNf2SV2J6lce5ojZGoakxFBDc4QOs+/ZJHz8udKPu4svc2 rudw== X-Gm-Message-State: AMke39ndC/BGDrpcYgT3ihEr1SZf9ubo0+0bArN4TPZ0URKnrXYXqMycv616zVrVpgY4MHqrIX07jXA3IxE377Lx3fw= X-Received: by 10.202.169.84 with SMTP id s81mr7664244oie.155.1486458737623; Tue, 07 Feb 2017 01:12:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.56.81 with HTTP; Tue, 7 Feb 2017 01:12:17 -0800 (PST) From: Bogdan Pricope Date: Tue, 7 Feb 2017 11:12:17 +0200 Message-ID: To: lng-odp-forward Subject: [lng-odp] [PATCHv2 1/1] test: generator: Updated global statistics 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 6ac8f2d..fa82163 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -565,7 +565,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; @@ -586,30 +589,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); } }