From: Steven Rostedt <rostedt@goodmis.org>
To: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org,
Tom Zanussi <zanussi@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: Re: [PATCH 4/4] libtracefs: Implement API to create / modify and display histograms
Date: Wed, 7 Jul 2021 09:13:27 -0400 [thread overview]
Message-ID: <20210707091327.138fe95f@oasis.local.home> (raw)
In-Reply-To: <0707117e-119a-c7b6-ee1e-ef57e49917ad@gmail.com>
On Wed, 7 Jul 2021 11:12:03 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:
> Hi Steven,
> > +
> > + switch (cmd) {
> > + case START:
> > + ret = tracefs_hist_start(hist);
> > + if (ret) {
> > + char *err = tracefs_error_last(instance);
> > + if (err)
> > + fprintf(stderr, "\n%s\n", err);
> > + }
> > + break;
> > + case PAUSE:
> > + ret = tracefs_hist_pause(hist);
> > + break;
> > + case CONT:
> > + ret = tracefs_hist_continue(hist);
> > + break;
> > + case RESET:
> > + ret = tracefs_hist_reset(hist);
> > + break;
> > + case DELETE:
> > + ret = tracefs_hist_destroy(hist);
> > + break;
> > + case SHOW: {
> > + char *content;
> > + content = tracefs_event_file_read(instance, "kmem", "kmalloc",
> > + "hist", NULL);
>
> It looks more intuitive to have
>
> char *tracefs_hist_read(struct tracefs_hist *hist)
I thought a little about this, and rather have parsing of the file. We
could always add a helper function to do this later if it is helpful,
>
> > + ret = content ? 0 : -1;
> > + if (content) {
> > + printf("%s\n", content);
> > + free(content);
> > + }
> > + break;
> > + }
> > + }
>
> This "switch" can move to the library as well.
> We can have a method
>
> int tracefs_hist_ctrl(struct tracefs_hist *hist,
> const char *cmd,
> void *output);
>
Both this and the read file above could be added as enhancements, but I
don't think we need to add them to this current patch.
Thanks,
-- Steve
next prev parent reply other threads:[~2021-07-07 13:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 3:11 [PATCH 0/4] libtracefs: Work to add histogram APIs Steven Rostedt
2021-07-07 3:11 ` [PATCH 1/4] libtracefs: Implement tracefs_list_size() Steven Rostedt
2021-07-07 3:11 ` [PATCH 2/4] libtracefs: Implement functions to work on event directory files Steven Rostedt
2021-07-07 3:11 ` [PATCH 3/4] libtracefs: Have instances have internal ref counting Steven Rostedt
2021-07-07 3:11 ` [PATCH 4/4] libtracefs: Implement API to create / modify and display histograms Steven Rostedt
2021-07-07 8:12 ` Yordan Karadzhov (VMware)
2021-07-07 13:13 ` Steven Rostedt [this message]
2021-07-07 13:21 ` Yordan Karadzhov (VMware)
2021-07-07 13:48 ` 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=20210707091327.138fe95f@oasis.local.home \
--to=rostedt@goodmis.org \
--cc=bristot@redhat.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=namhyung@kernel.org \
--cc=y.karadz@gmail.com \
--cc=zanussi@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).