All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: acme@ghostprotocols.net, mingo@elte.hu, peterz@infradead.org,
	fweisbec@gmail.com, paulus@samba.org, tglx@linutronix.de,
	David Ahern <dsahern@gmail.com>
Subject: [PATCH 2/6] perf utils: export parse_single_tracepoint_event
Date: Tue,  7 Jun 2011 17:55:26 -0600	[thread overview]
Message-ID: <1307490926-24639-1-git-send-email-dsahern@gmail.com> (raw)
In-Reply-To: <1307490806-24548-1-git-send-email-dsahern@gmail.com>

For use by perf-record in later patch. Allow strp arg to be NULL
as well.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/util/parse-events.c |   13 ++++---------
 tools/perf/util/parse-events.h |   12 ++++++++++++
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 41982c3..c15a701 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -19,12 +19,6 @@ struct event_symbol {
 	const char	*alias;
 };
 
-enum event_result {
-	EVT_FAILED,
-	EVT_HANDLED,
-	EVT_HANDLED_ALL
-};
-
 char debugfs_path[MAXPATHLEN];
 
 #define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
@@ -432,8 +426,8 @@ parse_generic_hw_event(const char **str, struct perf_event_attr *attr)
 	return EVT_HANDLED;
 }
 
-static enum event_result
-parse_single_tracepoint_event(char *sys_name,
+enum event_result
+parse_single_tracepoint_event(const char *sys_name,
 			      const char *evt_name,
 			      unsigned int evt_length,
 			      struct perf_event_attr *attr,
@@ -460,7 +454,8 @@ parse_single_tracepoint_event(char *sys_name,
 	id = atoll(id_buf);
 	attr->config = id;
 	attr->type = PERF_TYPE_TRACEPOINT;
-	*strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */
+	if (strp)
+		*strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */
 
 	attr->sample_type |= PERF_SAMPLE_RAW;
 	attr->sample_type |= PERF_SAMPLE_TIME;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 746d3fc..e65f724 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -17,6 +17,12 @@ struct tracepoint_path {
 	struct tracepoint_path *next;
 };
 
+enum event_result {
+	EVT_FAILED,
+	EVT_HANDLED,
+	EVT_HANDLED_ALL
+};
+
 extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
 extern bool have_tracepoints(struct list_head *evlist);
 
@@ -26,6 +32,12 @@ extern const char *__event_name(int type, u64 config);
 
 extern int parse_events(const struct option *opt, const char *str, int unset);
 extern int parse_filter(const struct option *opt, const char *str, int unset);
+extern enum event_result
+parse_single_tracepoint_event(const char *sys_name,
+			      const char *evt_name,
+			      unsigned int evt_length,
+			      struct perf_event_attr *attr,
+			      const char **strp);
 
 #define EVENTS_HELP_MAX (128*1024)
 
-- 
1.7.5.2

  parent reply	other threads:[~2011-06-07 23:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 23:53 [PATCH 0/6] Add time-of-day option to perf events David Ahern
2011-06-07 23:55 ` [PATCH 1/6] trace: add tracepoints to timekeeping code - xtime changes David Ahern
2011-06-17 13:23   ` Frederic Weisbecker
2011-06-17 14:13     ` David Ahern
2011-06-17 14:19       ` Frederic Weisbecker
2011-08-15  4:03       ` David Ahern
2011-06-07 23:55 ` David Ahern [this message]
2011-06-07 23:55 ` [PATCH 3/6] perf: add reference time event David Ahern
2011-06-17 13:32   ` Frederic Weisbecker
2011-06-17 14:04     ` David Ahern
2011-06-17 14:17       ` Frederic Weisbecker
2011-06-17 14:28         ` David Ahern
2011-07-11  4:20         ` David Ahern
2011-07-12 14:30           ` Frederic Weisbecker
2011-07-12 16:35             ` David Ahern
2011-07-12 17:03               ` Frederic Weisbecker
2011-08-04 15:10             ` David Ahern
     [not found]               ` <20110808193033.GA2744@ghostprotocols.net>
2011-08-15  4:06                 ` David Ahern
2011-06-07 23:56 ` [PATCH 4/6] perf record: add time-of-day option David Ahern
2011-06-17 14:14   ` Frederic Weisbecker
2011-06-17 14:23     ` David Ahern
2011-06-17 15:15       ` Frederic Weisbecker
2011-08-15  4:24         ` David Ahern
2011-08-15  4:24           ` David Ahern
2011-06-07 23:56 ` [PATCH 5/6] perf script: pass trace event to print_trace_event David Ahern
2011-06-07 23:56 ` [PATCH 6/6] perf script: add time-of-day option for displaying events David Ahern
2011-06-14 18:42 ` [PATCH 0/6] Add time-of-day option to perf events David Ahern

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=1307490926-24639-1-git-send-email-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.