From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B323A054F; Tue, 16 Mar 2021 21:07:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8270140A4B; Tue, 16 Mar 2021 21:07:45 +0100 (CET) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mails.dpdk.org (Postfix) with ESMTP id 41AA6406A2 for ; Tue, 16 Mar 2021 21:07:44 +0100 (CET) Received: by mail-lf1-f54.google.com with SMTP id v9so64392432lfa.1 for ; Tue, 16 Mar 2021 13:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GFPOk8rzQgHghJD0q0yWiV/IxytDCuXBnQ8mISiUDQU=; b=dpBnx0wwW5ubg2eAhFUgJVvrHWu7Z/elHBcUcMcxalEB9mm/ys5geT48aFBIrbB9Ah 4oXWideqvU3PfZ99f1fm6BsbsSvKEn+o6/zB2LtqFYfikIgF00QRsFos98dh+3JfODG5 cRhPS9MAAHDoIw5I/pIdVjVwsPB+z5lc5lQpSsiOiUxqOsLHt1ltqU53xuWRhSD9Gf38 L1yoLteagWIqTgQCqWa6dYSZn+53RRFZ8bdXy0Yd4kNxkJGU3jAQS2wcuylBY1xt7jGv DjnMdYCokOnq5oZED+amkT1nyixyWW5mT83mXnvXKfMzPFecN3YY+Ot+T9w5lJNYoApY BU6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GFPOk8rzQgHghJD0q0yWiV/IxytDCuXBnQ8mISiUDQU=; b=nwwQDtbw7qIcrVOpwVNlsMZsv5CM/SHhwVgxtvx1eHXc0sI+xqwzUvZbLHwogW8U+J olQrbtTbza5GRfaJoNYx9cZqdioPShlIqF4nRc1hjrTtC28+DYCWL5TuqzP/ekEZuoOU L7tKYE8WoBK1l7+z8IiRQgJGW0UkJwJdYCm4YMolcXqFf/PqoDa7u0r4Azoya4cboCyc 7lhad5aBZaxG/Pje9476RVSPWZlCujFq26dC/3kqpc6gKl4Zb1HwdK2w8n8kNgAQEaHY p6PHBihSmznrY7wpzemn1TzF8BdFB0IY37H6qWaht5r86vvzdwSGL2T625+H3oKOPB9u G4xw== X-Gm-Message-State: AOAM532mrBbWRiEblDk584uTBF/yxXgbUvOcmhgdN1o07BriYw9DCJcd yNOQ6BiLoQOohgh35+BJTy0= X-Google-Smtp-Source: ABdhPJyzgSKssoz13O/6Xz1Xax1dymxYfMO6mAnzyqV98wnj6CSJxFtO0cqvDzOhSGCUWOBpvOanAA== X-Received: by 2002:ac2:5d52:: with SMTP id w18mr267588lfd.28.1615925263712; Tue, 16 Mar 2021 13:07:43 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id z6sm3103643lfr.34.2021.03.16.13.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 13:07:43 -0700 (PDT) Date: Tue, 16 Mar 2021 23:07:42 +0300 From: Dmitry Kozlyuk To: Stephen Hemminger Cc: dev@dpdk.org, Tyler Retzlaff , Mike Wells , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam , Ray Kinsella , Neil Horman Message-ID: <20210316230742.4720f42d@sovereign> In-Reply-To: <20210316115933.06d1f9de@hermes.local> References: <20210214012013.23165-1-dmitry.kozliuk@gmail.com> <20210214021616.26970-1-dmitry.kozliuk@gmail.com> <20210214021616.26970-2-dmitry.kozliuk@gmail.com> <20210316115933.06d1f9de@hermes.local> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 1/6] eal: add internal API for current time X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2021-03-16 11:59 (UTC-0700), Stephen Hemminger: > On Sun, 14 Feb 2021 05:16:11 +0300 > Dmitry Kozlyuk wrote: > > > +rte_time_get_us(struct rte_time_us *now) > > +{ > > + struct timeval sys; > > + > > + gettimeofday(&sys, NULL); > > + now->sec = sys.tv_sec; > > + now->usec = sys.tv_usec; > > +} > > Why would drivers want the default (wall clock) time instead > of using monotonic clock. The wall clock gets changed by NTP > and that is rarely what you want except for the case of log messages. * gettimeofday() is mostly used to measure time (tests, hns3 PMD), so you're right, monotonic clock is what that code really needs. * ena PMD uses gettimeofday() with pthread_cond_timedwait() without calling pthread_cond_setclock(), which is a bug, I believe. * hns3 PMD actually uses gettimeofday() for logs. For wall clock time there is C11 timespec_get(), so I agree this API should be changed to monotonic, thanks.