tools/perf/util/parse-events.l

Source file repositories/reference/linux-study-clean/tools/perf/util/parse-events.l

File Facts

System
Linux kernel
Corpus path
tools/perf/util/parse-events.l
Extension
.l
Size
11057 bytes
Lines
373
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (mod.field) {				\
				modifiers_error(parse_state, scanner, i, c, #field); \
				return PE_ERROR;			\
			}						\
			mod.field = true;				\
			break

		switch (text[i]) {
		CASE('u', user);
		CASE('k', kernel);
		CASE('h', hypervisor);
		CASE('I', non_idle);
		CASE('G', guest);
		CASE('H', host);
		case 'p':
			mod.precise++;
			/*
			 * precise ip:
			 *
			 *  0 - SAMPLE_IP can have arbitrary skid
			 *  1 - SAMPLE_IP must have constant skid
			 *  2 - SAMPLE_IP requested to have 0 skid
			 *  3 - SAMPLE_IP must have 0 skid
			 *
			 *  See also PERF_RECORD_MISC_EXACT_IP
			 */
			if (mod.precise > 3) {
				struct parse_events_error *error = parse_state->error;
				char *help = strdup("Maximum precise value is 3");

				if (help) {
					parse_events_error__handle(error, get_column(scanner) + i,
								   help , NULL);
				}
				return PE_ERROR;
			}
			break;
		CASE('P', precise_max);
		CASE('S', sample_read);
		CASE('D', pinned);
		CASE('W', weak);
		CASE('e', exclusive);
		CASE('b', bpf);
		CASE('R', retire_lat);
		CASE('X', dont_regroup);
		default:
			return PE_ERROR;
		}
#undef CASE
	}
	yylval->mod = mod;
	return PE_MODIFIER_EVENT;
}

#define YY_USER_ACTION					\
do {							\
	yylloc->last_column  = yylloc->first_column;	\
	yylloc->first_column = yycolumn;		\
	yycolumn += yyleng;				\
} while (0);

%}

%x mem
%s config
%x event

group		[^,{}/]*[{][^}]*[}][^,{}/]*
event_pmu	[^,{}/]+[/][^/]*[/][^,{}/]*
event		[^,{}/]+

Annotation

Implementation Notes