From patchwork Tue Feb 7 12:10:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bogdan Pricope X-Patchwork-Id: 93554 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp2204117obz; Tue, 7 Feb 2017 04:11:07 -0800 (PST) X-Received: by 10.237.36.24 with SMTP id r24mr13554430qtc.229.1486469467786; Tue, 07 Feb 2017 04:11:07 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b27si2792763qkh.32.2017.02.07.04.11.07; Tue, 07 Feb 2017 04:11:07 -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 4AC1C62F85; Tue, 7 Feb 2017 12:11:07 +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 1FFE860DB2; Tue, 7 Feb 2017 12:11:03 +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 0280560E53; Tue, 7 Feb 2017 12:11:00 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by lists.linaro.org (Postfix) with ESMTPS id B9166608D1 for ; Tue, 7 Feb 2017 12:10:59 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id c85so158031686wmi.1 for ; Tue, 07 Feb 2017 04:10:59 -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; bh=CReFb5n55VasngDup7eN0vJEejqxhuhJQIBmB/iz/zg=; b=gWkTgHjkC46nWo81Gn8UvOEJTcadgOTKm8ETZWoNld7VkUlH9yBqcpOikOLqw5jqCX jomtdaiQbZ6xf90Ylo48r4/LGuLQkJiFTdTZvPhUhBN1slwfZzsJeDfXlMretjNY7ECZ dG13nnLxKQCdurW7qL2qdboQPVHdQI86HcGRp2XRDuTF0xi0zlKTA35nDf+7YDlW3j6Z EDSxafk4CBw+zytkCF4NspMB9DjLWGfI1rDti2ECdss/oYXvCbP4YEwBv//p8V2/gP4t xpNUBwga/NpOxaTZYkbEiRb5EVbwZ4uqUqW8eePLTs0Nqv22pDOTWReOx9VMeIo7OyaF cvUg== X-Gm-Message-State: AIkVDXJc4ib16PjW3vvExbTlovqVORq/h3JVGW0aklZmFn6opPObTuTdXtzzAsoFMB8k/qzUGdM= X-Received: by 10.223.136.152 with SMTP id f24mr13332480wrf.187.1486469458874; Tue, 07 Feb 2017 04:10:58 -0800 (PST) Received: from localhost.localdomain ([193.202.22.66]) by smtp.gmail.com with ESMTPSA id s18sm18509216wmb.18.2017.02.07.04.10.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Feb 2017 04:10:58 -0800 (PST) From: Bogdan Pricope To: lng-odp@lists.linaro.org Date: Tue, 7 Feb 2017 14:10:59 +0200 Message-Id: <1486469459-28261-1-git-send-email-bogdan.pricope@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [lng-odp] [PATCHv3 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 | 57 ++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 22 deletions(-) -- 1.9.1 diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 6ac8f2d..b1f549f 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,40 @@ 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); + 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; } - if (args->appl.mode == APPL_MODE_PING) { - pkts = odp_atomic_load_u64(&counters.icmp); - printf(" total receive(ICMP: %" PRIu64 ")\n", pkts); - } - - 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); } }