[tip:perf/core] tools lib traceevent: Man page for tep_read_number()

tip-bot for Tzvetomir Stoyanov
2019-05-18T09:09:12Z

Commit-ID: c76c22421875bbcbadd3c9fd4033981677aacfb0
Gitweb: https://git.kernel.org/tip/c76c22421875bbcbadd3c9fd4033981677aacfb0
Author: Tzvetomir Stoyanov <tstoyanov@vmware.com>
AuthorDate: Fri, 10 May 2019 15:56:20 -0400
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 15 May 2019 16:36:48 -0300

tools lib traceevent: Man page for tep_read_number()

Create man page for tep_read_number() libtraceevent API.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-trace-devel@vger.kernel.org
Link: http://lore.kernel.org/linux-trace-devel/20190503091119.23399-14-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190510200108.042164597@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
...vent-cpus.txt => libtraceevent-endian_read.txt} | 29 +++++++++++-----------
1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/lib/traceevent/Documentation/libtraceevent-cpus.txt b/tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt
similarity index 54%
copy from tools/lib/traceevent/Documentation/libtraceevent-cpus.txt
copy to tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt
index 5ad70e43b752..e64851b6e189 100644
--- a/tools/lib/traceevent/Documentation/libtraceevent-cpus.txt
+++ b/tools/lib/traceevent/Documentation/libtraceevent-endian_read.txt
@@ -3,8 +3,7 @@ libtraceevent(3)

NAME
----
-tep_get_cpus, tep_set_cpus - Get / set the number of CPUs, which have a tracing
-buffer representing it. Note, the buffer may be empty.
+tep_read_number - Reads a number from raw data.

SYNOPSIS
--------
@@ -12,23 +11,20 @@ SYNOPSIS
--
*#include <event-parse.h>*

-int *tep_get_cpus*(struct tep_handle pass:[*]_tep_);
-void *tep_set_cpus*(struct tep_handle pass:[*]_tep_, int _cpus_);
+unsigned long long *tep_read_number*(struct tep_handle pass:[*]_tep_, const void pass:[*]_ptr_, int _size_);
--

DESCRIPTION
-----------
-The _tep_get_cpus()_ function gets the number of CPUs, which have a tracing
-buffer representing it. The _tep_ argument is trace event parser context.
-
-The _tep_set_cpus()_ function sets the number of CPUs, which have a tracing
-buffer representing it. The _tep_ argument is trace event parser context.
-The _cpu_ argument is the number of CPUs with tracing data.
+The _tep_read_number()_ function reads an integer from raw data, taking into
+account the endianness of the raw data and the current host. The _tep_ argument
+is the trace event parser context. The _ptr_ is a pointer to the raw data, where
+the integer is, and the _size_ is the size of the integer.

RETURN VALUE
------------
-The _tep_get_cpus()_ functions returns the number of CPUs, which have tracing
-data recorded.
+The _tep_read_number()_ function returns the integer in the byte order of
+the current host. In case of an error, 0 is returned.

EXAMPLE
-------
@@ -38,9 +34,14 @@ EXAMPLE
...
struct tep_handle *tep = tep_alloc();
...
- tep_set_cpus(tep, 5);
+void process_record(struct tep_record *record)
+{
+ int offset = 24;
+ int data = tep_read_number(tep, record->data + offset, 4);
+
+ /* Read the 4 bytes at the offset 24 of data as an integer */
+}
...
- printf("We have tracing data for %d CPUs", tep_get_cpus(tep));
--

FILES