From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ik4mN/UbpmBzUQAAWB0awg (envelope-from ) for ; Thu, 20 May 2021 04:21:09 -0400 Received: by simark.ca (Postfix, from userid 112) id D3DAC1F11C; Thu, 20 May 2021 04:21:09 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_REPLYTO_END_DIGIT,MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 222D31E813 for ; Thu, 20 May 2021 04:21:09 -0400 (EDT) Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4Fm2kX2swRz1r8v; Thu, 20 May 2021 04:21:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1621498868; bh=jduqP9r9QHaNdJPQe4NsPjZnbwv58/O4uZuBWUOBmFQ=; h=References:In-Reply-To:Date:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=bUFcRByV8uLsDWCy2Bc1xVoMm/4Be1+IB67Y1ULizJoB87nq97jlDhJkUZ7UOwNhP Kl6kf7YgLt9cHdSy6gvu558dNOlXqi4GHe2uRDI2LzC5uwPH7smvai3djEPHuelGmS YYozK6avwT2ucl31cOM7wqc44o6Cmv72vitLwj0wOke63J+FroAUuEjs8m5qVcSrgX NmQQdYhg1ojolsYPMBlHD72s+amZr0NAWKbqLfeBuwkWKk1A9P/g1e41XwU/P9GAR2 Iw9UJcIIdeYuc+9xNFA0KOwmFkkOlE8C0nlELzVS6IKADe6GxftVZzF4hMLOeQkF/l mVpzs711QcJ7A== Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lists.lttng.org (Postfix) with ESMTPS id 4Fm2kV5zTJz1r8t for ; Thu, 20 May 2021 04:21:06 -0400 (EDT) Received: by mail-oi1-x22d.google.com with SMTP id t24so169493oiw.3 for ; Thu, 20 May 2021 01:21:06 -0700 (PDT) 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; bh=O9JrJnCFlLwI/Z7IFp2xvCB0hS2tRcyFSCKN18lhPPA=; b=F/ntecrr6iHhu7ugDw+l/b6kw6pJR2wUXOWKB8vq1Rr9+WMntQFEwJd6/DrT6cSGgA rWDzg7GY1cGERP81RZafn+mPoamMPZcbthMGD98lSeZzbNiCrZe7zJw6GHNozR9t9Ycl aUDV1MtWM1Rdv+abN0pFZ50P+z9GH0Sb9piMG+BlqPz+lUYUK098tJ0Db0zUyRvVL3cq x7QhtJtOdU0fs3tv2bjvJ+7KoPMhHxYMNeHPjoiz53DTLy5icOQvB9slSNr2KR8dGE+m cgWD/93wXPTG9YjOLg5J4psCN78eltzvwVIhuFeT1xkfOyJsGHTr6R0V/ZxjO4ZTrFLs 5JpA== X-Gm-Message-State: AOAM531J7IqROsbT45CIuOZPdxPS2hIOyk9+71zLycw73vFfGvXyVhSF CrRXCcZs3Ec/Z7+DQjRa77b8VJjiKWNWPQER640XZp73VN9pSQ== X-Google-Smtp-Source: ABdhPJzvToWMriJxt2/QaB/pPqQ2+iFnN/FCqguF/F6hfEY7QOOEiTXnG3q7K0ddJ4OsXAFyQoxXh8KImwUxZA87Q5Q= X-Received: by 2002:aca:acc7:: with SMTP id v190mr2536500oie.28.1621498865825; Thu, 20 May 2021 01:21:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 20 May 2021 10:20:55 +0200 Message-ID: To: MONTET Julien Cc: "lttng-dev@lists.lttng.org" Subject: Re: [lttng-dev] LTTng - Xenomai : different results between timestamp-lttng and rt_time_read() X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Norbert Lange via lttng-dev Reply-To: Norbert Lange Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" Am Do., 20. Mai 2021 um 09:58 Uhr schrieb MONTET Julien via lttng-dev : > > Hi the developers ! > > CONTEXT > I am currently working on a Raspberry pi 3B with Xenomai and LTTng tools. > Raspbian 10.9 Buster - kernel 4.19.85 > uname -a : Linux raspberrypi 4.19.85-v7+ #5 SMP PREEMPT Wed May 12 10:13:37 > Both tools are working, but I wonder about the accuracy of LTTng libraries. > > > METHOD > The code used is quite simple, it is written with the alchemy skin. > A rt_task_spawn calls a function that has rt_task_set_periodic(NULL, TM_NOW, period) and rt_task_wait_period(NULL). > ->The rt_task_set_periodic is based on 1ms. > ->The rt_task_wait_period(NULL) is of course inside a while loop (see below at the very end). > > My goal is to get accurate traces from Xenomai. > I took two methods to do so : > -> lttng > -> basic calculation based on rt_timer_read() > > What a surprise when I found both method have two different results. > -> LTTng shows me traces [0.870;1.13] ms (or even less precise) > -> rt_time_read shows me traces [0.980;1.020] ms > > Thing to note : > -> The use of LTTng has no influence on rt_time_read(), you can use both methods at the same time. > > Then, I saved the output of rt_time_read inside a tracepoint. > It appeared the LTTng is always called at the right time because the value got by rt_time_read () is really good. > > > QUESTIONS > These are now my questions : > - What is the method I should trust ? > - I have searched on the forum and I found LTTng uses a MONOTONIC clock for the timestamp. Can/Should I modify it ? > > > CODE > ----------------------------------------------------------------------- > A small part of my function called by rt_task_spawn : > [...] > RTIME period = 1000*1000; // in ns > RTIME now; > RTIME previous = 0; > RTIME duration; > [...] > while(1) > { > overruns = 0; > err = rt_task_wait_period(&overruns); > now = rt_timer_read(); > tracepoint(tp_provider, tracepoint_tick_ms, now, "tick"); > > if (previous != 0) > { > duration=now-previous; > rt_printf("%llu\n \n", duration/1000); > } > previous=now; > [...] > } Are you using the Xenomai kernel ("Cobalt"), or just skins via copperplate ("Mercury")? You have some file /proc/xenomai/version? The Xenomai kernel has his own clock, which in general is not correlated to the linux monotonic clock. (Under some circumstances it might be identical). My plan is to use a clock plugin for Lttng, particularly because if lttng uses the linux monotonic clock from a realtime thread it might deadlock really good ;) Norbert _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev