[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c1f71ed8f5d1bb8d048c54c509ee9b08878900c6@git.kernel.org>
Date: Fri, 14 Dec 2018 12:34:16 -0800
From: tip-bot for Tzvetomir Stoyanov <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, tglx@...utronix.de,
jolsa@...hat.com, namhyung@...nel.org, rostedt@...dmis.org,
akpm@...ux-foundation.org, hpa@...or.com, tstoyanov@...are.com,
mingo@...nel.org
Subject: [tip:perf/core] tools lib traceevent: Implement new API
tep_get_ref()
Commit-ID: c1f71ed8f5d1bb8d048c54c509ee9b08878900c6
Gitweb: https://git.kernel.org/tip/c1f71ed8f5d1bb8d048c54c509ee9b08878900c6
Author: Tzvetomir Stoyanov <tstoyanov@...are.com>
AuthorDate: Fri, 30 Nov 2018 10:44:04 -0500
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Fri, 30 Nov 2018 17:14:52 -0300
tools lib traceevent: Implement new API tep_get_ref()
This patch implements a new API of the tracevent library:
int tep_get_ref(struct tep_handle *tep);
The API returns the reference counter "ref_count" of the tep handler.
As "struct tep_handle" is internal only, its members cannot be accessed
by the library users, the API is used to get the reference counter.
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@...are.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Link: http://lkml.kernel.org/r/20181130154646.890615385@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/lib/traceevent/event-parse.c | 7 +++++++
tools/lib/traceevent/event-parse.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 2b5cb33046ce..d1e6ee3d43cf 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -6730,6 +6730,13 @@ void tep_ref(struct tep_handle *pevent)
pevent->ref_count++;
}
+int tep_get_ref(struct tep_handle *tep)
+{
+ if (tep)
+ return tep->ref_count;
+ return 0;
+}
+
void tep_free_format_field(struct tep_format_field *field)
{
free(field->type);
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 16bf4c890b6f..44ec26c72c2e 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -581,6 +581,7 @@ struct tep_handle *tep_alloc(void);
void tep_free(struct tep_handle *pevent);
void tep_ref(struct tep_handle *pevent);
void tep_unref(struct tep_handle *pevent);
+int tep_get_ref(struct tep_handle *tep);
/* access to the internal parser */
void tep_buffer_init(const char *buf, unsigned long long size);
Powered by blists - more mailing lists