Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
perf probe-cache: Add for_each_probe_cache_entry() wrapper
Browse files Browse the repository at this point in the history
Add for_each_probe_cache_entry() wrapper macro for hiding list in
probe_cache.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831790386.17065.15082256697569419710.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
mhiramat authored and acmel committed Jul 14, 2016
1 parent c3492a3 commit 05bf2c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/perf/util/probe-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ probe_cache__find(struct probe_cache *pcache, struct perf_probe_event *pev)
if (!cmd)
return NULL;

list_for_each_entry(entry, &pcache->entries, node) {
for_each_probe_cache_entry(entry, pcache) {
if (pev->sdt) {
if (entry->pev.event &&
streql(entry->pev.event, pev->event) &&
Expand Down Expand Up @@ -576,7 +576,7 @@ probe_cache__find_by_name(struct probe_cache *pcache,
{
struct probe_cache_entry *entry = NULL;

list_for_each_entry(entry, &pcache->entries, node) {
for_each_probe_cache_entry(entry, pcache) {
/* Hit if same event name or same command-string */
if (streql(entry->pev.group, group) &&
streql(entry->pev.event, event))
Expand Down Expand Up @@ -748,7 +748,7 @@ int probe_cache__commit(struct probe_cache *pcache)
if (ret < 0)
goto out;

list_for_each_entry(entry, &pcache->entries, node) {
for_each_probe_cache_entry(entry, pcache) {
ret = probe_cache_entry__write(entry, pcache->fd);
pr_debug("Cache committed: %d\n", ret);
if (ret < 0)
Expand Down Expand Up @@ -790,7 +790,7 @@ static int probe_cache__show_entries(struct probe_cache *pcache,
{
struct probe_cache_entry *entry;

list_for_each_entry(entry, &pcache->entries, node) {
for_each_probe_cache_entry(entry, pcache) {
if (probe_cache_entry__compare(entry, filter))
printf("%s\n", entry->spev);
}
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/util/probe-file.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ struct probe_cache {

#define PF_FL_UPROBE 1
#define PF_FL_RW 2
#define for_each_probe_cache_entry(entry, pcache) \
list_for_each_entry(entry, &pcache->entries, node)

int probe_file__open(int flag);
int probe_file__open_both(int *kfd, int *ufd, int flag);
Expand Down

0 comments on commit 05bf2c8

Please sign in to comment.