summaryrefslogtreecommitdiff
path: root/awk/stats_positions.awk
diff options
context:
space:
mode:
Diffstat (limited to 'awk/stats_positions.awk')
-rw-r--r--awk/stats_positions.awk40
1 files changed, 40 insertions, 0 deletions
diff --git a/awk/stats_positions.awk b/awk/stats_positions.awk
new file mode 100644
index 0000000..d38d2cd
--- /dev/null
+++ b/awk/stats_positions.awk
@@ -0,0 +1,40 @@
+BEGIN {
+ FS="\t";
+ total = 0;
+ suspended = 0;
+ ease = 0;
+ interval = 0;
+ box = 0;
+ due = 0;
+ now = strftime("%FT%T", systime(), 1);
+}
+
+{
+ total += 1;
+
+ type = $3;
+ by_type[type] += 1;
+
+ ease += $6;
+ box += $7;
+ interval += $8;
+
+ if ($4 == "1") {
+ suspended += 1;
+ }
+ if ($4 == "0" && $9 < now) {
+ due += 1;
+ }
+}
+
+END {
+ print "total" "\t" total;
+ print "suspended" "\t" suspended;
+ print "due" "\t" due;
+ for (var in by_type) {
+ print "type-" var "\t" by_type[var];
+ }
+ print "avg-ease" "\t" ease / NR;
+ print "avg-box" "\t" box / NR;
+ print "avg-interval" "\t" interval / NR;
+}