Skip to contentSkip to conversation

tracefs: Make minor updates to histograms

PATCH New Steven Rostedt 1 participant 3 messages Nov 10, 2021 Documentation

lore
Share & tools
lore
#0 lore raw

cover tracefs: Make minor updates to histograms

From: "Steven Rostedt (VMware)" <[email protected]>

Make some minor changes to the tracefs histogram logic that Yordan made.

Based on:

https://patchwork.kernel.org/project/linux-trace-devel/list/?series=552199

Steven Rostedt (VMware) (2):
tracefs Documentation: Fix tracefs_hist_add_sort_key() example
tracefs: Rename tracefs_hist_reset_sort_key() tracefs_hist_set_sort_key()

 Documentation/libtracefs-hist.txt | 11 ++++++-----
 include/tracefs.h                 |  4 ++--
 src/tracefs-hist.c                |  6 +++---
 3 files changed, 11 insertions(+), 10 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 tracefs Documentation: Fix tracefs_hist_add_sort_key() example

From: "Steven Rostedt (VMware)" <[email protected]>

The tracefs_hist_add_sort_key() example in the man page had the old usage of variable args. Update it to use the new "one at a time" version.

---
 Documentation/libtracefs-hist.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/libtracefs-hist.txt +2 -1
index 0139ba8..cc82286 100644
@@ -282,7 +282,8 @@ int main (int argc, char **argv, char **env)
 	}
 
 	ret = tracefs_hist_add_value(hist, "bytes_alloc");
-	ret |= tracefs_hist_add_sort_key(hist, "bytes_req", "bytes_alloc", NULL);
+	ret |= tracefs_hist_add_sort_key(hist, "bytes_req");
+	ret |= tracefs_hist_add_sort_key(hist, "bytes_alloc");
 
 	ret |= tracefs_hist_sort_key_direction(hist, "bytes_alloc",
 					       TRACEFS_HIST_SORT_DESCENDING);
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/2 tracefs: Rename tracefs_hist_reset_sort_key() tracefs_hist_set_sort_key()

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

The commit log that added tracefs_hist_reset_sort_key() called it tracefs_hist_set_sort_key(), and that seems to be a better name.

---
 Documentation/libtracefs-hist.txt | 8 ++++----
 include/tracefs.h                 | 4 ++--
 src/tracefs-hist.c                | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
Documentation/libtracefs-hist.txt +4 -4
index cc82286..cc6b859 100644
@@ -4,7 +4,7 @@ libtracefs(3)
 NAME
 ----
 tracefs_hist_alloc, tracefs_hist_free, tracefs_hist_add_key, tracefs_hist_add_value, tracefs_hist_add_name, tracefs_hist_start,
-tracefs_hist_destory, tracefs_hist_add_sort_key, tracefs_hist_reset_sort_key,tracefs_hist_sort_key_direction - Create and update event histograms
+tracefs_hist_destory, tracefs_hist_add_sort_key, tracefs_hist_set_sort_key,tracefs_hist_sort_key_direction - Create and update event histograms
 
 SYNOPSIS
 --------
@@ -28,8 +28,8 @@ int tracefs_hist_add_key(struct tracefs_hist pass:[*]hist, const char pass:[*]ke
 int tracefs_hist_add_value(struct tracefs_hist pass:[*]hist, const char pass:[*]value);
 int tracefs_hist_add_sort_key(struct tracefs_hist pass:[*]hist,
 			      const char pass:[*]sort_key);
-int tracefs_hist_reset_sort_key(struct tracefs_hist pass:[*]hist,
-			        const char pass:[*]sort_key, ...);
+int tracefs_hist_set_sort_key(struct tracefs_hist pass:[*]hist,
+			      const char pass:[*]sort_key, ...);
 int tracefs_hist_sort_key_direction(struct tracefs_hist pass:[*]hist,
 				    const char pass:[*]sort_key,
 				    enum tracefs_hist_sort_direction dir);
@@ -104,7 +104,7 @@ that must match either an already defined key of the histogram, or an already
 defined value. If _hist_  already has sorting keys (previously added) the new
 _sort_key_ will have lower priority(be secondary or so on) when sorting.
 
-*tracefs_hist_reset_sort_key*() will reset the list of key to sort on. The _hist_ is
+*tracefs_hist_set_sort_key*() will reset the list of key to sort on. The _hist_ is
 the histrogram descriptor to reset the sort key to. The _sort_key_ is a string
 that must match either an already defined key of the histogram, or an already
 defined value. Multiple sort keys may be added to denote a secondary, sort order
include/tracefs.h +2 -2
index ebe83fe..32420eb 100644
@@ -337,8 +337,8 @@ int tracefs_hist_add_key(struct tracefs_hist *hist, const char *key,
 int tracefs_hist_add_value(struct tracefs_hist *hist, const char *value);
 int tracefs_hist_add_sort_key(struct tracefs_hist *hist,
 			      const char *sort_key);
-int tracefs_hist_reset_sort_key(struct tracefs_hist *hist,
-				const char *sort_key, ...);
+int tracefs_hist_set_sort_key(struct tracefs_hist *hist,
+			      const char *sort_key, ...);
 int tracefs_hist_sort_key_direction(struct tracefs_hist *hist,
 				    const char *sort_key,
 				    enum tracefs_hist_sort_direction dir);
src/tracefs-hist.c +3 -3
index 27bab00..7745bca 100644
@@ -477,7 +477,7 @@ int tracefs_hist_add_sort_key(struct tracefs_hist *hist,
 }
 
 /**
- * tracefs_hist_reset_sort_key - set a key for sorting the histogram
+ * tracefs_hist_set_sort_key - set a key for sorting the histogram
  * @hist: The histogram to set the sort key to
  * @sort_key: The key to sort (and the strings after it)
  *  Last one must be NULL.
@@ -487,8 +487,8 @@ int tracefs_hist_add_sort_key(struct tracefs_hist *hist,
  *
  * Returns 0 on success, -1 on error.
  */
-int tracefs_hist_reset_sort_key(struct tracefs_hist *hist,
-				const char *sort_key, ...)
+int tracefs_hist_set_sort_key(struct tracefs_hist *hist,
+			      const char *sort_key, ...)
 {
 	char **list = NULL;
 	char **tmp;
Signature · 1 line
2.31.1