Lines Matching defs:field

34 	C(BAD_FIELD_MODIFIER,	"Invalid field modifier"),		\
37 C(TOO_MANY_FIELD_VARS, "Too many field variables defined"), \
40 C(HIST_CREATE_FAIL, "Couldn't create histogram for field"), \
43 C(SYNTH_TYPE_MISMATCH, "Param type doesn't match synthetic event field type"), \
44 C(SYNTH_COUNT_MISMATCH, "Param count doesn't match synthetic event field count"), \
45 C(FIELD_VAR_PARSE_FAIL, "Couldn't parse field variable"), \
50 C(FIELD_VAR_CREATE_FAIL,"Couldn't create field variable"), \
63 C(FIELD_NOT_FOUND, "Couldn't find field"), \
66 C(EMPTY_SORT_FIELD, "Empty sort field"), \
68 C(INVALID_SORT_FIELD, "Sort field must be a key or a val"), \
87 typedef u64 (*hist_field_fn_t) (struct hist_field *field,
158 struct ftrace_event_field *field;
179 * The name field is used for EXPR and VAR_REF fields. VAR
189 * using the hist field's hist_var.idx and entered into the
209 static u64 hist_field_const(struct hist_field *field,
215 return field->constant;
218 static u64 hist_field_counter(struct hist_field *field,
233 char *addr = (char *)(event + hist_field->field->offset);
244 u32 str_item = *(u32 *)(event + hist_field->field->offset);
257 u32 *item = event + hist_field->field->offset;
271 char **addr = (char **)(event + hist_field->field->offset);
461 type *addr = (type *)(event + hist_field->field->offset); \
889 * check_field_for_var_ref - Check if a VAR_REF field references a variable
890 * @hist_field: The VAR_REF field to check
894 * Check the given VAR_REF field to see whether or not it references
897 * Return: The VAR_REF field if it does reference the variable, NULL if not
923 * Return: The VAR_REF field referencing the variable if so, NULL if not
953 * Return: The VAR_REF field referencing the variable if so, NULL if not
988 struct hist_field *field;
993 field = hist_data->fields[i];
994 if (field && field->flags & HIST_FIELD_FL_VAR) {
995 if (find_any_var_ref(hist_data, field->var.idx)) {
1322 static const char *hist_field_name(struct hist_field *field,
1327 if (WARN_ON_ONCE(!field))
1333 if (field->field)
1334 field_name = field->field->name;
1335 else if (field->flags & HIST_FIELD_FL_LOG2 ||
1336 field->flags & HIST_FIELD_FL_ALIAS ||
1337 field->flags & HIST_FIELD_FL_BUCKET)
1338 field_name = hist_field_name(field->operands[0], ++level);
1339 else if (field->flags & HIST_FIELD_FL_CPU)
1341 else if (field->flags & HIST_FIELD_FL_EXPR ||
1342 field->flags & HIST_FIELD_FL_VAR_REF) {
1343 if (field->system) {
1346 strcat(full_name, field->system);
1348 strcat(full_name, field->event_name);
1350 strcat(full_name, field->name);
1353 field_name = field->name;
1354 } else if (field->flags & HIST_FIELD_FL_TIMESTAMP)
1356 else if (field->flags & HIST_FIELD_FL_STACKTRACE) {
1357 if (field->field)
1358 field_name = field->field->name;
1361 } else if (field->flags & HIST_FIELD_FL_HITCOUNT)
1725 static void expr_field_str(struct hist_field *field, char *expr)
1727 if (field->flags & HIST_FIELD_FL_VAR_REF)
1729 else if (field->flags & HIST_FIELD_FL_CONST) {
1732 snprintf(str, HIST_CONST_DIGITS_MAX, "%llu", field->constant);
1736 strcat(expr, hist_field_name(field, 0));
1738 if (field->flags && !(field->flags & HIST_FIELD_FL_VAR_REF)) {
1739 const char *flags_str = get_hist_field_flags(field);
1748 static char *expr_str(struct hist_field *field, unsigned int level)
1759 if (!field->operands[0]) {
1760 expr_field_str(field, expr);
1764 if (field->operator == FIELD_OP_UNARY_MINUS) {
1768 subexpr = expr_str(field->operands[0], ++level);
1781 expr_field_str(field->operands[0], expr);
1783 switch (field->operator) {
1801 expr_field_str(field->operands[1], expr);
1940 struct ftrace_event_field *field,
1946 if (field && is_function_field(field))
1982 if (field)
1997 hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL);
2021 if (WARN_ON_ONCE(!field))
2025 if (is_string_field(field) &&
2026 (field->filter_type != FILTER_PTR_STRING)) {
2030 hist_field->type = kstrdup_const(field->type, GFP_KERNEL);
2034 if (field->filter_type == FILTER_STATIC_STRING) {
2036 hist_field->size = field->size;
2037 } else if (field->filter_type == FILTER_DYN_STRING) {
2039 } else if (field->filter_type == FILTER_RDYN_STRING)
2044 hist_field->size = field->size;
2045 hist_field->is_signed = field->is_signed;
2046 hist_field->type = kstrdup_const(field->type, GFP_KERNEL);
2050 hist_field->fn_num = select_value_fn(field->size,
2051 field->is_signed);
2058 hist_field->field = field;
2169 * @var_field: The VAR field to create a reference to
2179 * Return: The VAR_REF field if successful, NULL if not
2226 char *name, *field;
2233 field = hist_data->attrs->var_defs.expr[i];
2234 if (contains_operator(field, NULL) || is_var_ref(field))
2236 return field;
2297 struct ftrace_event_field *field = NULL;
2353 field = ERR_PTR(-EINVAL);
2370 field = trace_find_event_field(file->event_call, field_name);
2371 if (!field || !field->size) {
2379 if (field && field->filter_type == FILTER_CPU) {
2381 } else if (field && field->filter_type == FILTER_STACKTRACE) {
2386 field = ERR_PTR(-EINVAL);
2394 return field;
2426 struct hist_field *field = NULL;
2435 field = create_hist_field(hist_data, NULL, *flags, var_name);
2436 if (!field)
2439 field->constant = constant;
2441 return field;
2449 struct ftrace_event_field *field = NULL;
2498 field = parse_field(hist_data, file, str, flags, &buckets);
2499 if (IS_ERR(field)) {
2500 ret = PTR_ERR(field);
2504 hist_field = create_hist_field(hist_data, field, *flags, var_name);
2946 * create_field_var_hist - Automatically create a histogram and var for a field
2950 * @field_name: The name of the field (and the resulting variable)
2954 * specify an event field in an action, which will be automatically
2957 * If a user specifies a field on an event that isn't the event the
2960 * created and the field variable defined on that.
2964 * histogram), and creates a variable for the specified field, but
2966 * collision with normal field variables.
2968 * Return: The variable created for the field.
3010 /* See if a synthetic field variable has already been created */
3033 strcat(cmd, key_field->field->name);
3037 /* Create the synthetic field variable specification */
3277 * create_target_field_var - Automatically create a variable for a field
3281 * @var_name: The name of the field (and the resulting variable)
3285 * specify an event field in an action, which will be automatically
3288 * This function creates a field variable with the name var_name on
3294 * Return: The variable created for the field.
3868 struct synth_field *field;
3873 field = event->fields[field_pos];
3876 * A dynamic string synth field can accept static or
3877 * dynamic. A static string synth field can only accept a
3880 if (strstr(hist_field->type, "char[") && field->is_string
3881 && field->is_dynamic)
3884 if (strstr(hist_field->type, "long[") && field->is_stack)
3887 if (strcmp(field->type, hist_field->type) != 0) {
3888 if (field->size != hist_field->size ||
3889 (!field->is_string && field->is_signed != hist_field->is_signed))
3931 * First try to create a field var on the target event (the
3956 * At this point, we're looking at a field on another
3958 * another event to add a variable for a field, we need
4305 u32 str_item = *(u32 *)(event + hist_field->field->offset);
5047 struct ftrace_event_field *field;
5056 field = hist_field->field;
5060 else if (!field || hist_field->flags & HIST_FIELD_FL_CPU)
5063 else if (is_string_field(field))
5066 cmp_fn = tracing_map_cmp_num(field->size,
5067 field->is_signed);
5218 struct ftrace_event_field *field;
5220 field = key_field->field;
5221 if (field->filter_type == FILTER_DYN_STRING ||
5222 field->filter_type == FILTER_RDYN_STRING)
5223 size = *(u32 *)(rec + field->offset) >> 16;
5224 else if (field->filter_type == FILTER_STATIC_STRING)
5225 size = field->size;
5277 if (key_field->field) {
5390 if (key_field->field)
5391 seq_printf(m, "%s.stacktrace", key_field->field->name);
5538 /* Calculate the max and the total for each field if needed. */
5665 struct hist_field *field, unsigned long flags)
5667 if ((field->flags & flags) != flags) {
5672 hist_field_debug_show_flags(m, field->flags);
5673 if (field->field)
5675 field->field->name);
5677 if (field->flags & HIST_FIELD_FL_VAR) {
5678 seq_printf(m, " var.name: %s\n", field->var.name);
5680 field->var.idx);
5683 if (field->flags & HIST_FIELD_FL_CONST)
5684 seq_printf(m, " constant: %llu\n", field->constant);
5686 if (field->flags & HIST_FIELD_FL_ALIAS)
5688 field->var_ref_idx);
5690 if (field->flags & HIST_FIELD_FL_VAR_REF) {
5691 seq_printf(m, " name: %s\n", field->name);
5693 field->var.idx);
5694 seq_printf(m, " var.hist_data: %p\n", field->var.hist_data);
5696 field->var_ref_idx);
5697 if (field->system)
5698 seq_printf(m, " system: %s\n", field->system);
5699 if (field->event_name)
5700 seq_printf(m, " event_name: %s\n", field->event_name);
5703 seq_printf(m, " type: %s\n", field->type);
5704 seq_printf(m, " size: %u\n", field->size);
5705 seq_printf(m, " is_signed: %u\n", field->is_signed);
5715 struct hist_field *field;
5720 field = field_var->var;
5724 hist_field_debug_show_flags(m, field->flags);
5725 seq_printf(m, " var.name: %s\n", field->var.name);
5727 field->var.idx);
5729 field = field_var->val;
5732 if (field->field)
5734 field->field->name);
5740 seq_printf(m, " type: %s\n", field->type);
5741 seq_printf(m, " size: %u\n", field->size);
5742 seq_printf(m, " is_signed: %u\n", field->is_signed);
5862 seq_puts(m, "\n field variables:\n");
5958 struct hist_field *field;
5971 field = hist_data->fields[i];
5976 if (field->flags & HIST_FIELD_FL_STACKTRACE) {
5977 if (field->field)
5978 seq_printf(m, "%s.stacktrace", field->field->name);
5982 hist_field_print(m, field);
5988 field = hist_data->fields[i];
5989 if (field->flags & HIST_FIELD_FL_VAR) {
6001 hist_field_print(m, field);
6012 field = hist_data->fields[i];
6014 if (field->flags & HIST_FIELD_FL_VAR) {
6017 hist_field_print(m, field);
6182 static bool compatible_field(struct ftrace_event_field *field,
6185 if (field == test_field)
6187 if (field == NULL || test_field == NULL)
6189 if (strcmp(field->name, test_field->name) != 0)
6191 if (strcmp(field->type, test_field->type) != 0)
6193 if (field->size != test_field->size)
6195 if (field->is_signed != test_field->is_signed)
6238 if (!compatible_field(key_field->field, key_field_test->field))