linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 1/4] trace-cmd: Add internal API to check if tsc2nsec is supported
Date: Mon, 29 Mar 2021 15:58:18 +0300	[thread overview]
Message-ID: <20210329125821.97496-2-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210329125821.97496-1-tz.stoyanov@gmail.com>

A new internal API is added to check is tsc to nanoseconds conversion is
supported:
 bool trace_tsc2nsec_is_supported(void);

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 tracecmd/include/trace-local.h | 2 ++
 tracecmd/trace-record.c        | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index 7773e9fc..6a4c5f51 100644
--- a/tracecmd/include/trace-local.h
+++ b/tracecmd/include/trace-local.h
@@ -341,4 +341,6 @@ static inline bool is_digits(const char *s)
 	return true;
 }
 
+bool trace_tsc2nsec_is_supported(void);
+
 #endif /* __TRACE_LOCAL_H */
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 5e69cf48..5c9d800f 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -5827,6 +5827,11 @@ static int get_tsc_nsec(int *shift, int *mult)
 }
 #endif
 
+bool trace_tsc2nsec_is_supported(void)
+{
+	return (get_tsc_nsec(NULL, NULL) == 0);
+}
+
 static void parse_record_options(int argc,
 				 char **argv,
 				 enum trace_cmd curr_cmd,
-- 
2.30.2


  reply	other threads:[~2021-03-29 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 12:58 [PATCH 0/4] Documented new trace-cmd options Tzvetomir Stoyanov (VMware)
2021-03-29 12:58 ` Tzvetomir Stoyanov (VMware) [this message]
2021-03-30 21:37   ` [PATCH 1/4] trace-cmd: Add internal API to check if tsc2nsec is supported Steven Rostedt
2021-03-29 12:58 ` [PATCH 2/4] trace-cmd: Add tsc2nsec clock to "list -C" command Tzvetomir Stoyanov (VMware)
2021-03-29 12:58 ` [PATCH 3/4] trace-cmd: Document --tsc2nsec option Tzvetomir Stoyanov (VMware)
2021-03-29 12:58 ` [PATCH 4/4] trace-cmd: Document --raw-ts option Tzvetomir Stoyanov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210329125821.97496-2-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).