From: Namhyung Kim <namhyung@kernel.org>
To: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com,
peterz@infradead.org, oleg@redhat.com,
hegdevasant@linux.vnet.ibm.com, mingo@redhat.com,
anton@redhat.com, systemtap@sourceware.org,
masami.hiramatsu.pt@hitachi.com, aravinda@linux.vnet.ibm.com,
penberg@iki.fi
Subject: Re: [PATCH v3 3/5] perf/sdt: Show SDT cache contents
Date: Wed, 22 Oct 2014 13:48:35 +0900 [thread overview]
Message-ID: <871tq0g15o.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20141010105830.15506.69597.stgit@hemant-fedora> (Hemant Kumar's message of "Fri, 10 Oct 2014 16:28:43 +0530")
On Fri, 10 Oct 2014 16:28:43 +0530, Hemant Kumar wrote:
> This patch adds support to dump the SDT cache onto sdtout.
> The cache data is read into a hash_list and then, it iterates through
> the hash_list to dump the data onto stdout.
>
> # ./perf sdt-cache --dump
>
> /usr/lib64/libc-2.16.so :
> %libc:lll_futex_wake
> %libc:longjmp_target
> %libc:longjmp
> %libc:lll_lock_wait_private
> %libc:lll_futex_wake
> %libc:longjmp_target
> %libc:longjmp
> %libc:setjmp
Hmm.. it seems the output is prefixed with '\t' in the code..
[SNIP]
> @@ -35,10 +45,14 @@ int cmd_sdt_cache(int argc, const char **argv, const char *prefix __maybe_unused
> OPT_CALLBACK('a', "add", NULL, "filename",
> "add SDT events from a file.",
> opt_add_sdt_events),
> + OPT_CALLBACK_NOOPT('D', "dump", NULL, "show SDT events",
> + "Read SDT events from cache and display.",
> + opt_show_sdt_events),
> OPT_END()
> };
> const char * const sdt_cache_usage[] = {
> "perf sdt-cache --add filename",
> + "perf sd-cache --dump",
s/sd-cache/sdt-cache/
> NULL
> };
[SNIP]
> +static void file_hash_list__display(struct hash_table *file_hash)
> +{
> + struct file_sdt_ent *file_pos;
> + struct list_head *sdt_head;
> + struct hlist_head *ent_head;
> + struct sdt_note *sdt_ptr;
> + int i;
> +
> + /* Go through all entries */
> + for (i = 0; i < SDT_HASH_SIZE; i++) {
> + /* Obtain the list head */
> + ent_head = &file_hash->ent[i];
> +
> + /* ':' are used here as delimiters */
> + hlist_for_each_entry(file_pos, ent_head, file_list) {
> + fprintf(stdout, "%s:\n", file_pos->name);
> + sdt_head = &file_pos->sdt_list;
> + list_for_each_entry(sdt_ptr, sdt_head, note_list) {
> + fprintf(stdout, "\t%%%s:%s\n",
> + sdt_ptr->provider, sdt_ptr->name);
.. Here you printed it with \t.
Other than that, looks good to me.
Thanks,
Namhyung
> + }
> + printf("\n");
> + }
> + }
> +}
> +
> +/**
> + * dump_sdt_events: Dump the SDT events on stdout
> + */
> +int dump_sdt_events(void)
> +{
> + struct hash_table file_hash;
> + int ret;
> +
> + ret = file_hash_list__init(&file_hash);
> + if (!ret)
> + file_hash_list__display(&file_hash);
> + file_hash_list__cleanup(&file_hash);
> + return ret;
> +}
next prev parent reply other threads:[~2014-10-22 4:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 10:57 [PATCH v3 0/5] perf/sdt: SDT events listing/probing Hemant Kumar
2014-10-10 10:57 ` [PATCH v3 1/5] perf/sdt: ELF support for SDT Hemant Kumar
2014-10-22 2:39 ` Namhyung Kim
2014-10-22 10:26 ` Hemant Kumar
2014-10-10 10:58 ` [PATCH v3 2/5] perf/sdt: Add SDT events into a cache Hemant Kumar
2014-10-22 4:41 ` Namhyung Kim
2014-10-24 11:28 ` Hemant Kumar
2014-10-23 11:51 ` Masami Hiramatsu
2014-10-10 10:58 ` [PATCH v3 3/5] perf/sdt: Show SDT cache contents Hemant Kumar
2014-10-22 4:48 ` Namhyung Kim [this message]
2014-10-10 10:59 ` [PATCH v3 4/5] perf/sdt: Delete SDT events from cache Hemant Kumar
2014-10-10 10:59 ` [PATCH v3 5/5] perf/sdt: Add support to perf record to trace SDT events Hemant Kumar
2014-10-22 6:45 ` Masami Hiramatsu
2014-10-22 8:20 ` Hemant Kumar
2014-10-22 9:41 ` Masami Hiramatsu
2014-10-23 5:31 ` Hemant Kumar
2014-10-23 5:54 ` Srikar Dronamraju
2014-10-23 6:33 ` Masami Hiramatsu
2014-10-23 8:21 ` Namhyung Kim
2014-10-23 8:57 ` Masami Hiramatsu
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=871tq0g15o.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=anton@redhat.com \
--cc=aravinda@linux.vnet.ibm.com \
--cc=hegdevasant@linux.vnet.ibm.com \
--cc=hemant@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=penberg@iki.fi \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=systemtap@sourceware.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
all inboxes | Powered by JetHome®