Skip to contentSkip to conversation

tools/lib/traceevent: Change description of few APIs

PATCH In review Tzvetomir Stoyanov 3 participants 4 messages Mar 15, 2019 – Mar 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 tools/lib/traceevent: Change description of few APIs

APIs descriptions should describe the purpose of the function, its parameters and return value. While working on man pages implementation, I noticed mismatches in the descriptions of few APIs. This patch changes the description of these APIs, making them consistent with the man pages:
tep_print_num_field(), tep_print_func_field(), tep_get_header_page_size(), tep_get_long_size(), tep_set_long_size(), tep_get_page_size() and tep_set_page_size().

---
 tools/lib/traceevent/event-parse-api.c | 21 ++++++++++++---------
 tools/lib/traceevent/event-parse.c     |  4 ++--
 2 files changed, 14 insertions(+), 11 deletions(-)
tools/lib/traceevent/event-parse-api.c +12 -9
index d4368dcc16ea..2d5d3642e3e9 100644
@@ -100,10 +100,10 @@ tep_data2host8(struct tep_handle *pevent, unsigned long long data)
 }
 
 /**
- * tep_get_header_page_size - get size of the header page
+ * tep_get_header_page_size - get the size of a long integer, in kernel context
  * @pevent: a handle to the tep_handle
  *
- * This returns size of the header page
+ * This returns the size of a long integer, in kernel context
  * If @pevent is NULL, 0 is returned.
  */
 int tep_get_header_page_size(struct tep_handle *pevent)
@@ -140,10 +140,11 @@ void tep_set_cpus(struct tep_handle *pevent, int cpus)
 }
 
 /**
- * tep_get_long_size - get the size of a long integer on the current machine
+ * tep_get_long_size - get the size of a long integer on the traced machine
  * @pevent: a handle to the tep_handle
  *
- * This returns the size of a long integer on the current machine
+ * This returns the size of a long integer on the machine,
+ * where the trace is generated
  * If @pevent is NULL, 0 is returned.
  */
 int tep_get_long_size(struct tep_handle *pevent)
@@ -154,7 +155,7 @@ int tep_get_long_size(struct tep_handle *pevent)
 }
 
 /**
- * tep_set_long_size - set the size of a long integer on the current machine
+ * tep_set_long_size - set the size of a long integer on the traced machine
  * @pevent: a handle to the tep_handle
  * @size: size, in bytes, of a long integer
  *
@@ -167,10 +168,11 @@ void tep_set_long_size(struct tep_handle *pevent, int long_size)
 }
 
 /**
- * tep_get_page_size - get the size of a memory page on the current machine
+ * tep_get_page_size - get the size of a memory page on the traced machine
  * @pevent: a handle to the tep_handle
  *
- * This returns the size of a memory page on the current machine
+ * This returns the size of a memory page on the machine,
+ * where the trace is generated
  * If @pevent is NULL, 0 is returned.
  */
 int tep_get_page_size(struct tep_handle *pevent)
@@ -181,11 +183,12 @@ int tep_get_page_size(struct tep_handle *pevent)
 }
 
 /**
- * tep_set_page_size - set the size of a memory page on the current machine
+ * tep_set_page_size - set the size of a memory page on the traced machine
  * @pevent: a handle to the tep_handle
  * @_page_size: size of a memory page, in bytes
  *
- * This sets the size of a memory page on the current machine
+ * This sets the size of a memory page on the machine,
+ * where the trace is generated
  */
 void tep_set_page_size(struct tep_handle *pevent, int _page_size)
 {
tools/lib/traceevent/event-parse.c +2 -2
index 8f6ff7e0b51e..e6c7dcc5f3ee 100644
@@ -6441,7 +6441,7 @@ int tep_get_any_field_val(struct trace_seq *s, struct tep_event *event,
  * @record: The record with the field name.
  * @err: print default error if failed.
  *
- * Returns: 0 on success, -1 field not found, or 1 if buffer is full.
+ * Returns: 1 on success, -1 field not found, or 0 if buffer is full.
  */
 int tep_print_num_field(struct trace_seq *s, const char *fmt,
 			struct tep_event *event, const char *name,
@@ -6473,7 +6473,7 @@ int tep_print_num_field(struct trace_seq *s, const char *fmt,
  * @record: The record with the field name.
  * @err: print default error if failed.
  *
- * Returns: 0 on success, -1 field not found, or 1 if buffer is full.
+ * Returns: 1 on success, -1 field not found, or 0 if buffer is full.
  */
 int tep_print_func_field(struct trace_seq *s, const char *fmt,
 			 struct tep_event *event, const char *name,
Signature · 1 line
2.20.1
#1 lore raw
Quoted 25 lines · Tzvetomir Stoyanov

APIs descriptions should describe the purpose of the function, its parameters and return value. While working on man pages implementation, I noticed mismatches in the descriptions of few APIs. This patch changes the description of these APIs, making them consistent with the man pages:
tep_print_num_field(), tep_print_func_field(), tep_get_header_page_size(), tep_get_long_size(), tep_set_long_size(), tep_get_page_size() and tep_set_page_size().

---
tools/lib/traceevent/event-parse-api.c | 21 ++++++++++++---------
tools/lib/traceevent/event-parse.c | 4 ++--

2 files changed, 14 insertions(+), 11 deletions(-)
tools/lib/traceevent/event-parse-api.c +0 -0
index d4368dcc16ea..2d5d3642e3e9 100644

tools/lib/traceevent/event-parse-api.c tep_data2host8(struct tep_handle *pevent, unsigned long long data) · line 103

Quoted 5 lines
tools/lib/traceevent/event-parse-api.c +1 -1
@@ -100,10 +100,10 @@ tep_data2host8(struct tep_handle *pevent, unsigned long long data)
 }
 
 /**
- * tep_get_header_page_size - get size of the header page
+ * tep_get_header_page_size - get the size of a long integer, in kernel context

Just want to check If this comment change correct. Given the function name it looks a bit odd compared to the comment for tep_get_long_size().

Quoted 20 lines
tools/lib/traceevent/event-parse-api.c +4 -3
 * @pevent: a handle to the tep_handle
 *
- * This returns size of the header page
+ * This returns the size of a long integer, in kernel context
 * If @pevent is NULL, 0 is returned.
 */
 int tep_get_header_page_size(struct tep_handle *pevent)
@@ -140,10 +140,11 @@ void tep_set_cpus(struct tep_handle *pevent, int cpus)
 }
 
 /**
- * tep_get_long_size - get the size of a long integer on the current machine
+ * tep_get_long_size - get the size of a long integer on the traced machine
 * @pevent: a handle to the tep_handle
 *
- * This returns the size of a long integer on the current machine
+ * This returns the size of a long integer on the machine,
+ * where the trace is generated
 * If @pevent is NULL, 0 is returned.
 */
#2 lore raw
Quoted 28 lines · Matt Helsley
Quoted 28 lines · Tzvetomir Stoyanov

APIs descriptions should describe the purpose of the function, its parameters and return value. While working on man pages implementation, I noticed mismatches in the descriptions of few APIs. This patch changes the description of these APIs, making them consistent with the man pages:
tep_print_num_field(), tep_print_func_field(), tep_get_header_page_size(), tep_get_long_size(), tep_set_long_size(), tep_get_page_size() and tep_set_page_size().

---
tools/lib/traceevent/event-parse-api.c | 21 ++++++++++++---------
tools/lib/traceevent/event-parse.c | 4 ++--

2 files changed, 14 insertions(+), 11 deletions(-)
tools/lib/traceevent/event-parse-api.c +0 -0
index d4368dcc16ea..2d5d3642e3e9 100644
@@ -100,10 +100,10 @@ tep_data2host8(struct tep_handle *pevent, unsigned long long data)
 }
 
Quoted 5 lines

tools/lib/traceevent/event-parse-api.c tep_data2host8(struct tep_handle *pevent, unsigned long long data) · line 103

Quoted 3 lines
tools/lib/traceevent/event-parse-api.c +1 -1
 /**
- * tep_get_header_page_size - get size of the header page
+ * tep_get_header_page_size - get the size of a long integer, in kernel context

Just want to check If this comment change correct. Given the function name it looks a bit odd compared to the comment for tep_get_long_size().

It is a copy / paste error,
Thanks Matt

Quoted 11 lines
Quoted 11 lines
tools/lib/traceevent/event-parse-api.c +1 -1
 * @pevent: a handle to the tep_handle
 *
- * This returns size of the header page
+ * This returns the size of a long integer, in kernel context
 * If @pevent is NULL, 0 is returned.
 */
 int tep_get_header_page_size(struct tep_handle *pevent)
@@ -140,10 +140,11 @@ void tep_set_cpus(struct tep_handle *pevent, int cpus)
 }
 
Quoted 10 lines

tools/lib/traceevent/event-parse-api.c void tep_set_cpus(struct tep_handle *pevent, int cpus) · line 149

Quoted 10 lines
tools/lib/traceevent/event-parse-api.c +3 -2
 /**
- * tep_get_long_size - get the size of a long integer on the current machine
+ * tep_get_long_size - get the size of a long integer on the traced machine
 * @pevent: a handle to the tep_handle
 *
- * This returns the size of a long integer on the current machine
+ * This returns the size of a long integer on the machine,
+ * where the trace is generated
 * If @pevent is NULL, 0 is returned.
 */

--

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

#3 lore raw
Quoted 29 lines · On Tue, 19 Mar 2019 10:35:05 +0000 Tzvetomir Stoyanov <[email protected]>…
Quoted 28 lines · Matt Helsley
Quoted 28 lines · Tzvetomir Stoyanov

APIs descriptions should describe the purpose of the function, its parameters and return value. While working on man pages implementation, I noticed mismatches in the descriptions of few APIs. This patch changes the description of these APIs, making them consistent with the man pages:
tep_print_num_field(), tep_print_func_field(), tep_get_header_page_size(), tep_get_long_size(), tep_set_long_size(), tep_get_page_size() and tep_set_page_size().

---
tools/lib/traceevent/event-parse-api.c | 21 ++++++++++++---------
tools/lib/traceevent/event-parse.c | 4 ++--

2 files changed, 14 insertions(+), 11 deletions(-)
tools/lib/traceevent/event-parse-api.c +0 -0
index d4368dcc16ea..2d5d3642e3e9 100644
@@ -100,10 +100,10 @@ tep_data2host8(struct tep_handle *pevent, unsigned long long data)
 }
 
Quoted 7 lines
Quoted 5 lines

tools/lib/traceevent/event-parse-api.c tep_data2host8(struct tep_handle *pevent, unsigned long long data) · line 103

Quoted 3 lines
tools/lib/traceevent/event-parse-api.c +1 -1
 /**
- * tep_get_header_page_size - get size of the header page
+ * tep_get_header_page_size - get the size of a long integer, in kernel context  

Just want to check If this comment change correct. Given the function name it looks a bit odd compared to the comment for tep_get_long_size().

It is a copy / paste error,

Hmm, the function name is very confusing, as it is returning the kernel context long size. Perhaps we should rename it to:

tep_get_header_long_size()

-- Steve

Quoted 31 lines

Thanks Matt

Quoted 11 lines
Quoted 11 lines
tools/lib/traceevent/event-parse-api.c +1 -1
 * @pevent: a handle to the tep_handle
 *
- * This returns size of the header page
+ * This returns the size of a long integer, in kernel context
 * If @pevent is NULL, 0 is returned.
 */
 int tep_get_header_page_size(struct tep_handle *pevent)
@@ -140,10 +140,11 @@ void tep_set_cpus(struct tep_handle *pevent, int cpus)
 }
 
Quoted 10 lines

tools/lib/traceevent/event-parse-api.c void tep_set_cpus(struct tep_handle *pevent, int cpus) · line 149

Quoted 10 lines
tools/lib/traceevent/event-parse-api.c +3 -2
 /**
- * tep_get_long_size - get the size of a long integer on the current machine
+ * tep_get_long_size - get the size of a long integer on the traced machine
 * @pevent: a handle to the tep_handle
 *
- * This returns the size of a long integer on the current machine
+ * This returns the size of a long integer on the machine,
+ * where the trace is generated
 * If @pevent is NULL, 0 is returned.
 */  

--

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center