Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3f33f93 authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Arnaldo Carvalho de Melo
Browse files

perf probe: Add helper function to check if probe with variable



Introduce helper function instead of inline code and replace hardcoded
strings "$vars" and "$params" with their corresponding macros.

perf_probe_with_var() is not declared as static since it will be called
from different file in subsequent patch.

Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 432746f8
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -1618,18 +1618,26 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)
	return ret;
}

/* Returns true if *any* ARG is either C variable, $params or $vars. */
bool perf_probe_with_var(struct perf_probe_event *pev)
{
	int i = 0;

	for (i = 0; i < pev->nargs; i++)
		if (is_c_varname(pev->args[i].var)              ||
		    !strcmp(pev->args[i].var, PROBE_ARG_PARAMS) ||
		    !strcmp(pev->args[i].var, PROBE_ARG_VARS))
			return true;
	return false;
}

/* Return true if this perf_probe_event requires debuginfo */
bool perf_probe_event_need_dwarf(struct perf_probe_event *pev)
{
	int i;

	if (pev->point.file || pev->point.line || pev->point.lazy_line)
		return true;

	for (i = 0; i < pev->nargs; i++)
		if (is_c_varname(pev->args[i].var) ||
		    !strcmp(pev->args[i].var, "$params") ||
		    !strcmp(pev->args[i].var, "$vars"))
	if (perf_probe_with_var(pev))
		return true;

	return false;
+2 −0
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ char *synthesize_perf_probe_point(struct perf_probe_point *pp);
int perf_probe_event__copy(struct perf_probe_event *dst,
			   struct perf_probe_event *src);

bool perf_probe_with_var(struct perf_probe_event *pev);

/* Check the perf_probe_event needs debuginfo */
bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);