From patchwork Mon Aug 25 09:06:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weilong Chen X-Patchwork-Id: 35889 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E55F320565 for ; Mon, 25 Aug 2014 09:07:10 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g18sf79994647oah.10 for ; Mon, 25 Aug 2014 02:07:10 -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:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=V22FVv7MFm9VZsrNv+mxabs26uevOhXnh2mncWqS4w4=; b=ee4WOXO9DoVfFlAYTs17AUkcz72CBoiELji/moihzrgBJrdZXkCOMBfEMl7qYWTG1G EiAby133iBWNwpH5WD0Yf68onwFUleilh4RJKOOy0ZBKZbEVx+LhsNMVV9t7q2Uk7eHn 2Enkmz1/AMTZMbJX9aKoJha++8n8nKeygJog1c9x4vr3ec3nl5FMdy4tj1izLXCF8k9C A0t6/VL+P4hOdJ77tskenTfu7hTnzXVEVT9SUJFl/jdJ2lv9ILGfi9cdnCe0BMebeLnC +/lBj0s4sLxc1BjBkv9Uvghg+OFXFPETILHEukcR13lD91oZ1XFqnY+ZH/zfWsS6xf+W ijmA== X-Gm-Message-State: ALoCoQmi1FCtL/d/3iIVTHhpGhsLnLxROTqLhUdpxL/JjKHMqUpS8L6Iu/BrkbcTdhHmWpSji1qY X-Received: by 10.42.82.79 with SMTP id c15mr16467746icl.7.1408957630555; Mon, 25 Aug 2014 02:07:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.240 with SMTP id 103ls2015363qgn.28.gmail; Mon, 25 Aug 2014 02:07:10 -0700 (PDT) X-Received: by 10.52.135.133 with SMTP id ps5mr4744807vdb.33.1408957630410; Mon, 25 Aug 2014 02:07:10 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id du5si16159262vcb.70.2014.08.25.02.07.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 02:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so14965070vcb.10 for ; Mon, 25 Aug 2014 02:07:10 -0700 (PDT) X-Received: by 10.220.95.132 with SMTP id d4mr5476492vcn.33.1408957630324; Mon, 25 Aug 2014 02:07:10 -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.221.45.67 with SMTP id uj3csp101515vcb; Mon, 25 Aug 2014 02:07:10 -0700 (PDT) X-Received: by 10.140.96.180 with SMTP id k49mr31390330qge.78.1408957629808; Mon, 25 Aug 2014 02:07:09 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j8si51674041qcd.48.2014.08.25.02.07.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 02:07:09 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XLqF1-0003YD-Lu; Mon, 25 Aug 2014 09:07:07 +0000 Received: from mail-pd0-f170.google.com ([209.85.192.170]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XLqEw-0003Xq-6c for lng-odp@lists.linaro.org; Mon, 25 Aug 2014 09:07:02 +0000 Received: by mail-pd0-f170.google.com with SMTP id g10so19490630pdj.15 for ; Mon, 25 Aug 2014 02:06:56 -0700 (PDT) X-Received: by 10.70.52.165 with SMTP id u5mr26882215pdo.62.1408957614652; Mon, 25 Aug 2014 02:06:54 -0700 (PDT) Received: from localhost.localdomain ([183.247.163.231]) by mx.google.com with ESMTPSA id sk6sm36793020pbc.15.2014.08.25.02.06.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 02:06:53 -0700 (PDT) From: Weilong Chen To: lng-odp@lists.linaro.org Date: Mon, 25 Aug 2014 17:06:16 +0800 Message-Id: <1408957576-28208-1-git-send-email-weilong.chen@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH] Time should be cast to double when calculate rtt X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: weilong.chen@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.220.179 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 This patch fix two point: 1.Time should be cast to double when calculate rtt. 2.Don't display receive message in flood mode. Signed-off-by: Weilong Chen --- example/generator/odp_generator.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 9fa9b37..c141bc5 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -427,9 +427,10 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) * ODP timer API once one exists. */ gettimeofday(&tvrecv, NULL); tv_sub(&tvrecv, &tvsend); - rtt = tvrecv.tv_sec*1000 + tvrecv.tv_usec/1000; + rtt = tvrecv.tv_sec*1000 + + (double)tvrecv.tv_usec/1000; rlen += sprintf(msg + rlen, - "ICMP Echo Reply seq %d time %.1f ", + "ICMP Echo Reply seq %d time %.3f ms", odp_be_to_cpu_16(icmp->un.echo.sequence) , rtt); } else if (icmp->type == ICMP_ECHO) { @@ -439,7 +440,8 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) } msg[rlen] = '\0'; - printf(" [%02i] %s\n", thr, msg); + if (args->appl.interval != 0) + printf(" [%02i] %s\n", thr, msg); } }