From: Steven Rostedt <rostedt@goodmis.org>
To: <linux-trace-devel@vger.kernel.org>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Subject: [PATCH 09/11] libtracefs/Documentation: Update libtracefs-hist-cont.txt to new API
Date: Mon, 22 Nov 2021 18:49:54 -0500 [thread overview]
Message-ID: <20211122234956.788401-10-rostedt@goodmis.org> (raw)
In-Reply-To: <20211122234956.788401-1-rostedt@goodmis.org>
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
The histogram API has changed. Update the man page example to reflect
that.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Documentation/libtracefs-hist-cont.txt | 27 +++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/Documentation/libtracefs-hist-cont.txt b/Documentation/libtracefs-hist-cont.txt
index 778b8ee..5cdcc0a 100644
--- a/Documentation/libtracefs-hist-cont.txt
+++ b/Documentation/libtracefs-hist-cont.txt
@@ -66,6 +66,7 @@ int main (int argc, char **argv, char **env)
{
struct tracefs_instance *instance;
struct tracefs_hist *hist;
+ struct tep_handle *tep;
enum commands cmd;
char *cmd_str;
int ret;
@@ -94,22 +95,29 @@ int main (int argc, char **argv, char **env)
exit(-1);
}
+ tep = tracefs_local_events(NULL);
+ if (!tep) {
+ perror("Reading tracefs");
+ exit(-1);
+ }
+
instance = tracefs_instance_create("hist_test");
if (!instance) {
fprintf(stderr, "Failed instance create\n");
exit(-1);
}
- hist = tracefs_hist_alloc(instance, "kmem", "kmalloc",
- "call_site", TRACEFS_HIST_KEY_SYM,
- "bytes_req", 0);
+ hist = tracefs_hist2d_alloc(tep, "kmem", "kmalloc",
+ "call_site",TRACEFS_HIST_KEY_SYM,
+ "bytes_req", 0);
if (!hist) {
fprintf(stderr, "Failed hist create\n");
exit(-1);
}
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);
@@ -122,7 +130,7 @@ int main (int argc, char **argv, char **env)
switch (cmd) {
case START:
- ret = tracefs_hist_start(hist);
+ ret = tracefs_hist_start(instance, hist);
if (ret) {
char *err = tracefs_error_last(instance);
if (err)
@@ -130,16 +138,16 @@ int main (int argc, char **argv, char **env)
}
break;
case PAUSE:
- ret = tracefs_hist_pause(hist);
+ ret = tracefs_hist_pause(instance, hist);
break;
case CONT:
- ret = tracefs_hist_continue(hist);
+ ret = tracefs_hist_continue(instance, hist);
break;
case RESET:
- ret = tracefs_hist_reset(hist);
+ ret = tracefs_hist_reset(instance, hist);
break;
case DELETE:
- ret = tracefs_hist_destroy(hist);
+ ret = tracefs_hist_destroy(instance, hist);
break;
case SHOW: {
char *content;
@@ -157,6 +165,7 @@ int main (int argc, char **argv, char **env)
fprintf(stderr, "Failed: command\n");
exit(ret);
}
+
--
FILES
--
2.31.1
next prev parent reply other threads:[~2021-11-22 23:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 23:49 [PATCH 00/11] libtracefs: Have all man page examples be executable Steven Rostedt
2021-11-22 23:49 ` [PATCH 01/11] libtracefs: Move creation of sqlhist into new samples directory Steven Rostedt
2021-11-22 23:49 ` [PATCH 02/11] libtracefs: Fix example in the dynamic events man page to compile Steven Rostedt
2021-11-22 23:49 ` [PATCH 03/11] libtracefs/Documentation: Fix man page examples to include the proper header Steven Rostedt
2021-11-22 23:49 ` [PATCH 04/11] tracefs/Documentation: Fix example in libtracefs-eprobes.txt to compile Steven Rostedt
2021-11-22 23:49 ` [PATCH 05/11] libtracefs: Make samples easily extract man page example programs Steven Rostedt
2021-11-22 23:49 ` [PATCH 06/11] libtracefs: Add new API tracefs_dynevent_get() Steven Rostedt
2021-11-22 23:49 ` [PATCH 07/11] libtracefs/Documentation: Fix example in libtracefs-error.txt Steven Rostedt
2021-11-22 23:49 ` [PATCH 08/11] libtracefs/Documentation: Fix function-filter call to tracefs_list_free() Steven Rostedt
2021-11-22 23:49 ` Steven Rostedt [this message]
2021-11-22 23:49 ` [PATCH 10/11] libtracefs: Add all working man page examples to samples Steven Rostedt
2021-11-22 23:49 ` [PATCH 11/11] libtracefs/Documentation: Update stream example to have a parameter Steven Rostedt
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=20211122234956.788401-10-rostedt@goodmis.org \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.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).