forked from bxparks/AceRoutine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_table.awk
executable file
·68 lines (65 loc) · 2.44 KB
/
generate_table.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/gawk -f
#
# Usage: generate_table.sh < ${board}.txt
#
# Takes the file generated by collect.sh and generates an ASCII
# table that can be inserted into the README.md.
BEGIN {
labels[0] = "Baseline"
labels[1] = "One Delay Function"
labels[2] = "Two Delay Functions"
labels[3] = "One Coroutine"
labels[4] = "Two Coroutines"
labels[5] = "One Coroutine (micros)"
labels[6] = "Two Coroutines (micros)"
labels[7] = "One Coroutine (seconds)"
labels[8] = "Two Coroutines (seconds)"
labels[9] = "Scheduler, One Coroutine"
labels[10] = "Scheduler, Two Coroutines"
labels[11] = "Scheduler, One Coroutine (micros)"
labels[12] = "Scheduler, Two Coroutines (micros)"
labels[13] = "Scheduler, One Coroutine (seconds)"
labels[14] = "Scheduler, Two Coroutines (seconds)"
labels[15] = "Scheduler, One Coroutine (setup)"
labels[16] = "Scheduler, Two Coroutines (setup)"
labels[17] = "Scheduler, One Coroutine (man setup)"
labels[18] = "Scheduler, Two Coroutines (man setup)"
labels[19] = "Blink Function"
labels[20] = "Blink Coroutine"
record_index = 0
}
{
u[record_index]["flash"] = $2
u[record_index]["ram"] = $4
record_index++
}
END {
NUM_ENTRIES = record_index
base_flash = u[0]["flash"]
base_ram = u[0]["ram"]
for (i = 0; i < NR; i++) {
u[i]["d_flash"] = u[i]["flash"] - base_flash
u[i]["d_ram"] = u[i]["ram"] - base_ram
}
printf("+--------------------------------------------------------------------+\n")
printf("| functionality | flash/ ram | delta |\n")
for (i = 0; i < NUM_ENTRIES; i++) {
if (labels[i] ~ /^Baseline$/ \
|| labels[i] ~ /^One Delay Function$/ \
|| labels[i] ~ /^One Coroutine$/ \
|| labels[i] ~ /^One Coroutine \(micros\)$/ \
|| labels[i] ~ /^One Coroutine \(seconds\)$/ \
|| labels[i] ~ /^Scheduler, One Coroutine$/ \
|| labels[i] ~ /^Scheduler, One Coroutine \(micros\)$/ \
|| labels[i] ~ /^Scheduler, One Coroutine \(seconds\)$/ \
|| labels[i] ~ /^Scheduler, One Coroutine \(setup\)$/ \
|| labels[i] ~ /^Scheduler, One Coroutine \(man setup\)$/ \
|| labels[i] ~ /^Blink Function$/ \
) {
printf("|---------------------------------------+--------------+-------------|\n")
}
printf("| %-37s | %6d/%5d | %5d/%5d |\n",
labels[i], u[i]["flash"], u[i]["ram"], u[i]["d_flash"], u[i]["d_ram"])
}
printf("+--------------------------------------------------------------------+\n")
}