linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Tzvetomir Stoyanov <tstoyanov@vmware.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 19/44] tools lib traceevent: Remove tep filter trivial APIs
Date: Tue,  2 Apr 2019 13:05:24 -0300	[thread overview]
Message-ID: <20190402160549.13544-20-acme@kernel.org> (raw)
In-Reply-To: <20190402160549.13544-1-acme@kernel.org>

From: Tzvetomir Stoyanov <tstoyanov@vmware.com>

This patch removes trivial filter tep APIs:

  enum tep_filter_trivial_type
  tep_filter_event_has_trivial()
  tep_update_trivial()
  tep_filter_clear_trivial()

Trivial filters is an optimization, used only in the first version of
KernelShark. The API is deprecated, the next KernelShark release does
not use it.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20190326154328.28718-4-tstoyanov@vmware.com
Link: http://lkml.kernel.org/r/20190401164343.968458918@goodmis.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  16 ---
 tools/lib/traceevent/parse-filter.c | 169 ----------------------------
 2 files changed, 185 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index be082f9692f1..3833d1384599 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -732,12 +732,6 @@ struct tep_event_filter *tep_filter_alloc(struct tep_handle *pevent);
 #define FILTER_MISS		TEP_ERRNO__FILTER_MISS
 #define FILTER_MATCH		TEP_ERRNO__FILTER_MATCH
 
-enum tep_filter_trivial_type {
-	TEP_FILTER_TRIVIAL_FALSE,
-	TEP_FILTER_TRIVIAL_TRUE,
-	TEP_FILTER_TRIVIAL_BOTH,
-};
-
 enum tep_errno tep_filter_add_filter_str(struct tep_event_filter *filter,
 					 const char *filter_str);
 
@@ -752,9 +746,6 @@ int tep_event_filtered(struct tep_event_filter *filter,
 
 void tep_filter_reset(struct tep_event_filter *filter);
 
-int tep_filter_clear_trivial(struct tep_event_filter *filter,
-			     enum tep_filter_trivial_type type);
-
 void tep_filter_free(struct tep_event_filter *filter);
 
 char *tep_filter_make_string(struct tep_event_filter *filter, int event_id);
@@ -762,15 +753,8 @@ char *tep_filter_make_string(struct tep_event_filter *filter, int event_id);
 int tep_filter_remove_event(struct tep_event_filter *filter,
 			    int event_id);
 
-int tep_filter_event_has_trivial(struct tep_event_filter *filter,
-				 int event_id,
-				 enum tep_filter_trivial_type type);
-
 int tep_filter_copy(struct tep_event_filter *dest, struct tep_event_filter *source);
 
-int tep_update_trivial(struct tep_event_filter *dest, struct tep_event_filter *source,
-			enum tep_filter_trivial_type type);
-
 int tep_filter_compare(struct tep_event_filter *filter1, struct tep_event_filter *filter2);
 
 #endif /* _PARSE_EVENTS_H */
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index cb5ce66dab6e..4ffd8b25a852 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1522,167 +1522,6 @@ int tep_filter_copy(struct tep_event_filter *dest, struct tep_event_filter *sour
 	return ret;
 }
 
-
-/**
- * tep_update_trivial - update the trivial filters with the given filter
- * @dest - the filter to update
- * @source - the filter as the source of the update
- * @type - the type of trivial filter to update.
- *
- * Scan dest for trivial events matching @type to replace with the source.
- *
- * Returns 0 on success and -1 if there was a problem updating, but
- *   events may have still been updated on error.
- */
-int tep_update_trivial(struct tep_event_filter *dest, struct tep_event_filter *source,
-		       enum tep_filter_trivial_type type)
-{
-	struct tep_handle *src_pevent;
-	struct tep_handle *dest_pevent;
-	struct tep_event *event;
-	struct tep_filter_type *filter_type;
-	struct tep_filter_arg *arg;
-	char *str;
-	int i;
-
-	src_pevent = source->pevent;
-	dest_pevent = dest->pevent;
-
-	/* Do nothing if either of the filters has nothing to filter */
-	if (!dest->filters || !source->filters)
-		return 0;
-
-	for (i = 0; i < dest->filters; i++) {
-		filter_type = &dest->event_filters[i];
-		arg = filter_type->filter;
-		if (arg->type != TEP_FILTER_ARG_BOOLEAN)
-			continue;
-		if ((arg->boolean.value && type == TEP_FILTER_TRIVIAL_FALSE) ||
-		    (!arg->boolean.value && type == TEP_FILTER_TRIVIAL_TRUE))
-			continue;
-
-		event = filter_type->event;
-
-		if (src_pevent != dest_pevent) {
-			/* do a look up */
-			event = tep_find_event_by_name(src_pevent,
-						       event->system,
-						       event->name);
-			if (!event)
-				return -1;
-		}
-
-		str = tep_filter_make_string(source, event->id);
-		if (!str)
-			continue;
-
-		/* Don't bother if the filter is trivial too */
-		if (strcmp(str, "TRUE") != 0 && strcmp(str, "FALSE") != 0)
-			filter_event(dest, event, str, NULL);
-		free(str);
-	}
-	return 0;
-}
-
-/**
- * tep_filter_clear_trivial - clear TRUE and FALSE filters
- * @filter: the filter to remove trivial filters from
- * @type: remove only true, false, or both
- *
- * Removes filters that only contain a TRUE or FALES boolean arg.
- *
- * Returns 0 on success and -1 if there was a problem.
- */
-int tep_filter_clear_trivial(struct tep_event_filter *filter,
-			     enum tep_filter_trivial_type type)
-{
-	struct tep_filter_type *filter_type;
-	int count = 0;
-	int *ids = NULL;
-	int i;
-
-	if (!filter->filters)
-		return 0;
-
-	/*
-	 * Two steps, first get all ids with trivial filters.
-	 *  then remove those ids.
-	 */
-	for (i = 0; i < filter->filters; i++) {
-		int *new_ids;
-
-		filter_type = &filter->event_filters[i];
-		if (filter_type->filter->type != TEP_FILTER_ARG_BOOLEAN)
-			continue;
-		switch (type) {
-		case TEP_FILTER_TRIVIAL_FALSE:
-			if (filter_type->filter->boolean.value)
-				continue;
-			break;
-		case TEP_FILTER_TRIVIAL_TRUE:
-			if (!filter_type->filter->boolean.value)
-				continue;
-		default:
-			break;
-		}
-
-		new_ids = realloc(ids, sizeof(*ids) * (count + 1));
-		if (!new_ids) {
-			free(ids);
-			return -1;
-		}
-
-		ids = new_ids;
-		ids[count++] = filter_type->event_id;
-	}
-
-	if (!count)
-		return 0;
-
-	for (i = 0; i < count; i++)
-		tep_filter_remove_event(filter, ids[i]);
-
-	free(ids);
-	return 0;
-}
-
-/**
- * tep_filter_event_has_trivial - return true event contains trivial filter
- * @filter: the filter with the information
- * @event_id: the id of the event to test
- * @type: trivial type to test for (TRUE, FALSE, EITHER)
- *
- * Returns 1 if the event contains a matching trivial type
- *  otherwise 0.
- */
-int tep_filter_event_has_trivial(struct tep_event_filter *filter,
-				 int event_id,
-				 enum tep_filter_trivial_type type)
-{
-	struct tep_filter_type *filter_type;
-
-	if (!filter->filters)
-		return 0;
-
-	filter_type = find_filter_type(filter, event_id);
-
-	if (!filter_type)
-		return 0;
-
-	if (filter_type->filter->type != TEP_FILTER_ARG_BOOLEAN)
-		return 0;
-
-	switch (type) {
-	case TEP_FILTER_TRIVIAL_FALSE:
-		return !filter_type->filter->boolean.value;
-
-	case TEP_FILTER_TRIVIAL_TRUE:
-		return filter_type->filter->boolean.value;
-	default:
-		return 1;
-	}
-}
-
 static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
 		       struct tep_record *record, enum tep_errno *err);
 
@@ -2409,14 +2248,6 @@ int tep_filter_compare(struct tep_event_filter *filter1, struct tep_event_filter
 			break;
 		if (filter_type1->filter->type != filter_type2->filter->type)
 			break;
-		switch (filter_type1->filter->type) {
-		case TEP_FILTER_TRIVIAL_FALSE:
-		case TEP_FILTER_TRIVIAL_TRUE:
-			/* trivial types just need the type compared */
-			continue;
-		default:
-			break;
-		}
 		/* The best way to compare complex filters is with strings */
 		str1 = arg_to_str(filter1, filter_type1->filter);
 		str2 = arg_to_str(filter2, filter_type2->filter);
-- 
2.20.1

  parent reply	other threads:[~2019-04-02 16:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 16:05 [GIT PULL 00/44] perf/core improvements and fixes for 5.2 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 01/44] perf trace: Add 'string' event alias to select syscalls with string args Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 02/44] perf augmented_raw_syscalls: Copy strings from all syscalls with 1st or 2nd string arg Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 03/44] perf augmented_raw_syscalls: Use a PERCPU_ARRAY map to copy more string bytes Arnaldo Carvalho de Melo
2019-04-02 16:44   ` Andrii Nakryiko
2019-04-02 16:05 ` [PATCH 04/44] perf trace beauty renameat: No need to include linux/fs.h Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 05/44] perf tools: Add header defining used namespace struct to event.h Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 06/44] perf list: Fix s390 counter long description for L1D_RO_EXCL_WRITES Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 07/44] perf stat: Revert checks for duration_time Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 08/44] perf stat: Implement duration_time as a proper event Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 09/44] perf evsel: Support printing evsel name for 'duration_time' Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 10/44] perf list: Output tool events Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 11/44] tools lib traceevent: Handle trace_printk() "%px" Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 12/44] tools lib traceevent: Add mono clocks to be parsed in seconds Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 13/44] tools lib traceevent: Implement a new API, tep_list_events_copy() Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 14/44] tools lib traceevent: Add more debugging to see various internal ring buffer entries Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 15/44] tools lib traceevent: Change description of few APIs Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 16/44] tools lib traceevent: Coding style fixes Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 17/44] tools lib traceevent: Implement new traceevent APIs for accessing struct tep_handler fields Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 18/44] tools lib traceevent: Removed unneeded !! and return parenthesis Arnaldo Carvalho de Melo
2019-04-02 16:05 ` Arnaldo Carvalho de Melo [this message]
2019-04-02 16:05 ` [PATCH 20/44] tools lib traceevent: Remove call to exit() from tep_filter_add_filter_str() Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 21/44] tools tools, tools lib traceevent: Make traceevent APIs more consistent Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 22/44] tools lib traceevent: Rename input arguments of libtraceevent APIs from pevent to tep Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 23/44] perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event to "tep" Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 24/44] perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event_filter " Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 25/44] tools lib traceevent: Rename input arguments and local variables of libtraceevent from pevent to tep Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 26/44] tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 27/44] perf record: Implement --mmap-flush=<number> option Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 28/44] perf vendor events intel: Update metrics from TMAM 3.5 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 29/44] perf vendor events intel: Update Broadwell events to v23 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 30/44] perf vendor events intel: Update Broadwell-DE events to v7 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 31/44] perf vendor events intel: Update Skylake events to v42 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 32/44] perf vendor events intel: Update SkylakeX events to v1.12 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 33/44] perf vendor events intel: Update BroadwellX events to v14 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 34/44] perf vendor events intel: Update HaswellX events to v20 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 35/44] perf vendor events intel: Update IvyTown " Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 36/44] perf vendor events intel: Update JakeTown " Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 37/44] perf vendor events intel: Update SandyBridge events to v16 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 38/44] perf vendor events intel: Update IvyBridge events to v21 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 39/44] perf vendor events intel: Update Haswell events to v28 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 40/44] perf vendor events intel: Update KnightsLanding events to v9 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 41/44] perf vendor events intel: Update Bonnell to V4 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 42/44] perf vendor events intel: Update Goldmont to v13 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 43/44] perf vendor events intel: Update GoldmontPlus to v1.01 Arnaldo Carvalho de Melo
2019-04-02 16:05 ` [PATCH 44/44] perf vendor events intel: Update Silvermont to v14 Arnaldo Carvalho de Melo

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=20190402160549.13544-20-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tstoyanov@vmware.com \
    --cc=williams@redhat.com \
    /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).