@@ -38,6 +38,7 @@ enum traceeval_flags {
TRACEEVAL_FL_VALUE = (1 << 1),
TRACEEVAL_FL_SIGNED = (1 << 2),
TRACEEVAL_FL_TIMESTAMP = (1 << 3),
+ TRACEEVAL_FL_STAT = (1 << 4),
};
/*
@@ -147,6 +147,7 @@ static struct traceeval_type delta_vals[] = {
{
.type = TRACEEVAL_TYPE_NUMBER_64,
.name = "delta",
+ .flags = TRACEEVAL_FL_STAT,
},
{
.type = TRACEEVAL_TYPE_NONE,
@@ -505,6 +505,25 @@ static int get_entry(struct traceeval *teval, const struct traceeval_data *keys,
return check;
}
+static bool is_stat_type(struct traceeval_type *type)
+{
+ /* Only value numbers have stats */
+ if (!(type->flags & TRACEEVAL_FL_VALUE) ||
+ !(type->flags & TRACEEVAL_FL_STAT))
+ return false;
+
+ switch (type->type) {
+ case TRACEEVAL_TYPE_NUMBER:
+ case TRACEEVAL_TYPE_NUMBER_64:
+ case TRACEEVAL_TYPE_NUMBER_32:
+ case TRACEEVAL_TYPE_NUMBER_16:
+ case TRACEEVAL_TYPE_NUMBER_8:
+ return true;
+ default:
+ return false;
+ }
+}
+
/*
* Copy @src to @dst with respect to @type.
*
@@ -571,7 +590,7 @@ static int copy_traceeval_data(struct traceeval_type *type,
return 0;
}
- if (!stat)
+ if (!stat || !is_stat_type(type))
return 0;
if (!stat->count++) {
@@ -826,24 +845,6 @@ static int update_entry(struct traceeval *teval, struct entry *entry,
return -1;
}
-static bool is_stat_type(struct traceeval_type *type)
-{
- /* Only value numbers have stats */
- if (!(type->flags & TRACEEVAL_FL_VALUE))
- return false;
-
- switch (type->type) {
- case TRACEEVAL_TYPE_NUMBER:
- case TRACEEVAL_TYPE_NUMBER_64:
- case TRACEEVAL_TYPE_NUMBER_32:
- case TRACEEVAL_TYPE_NUMBER_16:
- case TRACEEVAL_TYPE_NUMBER_8:
- return true;
- default:
- return false;
- }
-}
-
struct traceeval_stat *traceeval_stat_size(struct traceeval *teval,
const struct traceeval_data *keys,
size_t nr_keys,