From 2700122ca34b4fede4c2a7464f9b9833ad10df42 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sun, 27 Sep 2020 17:39:36 +0200 Subject: [PATCH] added coverage script to quickly get overview of instructions used in given krul scripts --- coverage | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 coverage diff --git a/coverage b/coverage new file mode 100755 index 0000000..b5c5d13 --- /dev/null +++ b/coverage @@ -0,0 +1,61 @@ +#!/usr/bin/awk -f +/^add/ {krul_add++} +/^sub/ {krul_sub++} +/^mul/ {krul_mul++} +/^div/ {krul_div++} +/^mod/ {krul_mod++} +/^abs/ {krul_abs++} +/^neg/ {krul_neg++} +/^inc/ {krul_inc++} +/^dec/ {krul_dec++} +/^dup/ {krul_dup++} +/^rev/ {krul_rev++} +/^slc/ {krul_slc++} +/^idx/ {krul_idx++} +/^cat/ {krul_cat++} +/^len/ {krul_len++} +/^rot/ {krul_rot++} +/^enl/ {krul_enl++} +/^gto/ {krul_gto++} +/^geq/ {krul_geq++} +/^gne/ {krul_gne++} +/^glt/ {krul_glt++} +/^gle/ {krul_gle++} +/^ggt/ {krul_ggt++} +/^gge/ {krul_gge++} +/^fun/ {krul_fun++} +/^ret/ {krul_ret++} +/^inp/ {krul_inp++} +/^out/ {krul_out++} +/^err/ {krul_err++} +END { + printf("add: %3d\n", krul_add); + printf("sub: %3d\n", krul_sub); + printf("mul: %3d\n", krul_mul); + printf("div: %3d\n", krul_div); + printf("mod: %3d\n", krul_mod); + printf("abs: %3d\n", krul_abs); + printf("neg: %3d\n", krul_neg); + printf("inc: %3d\n", krul_inc); + printf("dec: %3d\n", krul_dec); + printf("dup: %3d\n", krul_dup); + printf("rev: %3d\n", krul_rev); + printf("slc: %3d\n", krul_slc); + printf("idx: %3d\n", krul_idx); + printf("cat: %3d\n", krul_cat); + printf("len: %3d\n", krul_len); + printf("rot: %3d\n", krul_rot); + printf("enl: %3d\n", krul_enl); + printf("gto: %3d\n", krul_gto); + printf("geq: %3d\n", krul_geq); + printf("gne: %3d\n", krul_gne); + printf("glt: %3d\n", krul_glt); + printf("gle: %3d\n", krul_gle); + printf("ggt: %3d\n", krul_ggt); + printf("gge: %3d\n", krul_gge); + printf("fun: %3d\n", krul_fun); + printf("ret: %3d\n", krul_ret); + printf("inp: %3d\n", krul_inp); + printf("out: %3d\n", krul_out); + printf("err: %3d\n", krul_err); +}