123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #!/bin/sh
- # simple script to check the progress
- gawk -- '
- BEGIN {
- index_count = 0
- index_delta = 0
- index_time = 0
- delete parse_count
- delete parse_delta
- delete parse_time
- delete parse_max
- delete render_count
- delete render_delta
- delete render_max
- quotes = "['"'"'\"]"
- }
- END {
- if (0 != index_delta) {
- printf("Index: %15d %8.2fs per %5d\n", index_count, (index_time / (index_count / index_delta)), index_delta)
- } else {
- print "Index: Not Started"
- }
- if (0 != length(parse_delta)) {
- for (i in parse_delta) {
- if (0 == parse_max[i]) {
- complete = 0
- for (j in parse_max) {
- if (0 != parse_max[j]) {
- complete = 100 * parse_count[i] / parse_max[j]
- break
- }
- }
- } else {
- complete = 100 * parse_count[i] / parse_max[i]
- }
- average = parse_time[i] / (parse_count[i] / parse_delta[i])
- printf("Parse[%2d]: %11d %6.1f%% %8.2fs per %5d\n", i, parse_count[i], complete, average, parse_delta[i])
- }
- } else {
- print "Parse: Not Started"
- }
- if (0 != length(render_delta)) {
- for (i in render_delta) {
- n = render_max[i]
- if (0 == n) {
- n = parse_count[i]
- }
- if (0 != n) {
- complete = 100 * render_count[i] / n
- } else {
- complete = 0
- }
- average = render_time[i] / (render_count[i] / render_delta[i])
- printf("Render[%2d]: %10d %6.1f%% %8.2fs per %5d\n", i, render_count[i], complete, average, render_delta[i])
- }
- } else {
- print "Render: Not Started"
- }
- }
- /^Index:/ {
- index_time += $2
- n = $3
- index_delta = n - index_count
- index_count = n
- }
- /^make[[:space:]]+RENDER_BLOCK=.*parse/ {
- n = gensub("^[^=]*=" quotes "*([[:digit:]]+)" quotes "*.*$", "\\1", "", $2) + 0
- c = gensub("^[^=]*=" quotes "*([[:digit:]]+)" quotes "*.*$", "\\1", "", $4) + 0
- sub("k", "000", c)
- if ("all" == c) {
- c = 0
- }
- parse_max[n] = c
- render_max[n] = c
- }
- /^Parse\[/ {
- p1 = index($0, "-")
- p2 = index($0, ".")
- if (p1 > 0 && p2 > 0) {
- i = substr($0, p1 + 1, p2 - p1 - 1)
- if ("Total:" == $2) {
- parse_count[i] = $3
- parse_max[i] = $3
- } else {
- parse_time[i] += $2
- n = $3
- parse_delta[i] = n - parse_count[i]
- parse_count[i] = n
- }
- }
- }
- /^Render\[/ {
- p1 = index($0, "[")
- p2 = index($0, "]")
- if (p1 > 0 && p2 > 0) {
- i = substr($0, p1 + 1, p2 - p1 - 1)
- if ("Total:" == $2) {
- render_count[i] = $3
- render_max[i] = $3
- } else {
- render_time[i] += $2
- n = $3
- render_delta[i] = n - render_count[i]
- render_count[i] = n
- }
- }
- }
- ' "$@"
|