Hi Jiri,
On 3/16/2021 7:05 AM, Jiri Olsa wrote:
On Thu, Mar 11, 2021 at 03:07:25PM +0800, Jin Yao wrote:
SNIP
+ config_terms, pmu);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
int parse_events_add_cache(struct list_head *list, int *idx,
char *type, char *op_result1, char *op_result2,
struct parse_events_error *err,
@@ -474,7 +516,8 @@ int parse_events_add_cache(struct list_head *list, int *idx,
char name[MAX_NAME_LEN], *config_name;
int cache_type = -1, cache_op = -1, cache_result = -1;
char *op_result[2] = { op_result1, op_result2 };
- int i, n;
+ int i, n, ret;
+ bool hybrid;
/*
* No fallback - if we cannot get a clear cache type
@@ -534,6 +577,15 @@ int parse_events_add_cache(struct list_head *list, int
*idx,
if (get_config_terms(head_config, &config_terms))
return -ENOMEM;
}
+
+ if (!perf_pmu__hybrid_exist())
+ perf_pmu__scan(NULL);
actualy how about construct like:
perf_pmu_is_hybrid()
return hybrid_add_event_cache(...)
return add_event(...)
with:
perf_pmu_is_hybrid()
{
static bool initialized;
if (!initialized) {
initialized = true;
perf_pmu__scan(NULL)
}
return ...
}
jirka
Thanks, that's a good solution. I will do that in v3.
Thanks
Jin Yao
+
+ ret = add_hybrid_cache(list, idx, &attr, config_name ? : name,
+ &config_terms, &hybrid);
+ if (hybrid)
+ return ret;
+
return add_event(list, idx, &attr, config_name ? : name, &config_terms);
}
--
2.17.1