summaryrefslogtreecommitdiff
path: root/proto/perf/config.Y
diff options
context:
space:
mode:
authorMaria Matějka <mq@jmq.cz>2018-10-26 09:32:35 +0200
committerMaria Matejka <mq@ucw.cz>2018-12-18 15:08:31 +0100
commit82b742533bdbf977ec95997fc0011a47a672bcc8 (patch)
treed806c6229340325494ce757e13f149ff9e27948b /proto/perf/config.Y
parent78131eee64aeaf14cf418d6e5bf3f17ca602afb7 (diff)
Perf: Protocol to measure BIRD performance internally
This protocol is highly experimental and nobody should use it in production. Anyway it may help you getting some insight into what eats so much time in filter processing.
Diffstat (limited to 'proto/perf/config.Y')
-rw-r--r--proto/perf/config.Y58
1 files changed, 58 insertions, 0 deletions
diff --git a/proto/perf/config.Y b/proto/perf/config.Y
new file mode 100644
index 00000000..617b2233
--- /dev/null
+++ b/proto/perf/config.Y
@@ -0,0 +1,58 @@
+/*
+ * BIRD -- Benchmarking Dummy Protocol Configuration
+ *
+ * (c) 2018 Maria Matejka <mq@jmq.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "filter/filter.h"
+#include "proto/perf/perf.h"
+
+CF_DEFINES
+
+#define PERF_CFG ((struct perf_config *) this_proto)
+
+CF_DECLS
+
+CF_KEYWORDS(PERF, EXP, FROM, TO, REPEAT, THRESHOLD, MIN, MAX, KEEP, MODE, IMPORT, EXPORT)
+
+CF_GRAMMAR
+
+proto: perf_proto '}' ;
+
+perf_proto_start: proto_start PERF
+{
+ this_proto = proto_config_new(&proto_perf, $1);
+ PERF_CFG->from = 10;
+ PERF_CFG->to = 20;
+ PERF_CFG->repeat = 4;
+ PERF_CFG->threshold_max = 500 MS_;
+ PERF_CFG->threshold_min = 1 MS_;
+ PERF_CFG->keep = 0;
+ PERF_CFG->mode = PERF_MODE_IMPORT;
+};
+
+perf_proto:
+ perf_proto_start proto_name '{'
+ | perf_proto perf_proto_item ';'
+ ;
+
+perf_proto_item:
+ proto_channel { this_proto->net_type = $1->net_type; }
+ | EXP FROM NUM { PERF_CFG->from = $3; }
+ | EXP TO NUM { PERF_CFG->to = $3; }
+ | REPEAT NUM { PERF_CFG->repeat = $2; }
+ | THRESHOLD MIN expr_us { PERF_CFG->threshold_min = $3; }
+ | THRESHOLD MAX expr_us { PERF_CFG->threshold_max = $3; }
+ | KEEP bool { PERF_CFG->keep = $2; }
+ | MODE IMPORT { PERF_CFG->mode = PERF_MODE_IMPORT; }
+ | MODE EXPORT { PERF_CFG->mode = PERF_MODE_EXPORT; }
+;
+
+
+CF_CODE
+
+CF_END