|
69 | 69 | C(INVALID_STR_OPERAND, "String type can not be an operand in expression"), \
|
70 | 70 | C(EXPECT_NUMBER, "Expecting numeric literal"), \
|
71 | 71 | C(UNARY_MINUS_SUBEXPR, "Unary minus not supported in sub-expressions"), \
|
72 |
| - C(DIVISION_BY_ZERO, "Division by zero"), |
| 72 | + C(DIVISION_BY_ZERO, "Division by zero"), \ |
| 73 | + C(NEED_NOHC_VAL, "Non-hitcount value is required for 'nohitcount'"), |
73 | 74 |
|
74 | 75 | #undef C
|
75 | 76 | #define C(a, b) HIST_ERR_##a
|
@@ -526,6 +527,7 @@ struct hist_trigger_attrs {
|
526 | 527 | bool cont;
|
527 | 528 | bool clear;
|
528 | 529 | bool ts_in_usecs;
|
| 530 | + bool no_hitcount; |
529 | 531 | unsigned int map_bits;
|
530 | 532 |
|
531 | 533 | char *assignment_str[TRACING_MAP_VARS_MAX];
|
@@ -1550,7 +1552,10 @@ parse_hist_trigger_attrs(struct trace_array *tr, char *trigger_str)
|
1550 | 1552 | ret = parse_assignment(tr, str, attrs);
|
1551 | 1553 | if (ret)
|
1552 | 1554 | goto free;
|
1553 |
| - } else if (strcmp(str, "pause") == 0) |
| 1555 | + } else if (strcmp(str, "nohitcount") == 0 || |
| 1556 | + strcmp(str, "NOHC") == 0) |
| 1557 | + attrs->no_hitcount = true; |
| 1558 | + else if (strcmp(str, "pause") == 0) |
1554 | 1559 | attrs->pause = true;
|
1555 | 1560 | else if ((strcmp(str, "cont") == 0) ||
|
1556 | 1561 | (strcmp(str, "continue") == 0))
|
@@ -4377,6 +4382,12 @@ static int create_val_fields(struct hist_trigger_data *hist_data,
|
4377 | 4382 | if (fields_str && (strcmp(fields_str, "hitcount") != 0))
|
4378 | 4383 | ret = -EINVAL;
|
4379 | 4384 | out:
|
| 4385 | + /* There is only raw hitcount but nohitcount suppresses it. */ |
| 4386 | + if (j == 1 && hist_data->attrs->no_hitcount) { |
| 4387 | + hist_err(hist_data->event_file->tr, HIST_ERR_NEED_NOHC_VAL, 0); |
| 4388 | + ret = -ENOENT; |
| 4389 | + } |
| 4390 | + |
4380 | 4391 | return ret;
|
4381 | 4392 | }
|
4382 | 4393 |
|
@@ -5388,13 +5399,13 @@ static void hist_trigger_entry_print(struct seq_file *m,
|
5388 | 5399 |
|
5389 | 5400 | hist_trigger_print_key(m, hist_data, key, elt);
|
5390 | 5401 |
|
5391 |
| - /* At first, show the raw hitcount always */ |
5392 |
| - hist_trigger_print_val(m, i, "hitcount", 0, stats, elt); |
| 5402 | + /* At first, show the raw hitcount if !nohitcount */ |
| 5403 | + if (!hist_data->attrs->no_hitcount) |
| 5404 | + hist_trigger_print_val(m, i, "hitcount", 0, stats, elt); |
5393 | 5405 |
|
5394 | 5406 | for (i = 1; i < hist_data->n_vals; i++) {
|
5395 | 5407 | field_name = hist_field_name(hist_data->fields[i], 0);
|
5396 | 5408 | flags = hist_data->fields[i]->flags;
|
5397 |
| - |
5398 | 5409 | if (flags & HIST_FIELD_FL_VAR || flags & HIST_FIELD_FL_EXPR)
|
5399 | 5410 | continue;
|
5400 | 5411 |
|
@@ -5839,6 +5850,7 @@ static int event_hist_trigger_print(struct seq_file *m,
|
5839 | 5850 | struct hist_trigger_data *hist_data = data->private_data;
|
5840 | 5851 | struct hist_field *field;
|
5841 | 5852 | bool have_var = false;
|
| 5853 | + bool show_val = false; |
5842 | 5854 | unsigned int i;
|
5843 | 5855 |
|
5844 | 5856 | seq_puts(m, HIST_PREFIX);
|
@@ -5869,12 +5881,16 @@ static int event_hist_trigger_print(struct seq_file *m,
|
5869 | 5881 | continue;
|
5870 | 5882 | }
|
5871 | 5883 |
|
5872 |
| - if (i == HITCOUNT_IDX) |
| 5884 | + if (i == HITCOUNT_IDX) { |
| 5885 | + if (hist_data->attrs->no_hitcount) |
| 5886 | + continue; |
5873 | 5887 | seq_puts(m, "hitcount");
|
5874 |
| - else { |
5875 |
| - seq_puts(m, ","); |
| 5888 | + } else { |
| 5889 | + if (show_val) |
| 5890 | + seq_puts(m, ","); |
5876 | 5891 | hist_field_print(m, field);
|
5877 | 5892 | }
|
| 5893 | + show_val = true; |
5878 | 5894 | }
|
5879 | 5895 |
|
5880 | 5896 | if (have_var) {
|
@@ -5925,6 +5941,8 @@ static int event_hist_trigger_print(struct seq_file *m,
|
5925 | 5941 | seq_printf(m, ":size=%u", (1 << hist_data->map->map_bits));
|
5926 | 5942 | if (hist_data->enable_timestamps)
|
5927 | 5943 | seq_printf(m, ":clock=%s", hist_data->attrs->clock);
|
| 5944 | + if (hist_data->attrs->no_hitcount) |
| 5945 | + seq_puts(m, ":nohitcount"); |
5928 | 5946 |
|
5929 | 5947 | print_actions_spec(m, hist_data);
|
5930 | 5948 |
|
|
0 commit comments