Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp594874pxj; Thu, 3 Jun 2021 14:30:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrigwu+AjQvw9mm/hKH90gLoDnURBq1KQmyOGdfpFslzGOXY8h1gF2KpNaZ4w9dqZusMty X-Received: by 2002:a05:6402:3546:: with SMTP id f6mr1313901edd.191.1622755853726; Thu, 03 Jun 2021 14:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622755853; cv=none; d=google.com; s=arc-20160816; b=vLTCmPQQLjwS9iKs2e/itU5mUDht5F8Ew2vilF4PkVFGMPSVuPVTZVlSOnkHTKdTrR gX4QWyI93dw/GqDjLIRBiSGJ60tDJ7Ypi5PcmArbcsm+886/34HTitfrjop0z4uz2U89 BYLwHmO0sVpV+PEKMmE0k/bXjDg8GC99tba+YUQ7JSJnHA9uTSbiTbtJJcymVPQ7R//9 ieP0Enhie/3Mwg5AkqkJJsxYG/OmkDG9GLnr8oPq1f2v2CYMRKa3ADR3ssTFrKQOu9Os idzZFGiZ+ncB0NPd7gBdhGvLUuHXlw1yhA6dkiAlFRwypBp395O7R5WpBJA6h4L0CSzP JeOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=HstWZ7wBuof98X0e14CYNihmHfmZTv+cdnZr0Qil5NU=; b=iwjSJBFhkzeMX/EAcKKWlMhyBhf5/9FFLti5wcM6YU1VIaX3cpp+21jX8/Vb0YUBNz NdX0nDBfGA0qcLLBVssWGN0lkFOnTEFDt5fEMjA8alAM4DYidbQhiHIOlH1O7O5CcaaF PtNzb9aqUUic9fIHE9T6jp14aA95RwGNYp52KFR0RvfrNOsgwT3Zks/IQLNrsfWlXMzI wQiErjck9CbPkYbKkwOoCYR4pRczlTcQpCOTUSAiIvLTlidTX65taIvrikNjS2Pe9vxt VF4F6llJzvOa3ra1wE6YM7EgU0SfqX3mMvYzGXBWtLY4uOQ2NKQCJZUYXMsYdpCa7WOu F4CA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si3406749edd.44.2021.06.03.14.30.30; Thu, 03 Jun 2021 14:30:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbhFCVav (ORCPT + 99 others); Thu, 3 Jun 2021 17:30:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:50886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbhFCVau (ORCPT ); Thu, 3 Jun 2021 17:30:50 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 33EFB613F9; Thu, 3 Jun 2021 21:29:04 +0000 (UTC) Date: Thu, 3 Jun 2021 17:29:02 -0400 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: linux-kernel@vger.kernel.org, Phil Auld , Sebastian Andrzej Siewior , Kate Carcia , Jonathan Corbet , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexandre Chartre , Clark Willaims , John Kacur , Juri Lelli , linux-doc@vger.kernel.org Subject: Re: [PATCH V3 7/9] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers Message-ID: <20210603172902.41648183@gandalf.local.home> In-Reply-To: <2c59beee3b36b15592bfbb9f26dee7f8b55fd814.1621024265.git.bristot@redhat.com> References: <2c59beee3b36b15592bfbb9f26dee7f8b55fd814.1621024265.git.bristot@redhat.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 May 2021 22:51:16 +0200 Daniel Bristot de Oliveira wrote: > +++ b/include/trace/trace_events.h > @@ -358,6 +358,21 @@ TRACE_MAKE_SYSTEM_STR(); > trace_print_hex_dump_seq(p, prefix_str, prefix_type, \ > rowsize, groupsize, buf, len, ascii) > > +#undef __print_ns_to_secs > +#define __print_ns_to_secs(value) \ > + ({ \ > + u64 ____val = (u64)value; \ > + do_div(____val, NSEC_PER_SEC); \ > + ____val; \ > + }) I know my name is on this, but we need parenthesis around "value". > + > +#undef __print_ns_without_secs > +#define __print_ns_without_secs(value) \ > + ({ \ > + u64 ____val = (u64)value; \ Here too. > + (u32) do_div(____val, NSEC_PER_SEC); \ > + }) > + > #undef DECLARE_EVENT_CLASS > #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ > static notrace enum print_line_t \ > @@ -736,6 +751,16 @@ static inline void ftrace_test_probe_##call(void) \ > #undef __print_array > #undef __print_hex_dump > > +/* > + * The below is not executed in the kernel. It is only what is > + * displayed in the print format for userspace to parse. > + */ > +#undef __print_ns_to_secs > +#define __print_ns_to_secs(val) val / 1000000000UL > + > +#undef __print_ns_without_secs > +#define __print_ns_without_secs(val) val % 1000000000UL And around "val" in the above two macros. -- Steve > + > #undef TP_printk > #define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) >