From patchwork Mon Aug 3 09:14:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Garapati X-Patchwork-Id: 51846 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 2CF01229FD for ; Mon, 3 Aug 2015 09:15:41 +0000 (UTC) Received: by lbbnr7 with SMTP id nr7sf39817427lbb.2 for ; Mon, 03 Aug 2015 02:15:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=GSkU/sbLVSrAOy2JJvyVGVoRfxS9JlIroj3I1KEqBfI=; b=kakTi6s4bQ3NM7ioLEeIOMgZu8TfuW3phVC1phUdfPu7buUIwjIYJ9c0jW5LEZBa+D YmyFDTiG39QXHgvdDOcvCWwXyBDtRa1lClcb6qrw5h3tKwexqGTFOMQF0ZOgt3ipzVzV pppp+DnllJCnJb/jWjpcIXp+eV+C39xkX3WCuJbAbkvYneIHoZ3iTkVAo46PA6p0G9UK BwKmqnJwjqSq2jHY+h7ZpHz/VMhTLuuEXdjYBTMvKCoQaVM7dK38upK2YbM7rHio1Y3i cQcIJ+IoNz2s/fvTdmRI/Q6halVSON29sfzfdH9/pbvrF0utVMjW2HlUIUfttXljA4JK Zbuw== X-Gm-Message-State: ALoCoQm4e+b+Q8C73zQ1kKdIQyWC2IbSfKj4CgahetrWTJ0vXxpLd4Cb45HyFNtfurnk3mGT5/uF X-Received: by 10.180.83.33 with SMTP id n1mr5538390wiy.4.1438593339436; Mon, 03 Aug 2015 02:15:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.42 with SMTP id o10ls479696laa.87.gmail; Mon, 03 Aug 2015 02:15:39 -0700 (PDT) X-Received: by 10.153.7.166 with SMTP id dd6mr15601367lad.42.1438593339086; Mon, 03 Aug 2015 02:15:39 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id p1si11411884laj.140.2015.08.03.02.15.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 02:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbud7 with SMTP id ud7so70404703lbb.3 for ; Mon, 03 Aug 2015 02:15:39 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr15764897lbb.36.1438593338863; Mon, 03 Aug 2015 02:15:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1753588lba; Mon, 3 Aug 2015 02:15:37 -0700 (PDT) X-Received: by 10.107.134.83 with SMTP id i80mr18106531iod.123.1438593337294; Mon, 03 Aug 2015 02:15:37 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id hy5si5382098igb.88.2015.08.03.02.15.35; Mon, 03 Aug 2015 02:15:37 -0700 (PDT) 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; Received: by lists.linaro.org (Postfix, from userid 109) id A5D3461D96; Mon, 3 Aug 2015 09:15:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 034F961CA0; Mon, 3 Aug 2015 09:15:31 +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 5AA2A61C96; Mon, 3 Aug 2015 09:15:26 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 5E1D561C96 for ; Mon, 3 Aug 2015 09:15:25 +0000 (UTC) Received: by labow3 with SMTP id ow3so12218341lab.1 for ; Mon, 03 Aug 2015 02:15:24 -0700 (PDT) X-Received: by 10.112.205.161 with SMTP id lh1mr15717749lbc.43.1438593324116; Mon, 03 Aug 2015 02:15:24 -0700 (PDT) Received: from elxahtkds32.localdomain (host-95-192-107-101.mobileonline.telia.com. [95.192.107.101]) by smtp.gmail.com with ESMTPSA id xf5sm2840221lbb.38.2015.08.03.02.15.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Aug 2015 02:15:23 -0700 (PDT) From: "Balakrishna.Garapati" To: stuart.haslam@linaro.org, maxim.uvarov@linaro.org Date: Mon, 3 Aug 2015 11:14:48 +0200 Message-Id: <1438593288-6668-1-git-send-email-balakrishna.garapati@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCH] example:generator:move verbose from worker to control X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balakrishna.garapati@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Balakrishna.Garapati --- Moved verbose output logic from worker to control thread example/generator/odp_generator.c | 53 +++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index bdee222..c565a21 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -101,6 +101,7 @@ static void usage(char *progname); static int scan_ip(char *buf, unsigned int *paddr); static int scan_mac(char *in, odph_ethaddr_t *des); static void tv_sub(struct timeval *recvtime, struct timeval *sendtime); +static void print_global_stats(void); /** * Sleep for the specified amount of milliseconds @@ -371,7 +372,6 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) static void *gen_send_thread(void *arg) { int thr; - uint64_t start, now, diff; odp_pktio_t pktio; thread_args_t *thr_args; odp_queue_t outq_def; @@ -393,7 +393,6 @@ static void *gen_send_thread(void *arg) return NULL; } - start = odp_time_cycles(); printf(" [%02i] created mode: SEND\n", thr); for (;;) { int err; @@ -434,15 +433,6 @@ static void *gen_send_thread(void *arg) >= (unsigned int)args->appl.number) { break; } - - now = odp_time_cycles(); - diff = odp_time_diff_cycles(start, now); - if (odp_time_cycles_to_ns(diff) > 20 * ODP_TIME_SEC) { - start = odp_time_cycles(); - printf(" [%02i] total send: %ju\n", - thr, odp_atomic_load_u64(&counters.seq)); - fflush(stdout); - } } /* receive number of reply pks until timeout */ @@ -589,6 +579,45 @@ static void *gen_recv_thread(void *arg) return arg; } + +/** + * printing verbose statistics + * + */ +static void print_global_stats(void) +{ + uint64_t start, now, diff; + int loop_forever = 1; + + if (args->appl.timeout != -1 || args->appl.number > 0) + loop_forever = 0; + + start = odp_time_cycles(); + do { + now = odp_time_cycles(); + diff = odp_time_diff_cycles(start, now); + if (odp_time_cycles_to_ns(diff) > 20 * ODP_TIME_SEC) { + start = odp_time_cycles(); + if (args->appl.mode == APPL_MODE_RCV || + odp_atomic_load_u64(&counters.icmp) != 0 || + odp_atomic_load_u64(&counters.udp) != 0) { + printf(" total receive(icmp:%ju, udp:%ju)\n", + odp_atomic_load_u64(&counters.icmp), + odp_atomic_load_u64(&counters.udp)); + } + + if (odp_atomic_load_u64(&counters.seq) > 0) + printf(" total send: %ju\n", + odp_atomic_load_u64(&counters.seq)); + + if (args->appl.number > 0 && + odp_atomic_load_u64(&counters.icmp) >= + (unsigned int)args->appl.number) + break; + } + } while (loop_forever || args->appl.timeout >= 0); +} + /** * ODP packet example main function */ @@ -796,6 +825,8 @@ int main(int argc, char *argv[]) } } + print_global_stats(); + /* Master thread waits for other threads to exit */ odph_linux_pthread_join(thread_tbl, num_workers);