From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92E7FA0565; Mon, 23 Mar 2020 12:24:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 611B51C044; Mon, 23 Mar 2020 12:24:29 +0100 (CET) Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by dpdk.org (Postfix) with ESMTP id 3B9991C037 for ; Mon, 23 Mar 2020 12:24:28 +0100 (CET) Received: by mail-il1-f195.google.com with SMTP id j69so12710659ila.11 for ; Mon, 23 Mar 2020 04:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=win5xZOL0YEcje4/tB54q8kvXY2A6Aj42VQn4RY35v8=; b=hzTzZPHrg48iqiaxl+jXTugudjODoWht+F33QreQQgdINpU9mFYHENi5Mc3xWae3uC M+JqJ3jSrrnuMrccAlqxyztJJA9/1x5OGgb5D0LwyUjArJhGmoVcd87jdyj1NevorNVE cpfp0kEHldhnkvFmwblxMZzV/RNfKG7pxMnpCuBDTJpGcpwDueGPcAKq6UcZwfoOEff6 JxRR9Gom+UrmKtiGcHANGbH39OPHiKeoeJN43H+18GFLhYAr0bo3+g+TwVdjcxP0tZvj X/Nq06Nx0Y3cgl+FGDLZ5viASTBsFqh3mmoexnHgaEwH1E7v6Xzufx+S+dEGtiAC4j+x 139w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=win5xZOL0YEcje4/tB54q8kvXY2A6Aj42VQn4RY35v8=; b=LXQkCR6eXof8qRntnd8GB0OCNwGtjm2bPpekyw41VS5b9pQXorr5K30rJW3E3wtRsH fs0mhHrNtNTAW8BhiphY85fRZxlHtvNv2jB2ljE4KI6oG/juukEvuMHLGGCWrHaXixVp twBSvRYBquHfW3HBzjHEy8T+kXHFNtcCfDcQqn3QkRNUW8afYShnue9owiRLWpe3stdS c6w2+7CDbFUoex3U8DlRJGGSURLMVoYsa6ACRRQh/ezaIppFfBuXQ7NDLkuzi6A8tdsS 36vvftkicExZT+TjReUMwvL+JYVR/xP9rF7dNxeW1J0a63N97SB2wmlM/9RnKlcBjbEY KpFw== X-Gm-Message-State: ANhLgQ2fdCQaxnyAA+qezWJgLcHwKZvkr50MJp0JIqQo6Uweya5Yveic DxOAE88o/s4KfFD97LH0EWpqjMeLaqvI2gHdsC4= X-Google-Smtp-Source: ADFU+vtVuLUSlKs5xvboQVNxd7D8uPxu6oRxnDNqd1nwVA0dl9KjcPtqcME8RYluFW00O0zTLTCE0JXUWc1sVF4JKLw= X-Received: by 2002:a05:6e02:90:: with SMTP id l16mr14654727ilm.294.1584962667503; Mon, 23 Mar 2020 04:24:27 -0700 (PDT) MIME-Version: 1.0 References: <20200318190241.3150971-1-jerinj@marvell.com> <20200318190241.3150971-7-jerinj@marvell.com> <4c4b1638-e339-4a39-eafe-7ec9317cc18f@ericsson.com> In-Reply-To: <4c4b1638-e339-4a39-eafe-7ec9317cc18f@ericsson.com> From: Jerin Jacob Date: Mon, 23 Mar 2020 16:54:11 +0530 Message-ID: To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: "jerinj@marvell.com" , Sunil Kumar Kori , "dev@dpdk.org" , "thomas@monjalon.net" , "bruce.richardson@intel.com" , "david.marchand@redhat.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v1 06/32] eal/trace: get bootup timestamp for trace X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On Thu, Mar 19, 2020 at 4:13 PM Mattias R=C3=B6nnblom wrote: > > On 2020-03-18 20:02, jerinj@marvell.com wrote: > > From: Jerin Jacob > > > > Find epoch_sec, epoch_nsec and uptime_ticks time information > > on eal_trace_init()/bootup to derive the time in the trace. > > > > Signed-off-by: Jerin Jacob > > --- > > lib/librte_eal/common/eal_common_trace.c | 3 +++ > > .../common/eal_common_trace_utils.c | 22 ++++++++++++++++++= + > > lib/librte_eal/common/eal_trace.h | 5 +++++ > > 3 files changed, 30 insertions(+) > > > > diff --git a/lib/librte_eal/common/eal_common_trace.c b/lib/librte_eal/= common/eal_common_trace.c > > index abb221cf3..51c4dd550 100644 > > --- a/lib/librte_eal/common/eal_common_trace.c > > +++ b/lib/librte_eal/common/eal_common_trace.c > > @@ -59,6 +59,9 @@ eal_trace_init(void) > > if (trace_mkdir()) > > goto fail; > > > > + /* Save current epoch timestamp for future use */ > > + if (trace_epoch_time_save()) > > + goto fail; > < 0 looks cleaner. OK. I will change it in v2. > > > > rte_trace_global_mode_set(trace.mode); > > > > diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librt= e_eal/common/eal_common_trace_utils.c > > index f7d59774c..340ab62e4 100644 > > --- a/lib/librte_eal/common/eal_common_trace_utils.c > > +++ b/lib/librte_eal/common/eal_common_trace_utils.c > > @@ -98,6 +98,28 @@ trace_session_name_generate(char *trace_dir) > > return -rte_errno; > > } > > > > +int > > +trace_epoch_time_save(void) > > +{ > > + struct trace *trace =3D trace_obj_get(); > > + struct timespec epoch =3D { 0, 0 }; > =3D {} also works. > > + uint64_t avg, start, end; > > + > > + start =3D rte_get_tsc_cycles(); > > + if (clock_gettime(CLOCK_REALTIME, &epoch) < 0) { > > + trace_err("failed to get the epoch time"); > > + return -1; > > + } > > + end =3D rte_get_tsc_cycles(); > > + avg =3D (start + end) >> 1; > > + > > + trace->epoch_sec =3D (uint64_t) epoch.tv_sec; > > + trace->epoch_nsec =3D (uint64_t) epoch.tv_nsec; > If you would settle with keeping the time offset in microseconds, you > would only need "epoch_offset_usec". ctf spec[1] uses offset_s and offset in clock definition. Storing both to avoid conversion in the future. [1] https://diamon.org/ctf/#spec8