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

Commit 09af2a55 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf record: Support per-event freq term



Now perf can set per-event value of time and (sampling) period.  But I
guess most users like me just want to set frequency rather than period.
So add the 'freq' term in the event parser.

Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1439102724-14079-1-git-send-email-namhyung@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 31191a85
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ OPTIONS
	  These params can be used to overload default config values per event.
	  Here is a list of the params.
	  - 'period': Set event sampling period
	  - 'freq': Set event sampling frequency
	  - 'time': Disable/enable time stamping. Acceptable values are 1 for
		    enabling time stamping. 0 for disabling time stamping.
		    The default is 1.
+4 −0
Original line number Diff line number Diff line
@@ -600,6 +600,10 @@ static void apply_config_terms(struct perf_evsel *evsel)
			attr->sample_period = term->val.period;
			attr->freq = 0;
			break;
		case PERF_EVSEL__CONFIG_TERM_FREQ:
			attr->sample_freq = term->val.freq;
			attr->freq = 1;
			break;
		case PERF_EVSEL__CONFIG_TERM_TIME:
			if (term->val.time)
				perf_evsel__set_sample_bit(evsel, TIME);
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ struct cgroup_sel;
*/
enum {
	PERF_EVSEL__CONFIG_TERM_PERIOD,
	PERF_EVSEL__CONFIG_TERM_FREQ,
	PERF_EVSEL__CONFIG_TERM_TIME,
	PERF_EVSEL__CONFIG_TERM_MAX,
};
@@ -48,6 +49,7 @@ struct perf_evsel_config_term {
	int	type;
	union {
		u64	period;
		u64	freq;
		bool	time;
	} val;
};
+6 −0
Original line number Diff line number Diff line
@@ -597,6 +597,9 @@ do { \
	case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
		CHECK_TYPE_VAL(NUM);
		break;
	case PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ:
		CHECK_TYPE_VAL(NUM);
		break;
	case PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE:
		/*
		 * TODO uncomment when the field is available
@@ -659,6 +662,9 @@ do { \
		case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
			ADD_CONFIG_TERM(PERIOD, period, term->val.num);
			break;
		case PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ:
			ADD_CONFIG_TERM(FREQ, freq, term->val.num);
			break;
		case PARSE_EVENTS__TERM_TYPE_TIME:
			ADD_CONFIG_TERM(TIME, time, term->val.num);
			break;
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ enum {
	PARSE_EVENTS__TERM_TYPE_CONFIG2,
	PARSE_EVENTS__TERM_TYPE_NAME,
	PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
	PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ,
	PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
	PARSE_EVENTS__TERM_TYPE_TIME,
};
Loading