From: Steven Rostedt <rostedt@goodmis.org>
To: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] tools lib traceevent, perf tools: Move struct tep_handler definition in a local header file
Date: Thu, 14 Mar 2019 12:13:54 -0400 [thread overview]
Message-ID: <20190314121354.42b586ef@gandalf.local.home> (raw)
In-Reply-To: <20190314120852.592eed46@gandalf.local.home>
On Thu, 14 Mar 2019 12:08:52 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> Please be careful not to do this on backports. If you need to add
> functionality, it needs to be a separate patch so that we can upstream
> it. Otherwise, I get confused to see why the traceevent code is
> different between trace-cmd and linux/tools when all the commits have
> been added.
Tzvetomir,
Can you prepare a new patch to send to tools lib traceevent upstream
that has the following changes in it (plus you the headers need to
updated).
Thanks!
-- Steve
--- ../linux-test.git/tools/lib/traceevent/event-parse-api.c 2019-03-14 09:44:49.355639646 -0400
+++ lib/traceevent/event-parse-api.c 2019-03-14 11:51:15.001665231 -0400
@@ -9,6 +9,22 @@
#include "event-utils.h"
/**
+ * tep_get_event - returns the event with the given index
+ * @tep: a handle to the tep_handle
+ * @index: index of the requested event, in the range 0 .. nr_events
+ *
+ * This returns pointer to the element of the events array with the given index
+ * If @tep is NULL, or @index is not in the range 0 .. nr_events, NULL is returned.
+ */
+struct tep_event *tep_get_event(struct tep_handle *tep, int index)
+{
+ if (tep && tep->events && index < tep->nr_events)
+ return tep->events[index];
+
+ return NULL;
+}
+
+/**
* tep_get_first_event - returns the first event in the events array
* @tep: a handle to the tep_handle
*
@@ -17,10 +33,7 @@
*/
struct tep_event *tep_get_first_event(struct tep_handle *tep)
{
- if (tep && tep->events)
- return tep->events[0];
-
- return NULL;
+ return tep_get_event(tep, 0);
}
/**
@@ -32,7 +45,7 @@
*/
int tep_get_events_count(struct tep_handle *tep)
{
- if(tep)
+ if (tep)
return tep->nr_events;
return 0;
}
@@ -43,14 +56,43 @@
* @flag: flag, or combination of flags to be set
* can be any combination from enum tep_flag
*
- * This sets a flag or mbination of flags from enum tep_flag
- */
-void tep_set_flag(struct tep_handle *tep, int flag)
+ * This sets a flag or combination of flags from enum tep_flag
+ */
+void tep_set_flag(struct tep_handle *tep, enum tep_flag flag)
{
- if(tep)
+ if (tep)
tep->flags |= flag;
}
+/**
+ * tep_reset_flag - reset event parser flag
+ * @tep: a handle to the tep_handle
+ * @flag: flag, or combination of flags to be reseted
+ * can be any combination from enum tep_flag
+ *
+ * This resets a flag or combination of flags from enum tep_flag
+ */
+void tep_reset_flag(struct tep_handle *tep, enum tep_flag flag)
+{
+ if (tep)
+ tep->flags &= ~flag;
+}
+
+/**
+ * tep_check_flag - check the state of event parser flag
+ * @tep: a handle to the tep_handle
+ * @flag: flag, or combination of flags to be checked
+ * can be any combination from enum tep_flag
+ *
+ * This checks the state of a flag or combination of flags from enum tep_flag
+ */
+int tep_check_flag(struct tep_handle *tep, enum tep_flag flag)
+{
+ if (tep)
+ return (tep->flags & flag);
+ return 0;
+}
+
unsigned short tep_data2host2(struct tep_handle *pevent, unsigned short data)
{
unsigned short swap;
@@ -108,12 +150,26 @@
*/
int tep_get_header_page_size(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->header_page_size_size;
return 0;
}
/**
+ * tep_get_header_page_ts_size - get size of the time stamp in the header page
+ * @tep: a handle to the tep_handle
+ *
+ * This returns size of the time stamp in the header page
+ * If @tep is NULL, 0 is returned.
+ */
+int tep_get_header_page_ts_size(struct tep_handle *tep)
+{
+ if (tep)
+ return tep->header_page_ts_size;
+ return 0;
+}
+
+/**
* tep_get_cpus - get the number of CPUs
* @pevent: a handle to the tep_handle
*
@@ -122,7 +178,7 @@
*/
int tep_get_cpus(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->cpus;
return 0;
}
@@ -135,7 +191,7 @@
*/
void tep_set_cpus(struct tep_handle *pevent, int cpus)
{
- if(pevent)
+ if (pevent)
pevent->cpus = cpus;
}
@@ -148,7 +204,7 @@
*/
int tep_get_long_size(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->long_size;
return 0;
}
@@ -162,7 +218,7 @@
*/
void tep_set_long_size(struct tep_handle *pevent, int long_size)
{
- if(pevent)
+ if (pevent)
pevent->long_size = long_size;
}
@@ -175,7 +231,7 @@
*/
int tep_get_page_size(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->page_size;
return 0;
}
@@ -189,7 +245,7 @@
*/
void tep_set_page_size(struct tep_handle *pevent, int _page_size)
{
- if(pevent)
+ if (pevent)
pevent->page_size = _page_size;
}
@@ -202,7 +258,7 @@
*/
int tep_file_bigendian(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->file_bigendian;
return 0;
}
@@ -216,7 +272,7 @@
*/
void tep_set_file_bigendian(struct tep_handle *pevent, enum tep_endian endian)
{
- if(pevent)
+ if (pevent)
pevent->file_bigendian = endian;
}
@@ -229,7 +285,7 @@
*/
int tep_is_host_bigendian(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->host_bigendian;
return 0;
}
@@ -243,7 +299,7 @@
*/
void tep_set_host_bigendian(struct tep_handle *pevent, enum tep_endian endian)
{
- if(pevent)
+ if (pevent)
pevent->host_bigendian = endian;
}
@@ -256,7 +312,7 @@
*/
int tep_is_latency_format(struct tep_handle *pevent)
{
- if(pevent)
+ if (pevent)
return pevent->latency_format;
return 0;
}
@@ -270,6 +326,76 @@
*/
void tep_set_latency_format(struct tep_handle *pevent, int lat)
{
- if(pevent)
+ if (pevent)
pevent->latency_format = lat;
}
+
+/**
+ * tep_set_parsing_failures - set parsing failures flag
+ * @tep: a handle to the tep_handle
+ * @parsing_failures: the new value of the parsing_failures flag
+ *
+ * This sets flag "parsing_failures" to the given count
+ */
+void tep_set_parsing_failures(struct tep_handle *tep, int parsing_failures)
+{
+ if (tep)
+ tep->parsing_failures = parsing_failures;
+}
+
+/**
+ * tep_get_parsing_failures - get the parsing failures flag
+ * @tep: a handle to the tep_handle
+ *
+ * This returns value of flag "parsing_failures"
+ * If @tep is NULL, 0 is returned.
+ */
+int tep_get_parsing_failures(struct tep_handle *tep)
+{
+ if (tep)
+ return tep->parsing_failures;
+ return 0;
+}
+
+/**
+ * tep_is_old_format - get if an old kernel is used
+ * @tep: a handle to the tep_handle
+ *
+ * This returns 1, if an old kernel is used to generate the tracing events or
+ * 0 if a new kernel is used. Old kernels did not have header page info.
+ * If @pevent is NULL, 0 is returned.
+ */
+int tep_is_old_format(struct tep_handle *tep)
+{
+ if (tep)
+ return tep->old_format;
+ return 0;
+}
+
+/**
+ * tep_set_print_raw - set a flag to force print in raw format
+ * @tep: a handle to the tep_handle
+ * @print_raw: the new value of the print_raw flag
+ *
+ * This sets a flag to force print in raw format
+ */
+void tep_set_print_raw(struct tep_handle *tep, int print_raw)
+{
+ if (tep)
+ tep->print_raw = print_raw;
+}
+
+/**
+ * tep_set_print_raw - set a flag to test a filter string
+ * @tep: a handle to the tep_handle
+ * @test_filters: the new value of the test_filters flag
+ *
+ * This sets a flag to fjust test a filter string. If this flag is set,
+ * when a filter string is added, then it will print the filters strings
+ * that were created and exit.
+ */
+void tep_set_test_filters(struct tep_handle *tep, int test_filters)
+{
+ if (tep)
+ tep->test_filters = test_filters;
+}
prev parent reply other threads:[~2019-03-14 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 10:51 [PATCH] tools lib traceevent, perf tools: Move struct tep_handler definition in a local header file Tzvetomir Stoyanov
2018-12-11 17:44 ` Steven Rostedt
2019-03-14 16:08 ` Steven Rostedt
2019-03-14 16:13 ` Steven Rostedt [this message]
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=20190314121354.42b586ef@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tstoyanov@vmware.com \
/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).