#include <linux/list.h>
#include "jsmn.h"
#include "json.h"
+#include "pmu-events.h"
int verbose;
char *prog;
char *pmu;
char *unit;
char *perpkg;
+ char *aggr_mode;
char *metric_expr;
char *metric_name;
char *metric_group;
char *metric_constraint;
};
+enum aggr_mode_class convert(const char *aggr_mode)
+{
+ if (!strcmp(aggr_mode, "PerCore"))
+ return PerCore;
+ else if (!strcmp(aggr_mode, "PerChip"))
+ return PerChip;
+
+ pr_err("%s: Wrong AggregationMode value '%s'\n", prog, aggr_mode);
+ return -1;
+}
+
typedef int (*func)(void *data, struct json_event *je);
int eprintf(int level, int var, const char *fmt, ...)
fprintf(outfp, "\t.unit = \"%s\",\n", je->unit);
if (je->perpkg)
fprintf(outfp, "\t.perpkg = \"%s\",\n", je->perpkg);
+ if (je->aggr_mode)
+ fprintf(outfp, "\t.aggr_mode = \"%d\",\n", convert(je->aggr_mode));
if (je->metric_expr)
fprintf(outfp, "\t.metric_expr = \"%s\",\n", je->metric_expr);
if (je->metric_name)
char *pmu;
char *unit;
char *perpkg;
+ char *aggr_mode;
char *metric_expr;
char *metric_name;
char *metric_group;
op(pmu); \
op(unit); \
op(perpkg); \
+ op(aggr_mode); \
op(metric_expr); \
op(metric_name); \
op(metric_group); \
addfield(map, &je.unit, "", "", val);
} else if (json_streq(map, field, "PerPkg")) {
addfield(map, &je.perpkg, "", "", val);
+ } else if (json_streq(map, field, "AggregationMode")) {
+ addfield(map, &je.aggr_mode, "", "", val);
} else if (json_streq(map, field, "Deprecated")) {
addfield(map, &je.deprecated, "", "", val);
} else if (json_streq(map, field, "MetricName")) {
free(je.pmu);
free(filter);
free(je.perpkg);
+ free(je.aggr_mode);
free(je.deprecated);
free(je.unit);
free(je.metric_expr);