Lines Matching refs:hist_field

24 struct hist_field;
26 typedef u64 (*hist_field_fn_t) (struct hist_field *field,
48 struct hist_field { struct
56 struct hist_field *operands[HIST_FIELD_OPERANDS_MAX]; argument
68 static u64 hist_field_none(struct hist_field *field, in hist_field_none() argument
76 static u64 hist_field_counter(struct hist_field *field, in hist_field_counter()
84 static u64 hist_field_string(struct hist_field *hist_field, in hist_field_string() argument
89 char *addr = (char *)(event + hist_field->field->offset); in hist_field_string()
94 static u64 hist_field_dynstring(struct hist_field *hist_field, in hist_field_dynstring() argument
99 u32 str_item = *(u32 *)(event + hist_field->field->offset); in hist_field_dynstring()
106 static u64 hist_field_pstring(struct hist_field *hist_field, in hist_field_pstring() argument
111 char **addr = (char **)(event + hist_field->field->offset); in hist_field_pstring()
116 static u64 hist_field_log2(struct hist_field *hist_field, in hist_field_log2() argument
121 struct hist_field *operand = hist_field->operands[0]; in hist_field_log2()
128 static u64 hist_field_plus(struct hist_field *hist_field, in hist_field_plus() argument
133 struct hist_field *operand1 = hist_field->operands[0]; in hist_field_plus()
134 struct hist_field *operand2 = hist_field->operands[1]; in hist_field_plus()
142 static u64 hist_field_minus(struct hist_field *hist_field, in hist_field_minus() argument
147 struct hist_field *operand1 = hist_field->operands[0]; in hist_field_minus()
148 struct hist_field *operand2 = hist_field->operands[1]; in hist_field_minus()
156 static u64 hist_field_unary_minus(struct hist_field *hist_field, in hist_field_unary_minus() argument
161 struct hist_field *operand = hist_field->operands[0]; in hist_field_unary_minus()
170 static u64 hist_field_##type(struct hist_field *hist_field, \
175 type *addr = (type *)(event + hist_field->field->offset); \
253 struct hist_field *var;
254 struct hist_field *val;
263 struct hist_field *fields[HIST_FIELDS_MAX];
276 struct hist_field *var_refs[TRACING_MAP_VARS_MAX];
282 struct hist_field *synth_var_refs[SYNTH_FIELDS_MAX];
340 struct hist_field *max_var;
341 struct hist_field *var;
1232 static u64 hist_field_timestamp(struct hist_field *hist_field, in hist_field_timestamp() argument
1237 struct hist_trigger_data *hist_data = hist_field->hist_data; in hist_field_timestamp()
1248 static u64 hist_field_cpu(struct hist_field *hist_field, in hist_field_cpu() argument
1258 static struct hist_field *
1259 check_field_for_var_ref(struct hist_field *hist_field, in check_field_for_var_ref() argument
1263 struct hist_field *found = NULL; in check_field_for_var_ref()
1265 if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR_REF) { in check_field_for_var_ref()
1266 if (hist_field->var.idx == var_idx && in check_field_for_var_ref()
1267 hist_field->var.hist_data == var_data) { in check_field_for_var_ref()
1268 found = hist_field; in check_field_for_var_ref()
1275 static struct hist_field *
1277 struct hist_field *hist_field, in check_field_for_var_refs() argument
1282 struct hist_field *found = NULL; in check_field_for_var_refs()
1288 if (!hist_field) in check_field_for_var_refs()
1291 found = check_field_for_var_ref(hist_field, var_data, var_idx); in check_field_for_var_refs()
1296 struct hist_field *operand; in check_field_for_var_refs()
1298 operand = hist_field->operands[i]; in check_field_for_var_refs()
1308 static struct hist_field *find_var_ref(struct hist_trigger_data *hist_data, in find_var_ref()
1312 struct hist_field *hist_field, *found = NULL; in find_var_ref() local
1316 hist_field = hist_data->fields[i]; in find_var_ref()
1317 found = check_field_for_var_refs(hist_data, hist_field, in find_var_ref()
1324 hist_field = hist_data->synth_var_refs[i]; in find_var_ref()
1325 found = check_field_for_var_refs(hist_data, hist_field, in find_var_ref()
1334 static struct hist_field *find_any_var_ref(struct hist_trigger_data *hist_data, in find_any_var_ref()
1338 struct hist_field *found = NULL; in find_any_var_ref()
1354 struct hist_field *field; in check_var_refs()
1386 static bool field_has_hist_vars(struct hist_field *hist_field, in field_has_hist_vars() argument
1394 if (!hist_field) in field_has_hist_vars()
1397 if (hist_field->flags & HIST_FIELD_FL_VAR || in field_has_hist_vars()
1398 hist_field->flags & HIST_FIELD_FL_VAR_REF) in field_has_hist_vars()
1402 struct hist_field *operand; in field_has_hist_vars()
1404 operand = hist_field->operands[i]; in field_has_hist_vars()
1414 struct hist_field *hist_field; in has_hist_vars() local
1418 hist_field = hist_data->fields[i]; in has_hist_vars()
1419 if (field_has_hist_vars(hist_field, 0)) in has_hist_vars()
1469 static struct hist_field *find_var_field(struct hist_trigger_data *hist_data, in find_var_field()
1472 struct hist_field *hist_field, *found = NULL; in find_var_field() local
1476 hist_field = hist_data->fields[i]; in find_var_field()
1477 if (hist_field && hist_field->flags & HIST_FIELD_FL_VAR && in find_var_field()
1478 strcmp(hist_field->var.name, var_name) == 0) { in find_var_field()
1479 found = hist_field; in find_var_field()
1487 static struct hist_field *find_var(struct hist_trigger_data *hist_data, in find_var()
1493 struct hist_field *hist_field; in find_var() local
1495 hist_field = find_var_field(hist_data, var_name); in find_var()
1496 if (hist_field) in find_var()
1497 return hist_field; in find_var()
1502 hist_field = find_var_field(test_data, var_name); in find_var()
1503 if (hist_field) in find_var()
1504 return hist_field; in find_var()
1542 static struct hist_field *find_file_var(struct trace_event_file *file, in find_file_var()
1547 struct hist_field *hist_field; in find_file_var() local
1552 hist_field = find_var_field(test_data, var_name); in find_file_var()
1553 if (hist_field) in find_file_var()
1554 return hist_field; in find_file_var()
1561 static struct hist_field *
1565 struct hist_field *hist_field, *found = NULL; in find_match_var() local
1579 hist_field = find_file_var(file, var_name); in find_match_var()
1580 if (hist_field) { in find_match_var()
1586 found = hist_field; in find_match_var()
1593 static struct hist_field *find_event_var(struct hist_trigger_data *hist_data, in find_event_var()
1599 struct hist_field *hist_field = NULL; in find_event_var() local
1603 hist_field = find_match_var(hist_data, var_name); in find_event_var()
1604 if (IS_ERR(hist_field)) in find_event_var()
1606 if (hist_field) in find_event_var()
1607 return hist_field; in find_event_var()
1614 hist_field = find_file_var(file, var_name); in find_event_var()
1616 return hist_field; in find_event_var()
1625 static u64 hist_field_var_ref(struct hist_field *hist_field, in hist_field_var_ref() argument
1634 var_val = elt_data->var_ref_vals[hist_field->var_ref_idx]; in hist_field_var_ref()
1644 struct hist_field *hist_field; in resolve_var_refs() local
1650 hist_field = hist_data->var_refs[i]; in resolve_var_refs()
1651 var_idx = hist_field->var.idx; in resolve_var_refs()
1652 var_data = hist_field->var.hist_data; in resolve_var_refs()
1674 if (self || !hist_field->read_once) in resolve_var_refs()
1685 static const char *hist_field_name(struct hist_field *field, in hist_field_name()
1984 struct hist_field *key_field; in hist_trigger_elt_data_alloc()
2035 static const char *get_hist_field_flags(struct hist_field *hist_field) in get_hist_field_flags() argument
2039 if (hist_field->flags & HIST_FIELD_FL_HEX) in get_hist_field_flags()
2041 else if (hist_field->flags & HIST_FIELD_FL_SYM) in get_hist_field_flags()
2043 else if (hist_field->flags & HIST_FIELD_FL_SYM_OFFSET) in get_hist_field_flags()
2045 else if (hist_field->flags & HIST_FIELD_FL_EXECNAME) in get_hist_field_flags()
2047 else if (hist_field->flags & HIST_FIELD_FL_SYSCALL) in get_hist_field_flags()
2049 else if (hist_field->flags & HIST_FIELD_FL_LOG2) in get_hist_field_flags()
2051 else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP_USECS) in get_hist_field_flags()
2057 static void expr_field_str(struct hist_field *field, char *expr) in expr_field_str()
2074 static char *expr_str(struct hist_field *field, unsigned int level) in expr_str()
2152 static void destroy_hist_field(struct hist_field *hist_field, in destroy_hist_field() argument
2160 if (!hist_field) in destroy_hist_field()
2164 destroy_hist_field(hist_field->operands[i], level + 1); in destroy_hist_field()
2166 kfree(hist_field->var.name); in destroy_hist_field()
2167 kfree(hist_field->name); in destroy_hist_field()
2168 kfree(hist_field->type); in destroy_hist_field()
2170 kfree(hist_field); in destroy_hist_field()
2173 static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, in create_hist_field()
2178 struct hist_field *hist_field; in create_hist_field() local
2183 hist_field = kzalloc(sizeof(struct hist_field), GFP_KERNEL); in create_hist_field()
2184 if (!hist_field) in create_hist_field()
2187 hist_field->hist_data = hist_data; in create_hist_field()
2193 hist_field->fn = hist_field_var_ref; in create_hist_field()
2198 hist_field->fn = hist_field_counter; in create_hist_field()
2199 hist_field->size = sizeof(u64); in create_hist_field()
2200 hist_field->type = kstrdup("u64", GFP_KERNEL); in create_hist_field()
2201 if (!hist_field->type) in create_hist_field()
2207 hist_field->fn = hist_field_none; in create_hist_field()
2213 hist_field->fn = hist_field_log2; in create_hist_field()
2214 hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL); in create_hist_field()
2215 hist_field->size = hist_field->operands[0]->size; in create_hist_field()
2216 hist_field->type = kstrdup(hist_field->operands[0]->type, GFP_KERNEL); in create_hist_field()
2217 if (!hist_field->type) in create_hist_field()
2223 hist_field->fn = hist_field_timestamp; in create_hist_field()
2224 hist_field->size = sizeof(u64); in create_hist_field()
2225 hist_field->type = kstrdup("u64", GFP_KERNEL); in create_hist_field()
2226 if (!hist_field->type) in create_hist_field()
2232 hist_field->fn = hist_field_cpu; in create_hist_field()
2233 hist_field->size = sizeof(int); in create_hist_field()
2234 hist_field->type = kstrdup("unsigned int", GFP_KERNEL); in create_hist_field()
2235 if (!hist_field->type) in create_hist_field()
2246 hist_field->size = MAX_FILTER_STR_VAL; in create_hist_field()
2247 hist_field->type = kstrdup(field->type, GFP_KERNEL); in create_hist_field()
2248 if (!hist_field->type) in create_hist_field()
2252 hist_field->fn = hist_field_string; in create_hist_field()
2254 hist_field->fn = hist_field_dynstring; in create_hist_field()
2256 hist_field->fn = hist_field_pstring; in create_hist_field()
2258 hist_field->size = field->size; in create_hist_field()
2259 hist_field->is_signed = field->is_signed; in create_hist_field()
2260 hist_field->type = kstrdup(field->type, GFP_KERNEL); in create_hist_field()
2261 if (!hist_field->type) in create_hist_field()
2264 hist_field->fn = select_value_fn(field->size, in create_hist_field()
2266 if (!hist_field->fn) { in create_hist_field()
2267 destroy_hist_field(hist_field, 0); in create_hist_field()
2272 hist_field->field = field; in create_hist_field()
2273 hist_field->flags = flags; in create_hist_field()
2276 hist_field->var.name = kstrdup(var_name, GFP_KERNEL); in create_hist_field()
2277 if (!hist_field->var.name) in create_hist_field()
2281 return hist_field; in create_hist_field()
2283 destroy_hist_field(hist_field, 0); in create_hist_field()
2299 static int init_var_ref(struct hist_field *ref_field, in init_var_ref()
2300 struct hist_field *var_field, in init_var_ref()
2355 static struct hist_field *create_var_ref(struct hist_field *var_field, in create_var_ref()
2359 struct hist_field *ref_field; in create_var_ref()
2427 static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data, in parse_var_ref()
2431 struct hist_field *var_field = NULL, *ref_field = NULL; in parse_var_ref()
2505 static struct hist_field *create_alias(struct hist_trigger_data *hist_data, in create_alias()
2506 struct hist_field *var_ref, in create_alias()
2509 struct hist_field *alias = NULL; in create_alias()
2527 static struct hist_field *parse_atom(struct hist_trigger_data *hist_data, in parse_atom()
2533 struct hist_field *hist_field = NULL; in parse_atom() local
2556 hist_field = parse_var_ref(hist_data, ref_system, ref_event, ref_var); in parse_atom()
2557 if (hist_field) { in parse_atom()
2558 hist_data->var_refs[hist_data->n_var_refs] = hist_field; in parse_atom()
2559 hist_field->var_ref_idx = hist_data->n_var_refs++; in parse_atom()
2561 hist_field = create_alias(hist_data, hist_field, var_name); in parse_atom()
2562 if (!hist_field) { in parse_atom()
2567 return hist_field; in parse_atom()
2578 hist_field = create_hist_field(hist_data, field, *flags, var_name); in parse_atom()
2579 if (!hist_field) { in parse_atom()
2584 return hist_field; in parse_atom()
2589 static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
2594 static struct hist_field *parse_unary(struct hist_trigger_data *hist_data, in parse_unary()
2599 struct hist_field *operand1, *expr = NULL; in parse_unary()
2662 static int check_expr_operands(struct hist_field *operand1, in check_expr_operands()
2663 struct hist_field *operand2) in check_expr_operands()
2670 struct hist_field *var; in check_expr_operands()
2680 struct hist_field *var; in check_expr_operands()
2697 static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, in parse_expr()
2702 struct hist_field *operand1 = NULL, *operand2 = NULL, *expr = NULL; in parse_expr()
2826 struct hist_field *target_hist_field, *hist_field; in compatible_keys() local
2836 hist_field = hist_data->fields[i + n]; in compatible_keys()
2839 if (strcmp(hist_field->type, target_hist_field->type) != 0) in compatible_keys()
2841 if (hist_field->size != target_hist_field->size) in compatible_keys()
2843 if (hist_field->is_signed != target_hist_field->is_signed) in compatible_keys()
2884 static struct hist_field *
2888 struct hist_field *event_var; in find_synthetic_field_var()
2930 static struct hist_field *
2935 struct hist_field *event_var = ERR_PTR(-EINVAL); in create_field_var_hist()
2940 struct hist_field *key_field; in create_field_var_hist()
3055 static struct hist_field *
3060 struct hist_field *hist_field = NULL; in find_target_event_var() local
3077 hist_field = find_var_field(hist_data, var_name); in find_target_event_var()
3079 return hist_field; in find_target_event_var()
3095 struct hist_field *var = field_var->var; in __update_field_vars()
3096 struct hist_field *val = field_var->val; in __update_field_vars()
3130 static struct hist_field *create_var(struct hist_trigger_data *hist_data, in create_var()
3134 struct hist_field *var; in create_var()
3142 var = kzalloc(sizeof(struct hist_field), GFP_KERNEL); in create_var()
3175 struct hist_field *val = NULL, *var = NULL; in create_field_var()
3272 struct hist_field *save_val = hist_data->max_vars[i]->val; in onmax_print()
3273 struct hist_field *save_var = hist_data->max_vars[i]->var; in onmax_print()
3329 struct hist_field *var_field, *ref_field, *max_var; in onmax_create()
3549 struct hist_field *var_ref) in save_synth_var_ref()
3558 struct hist_field *hist_field, in check_synth_field() argument
3568 if (strcmp(field->type, hist_field->type) != 0) in check_synth_field()
3574 static struct hist_field *
3578 struct hist_field *hist_field; in onmatch_find_var() local
3582 hist_field = find_target_event_var(hist_data, system, event, var); in onmatch_find_var()
3583 if (!hist_field) { in onmatch_find_var()
3589 hist_field = find_event_var(hist_data, system, event, var); in onmatch_find_var()
3592 if (!hist_field) in onmatch_find_var()
3595 return hist_field; in onmatch_find_var()
3598 static struct hist_field *
3603 struct hist_field *hist_field = NULL; in onmatch_create_field_var() local
3616 hist_field = field_var->var; in onmatch_create_field_var()
3636 hist_field = create_field_var_hist(hist_data, system, event, var); in onmatch_create_field_var()
3637 if (IS_ERR(hist_field)) in onmatch_create_field_var()
3641 return hist_field; in onmatch_create_field_var()
3644 hist_field = NULL; in onmatch_create_field_var()
3653 struct hist_field *hist_field, *var_ref; in onmatch_create() local
3694 hist_field = onmatch_find_var(hist_data, data, system, in onmatch_create()
3697 hist_field = onmatch_create_field_var(hist_data, data, in onmatch_create()
3702 if (!hist_field) { in onmatch_create()
3708 if (check_synth_field(event, hist_field, field_pos) == 0) { in onmatch_create()
3709 var_ref = create_var_ref(hist_field, system, event_name); in onmatch_create()
3846 struct hist_field *hist_field; in __create_val_field() local
3849 hist_field = parse_expr(hist_data, file, field_str, flags, var_name, 0); in __create_val_field()
3850 if (IS_ERR(hist_field)) { in __create_val_field()
3851 ret = PTR_ERR(hist_field); in __create_val_field()
3855 hist_data->fields[val_idx] = hist_field; in __create_val_field()
3945 struct hist_field *hist_field = NULL; in create_key_field() local
3959 hist_field = create_hist_field(hist_data, NULL, flags, NULL); in create_key_field()
3961 hist_field = parse_expr(hist_data, file, field_str, flags, in create_key_field()
3963 if (IS_ERR(hist_field)) { in create_key_field()
3964 ret = PTR_ERR(hist_field); in create_key_field()
3968 if (hist_field->flags & HIST_FIELD_FL_VAR_REF) { in create_key_field()
3970 destroy_hist_field(hist_field, 0); in create_key_field()
3975 key_size = hist_field->size; in create_key_field()
3978 hist_data->fields[key_idx] = hist_field; in create_key_field()
4179 struct hist_field *hist_field; in create_sort_keys() local
4216 hist_field = hist_data->fields[j]; in create_sort_keys()
4217 if (hist_field->flags & HIST_FIELD_FL_VAR) in create_sort_keys()
4222 test_name = hist_field_name(hist_field, 0); in create_sort_keys()
4471 struct hist_field *hist_field; in create_tracing_map_fields() local
4475 hist_field = hist_data->fields[i]; in create_tracing_map_fields()
4476 if (hist_field->flags & HIST_FIELD_FL_KEY) { in create_tracing_map_fields()
4479 field = hist_field->field; in create_tracing_map_fields()
4481 if (hist_field->flags & HIST_FIELD_FL_STACKTRACE) in create_tracing_map_fields()
4484 cmp_fn = tracing_map_cmp_num(hist_field->size, in create_tracing_map_fields()
4485 hist_field->is_signed); in create_tracing_map_fields()
4492 hist_field->offset, in create_tracing_map_fields()
4494 } else if (!(hist_field->flags & HIST_FIELD_FL_VAR)) in create_tracing_map_fields()
4500 if (hist_field->flags & HIST_FIELD_FL_VAR) { in create_tracing_map_fields()
4504 hist_field->var.idx = idx; in create_tracing_map_fields()
4505 hist_field->var.hist_data = hist_data; in create_tracing_map_fields()
4573 struct hist_field *hist_field; in hist_trigger_elt_update() local
4581 hist_field = hist_data->fields[i]; in hist_trigger_elt_update()
4582 hist_val = hist_field->fn(hist_field, elt, rbe, rec); in hist_trigger_elt_update()
4583 if (hist_field->flags & HIST_FIELD_FL_VAR) { in hist_trigger_elt_update()
4584 var_idx = hist_field->var.idx; in hist_trigger_elt_update()
4592 hist_field = hist_data->fields[i]; in hist_trigger_elt_update()
4593 if (hist_field->flags & HIST_FIELD_FL_VAR) { in hist_trigger_elt_update()
4594 hist_val = hist_field->fn(hist_field, elt, rbe, rec); in hist_trigger_elt_update()
4595 var_idx = hist_field->var.idx; in hist_trigger_elt_update()
4604 struct hist_field *key_field, void *rec) in add_to_key()
4651 struct hist_field *key_field; in event_hist_trigger()
4724 struct hist_field *key_field; in hist_trigger_entry_print()
4911 static void hist_field_print(struct seq_file *m, struct hist_field *hist_field) in hist_field_print() argument
4913 const char *field_name = hist_field_name(hist_field, 0); in hist_field_print()
4915 if (hist_field->var.name) in hist_field_print()
4916 seq_printf(m, "%s=", hist_field->var.name); in hist_field_print()
4918 if (hist_field->flags & HIST_FIELD_FL_CPU) in hist_field_print()
4921 if (hist_field->flags & HIST_FIELD_FL_VAR_REF || in hist_field_print()
4922 hist_field->flags & HIST_FIELD_FL_ALIAS) in hist_field_print()
4925 } else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP) in hist_field_print()
4928 if (hist_field->flags) { in hist_field_print()
4929 if (!(hist_field->flags & HIST_FIELD_FL_VAR_REF) && in hist_field_print()
4930 !(hist_field->flags & HIST_FIELD_FL_EXPR)) { in hist_field_print()
4931 const char *flags = get_hist_field_flags(hist_field); in hist_field_print()
4944 struct hist_field *field; in event_hist_trigger_print()
5187 struct hist_field *key_field, *key_field_test; in hist_trigger_match()