AnalyseLog 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/sh
  2. # simple script to check the progress
  3. gawk -- '
  4. BEGIN {
  5. index_count = 0
  6. index_delta = 0
  7. index_time = 0
  8. delete parse_count
  9. delete parse_delta
  10. delete parse_time
  11. delete parse_max
  12. delete render_count
  13. delete render_delta
  14. delete render_max
  15. quotes = "['"'"'\"]"
  16. }
  17. END {
  18. if (0 != index_delta) {
  19. printf("Index: %15d %8.2fs per %5d\n", index_count, (index_time / (index_count / index_delta)), index_delta)
  20. } else {
  21. print "Index: Not Started"
  22. }
  23. if (0 != length(parse_delta)) {
  24. for (i in parse_delta) {
  25. if (0 == parse_max[i]) {
  26. complete = 0
  27. for (j in parse_max) {
  28. if (0 != parse_max[j]) {
  29. complete = 100 * parse_count[i] / parse_max[j]
  30. break
  31. }
  32. }
  33. } else {
  34. complete = 100 * parse_count[i] / parse_max[i]
  35. }
  36. average = parse_time[i] / (parse_count[i] / parse_delta[i])
  37. printf("Parse[%2d]: %11d %6.1f%% %8.2fs per %5d\n", i, parse_count[i], complete, average, parse_delta[i])
  38. }
  39. } else {
  40. print "Parse: Not Started"
  41. }
  42. if (0 != length(render_delta)) {
  43. for (i in render_delta) {
  44. n = render_max[i]
  45. if (0 == n) {
  46. n = parse_count[i]
  47. }
  48. if (0 != n) {
  49. complete = 100 * render_count[i] / n
  50. } else {
  51. complete = 0
  52. }
  53. average = render_time[i] / (render_count[i] / render_delta[i])
  54. printf("Render[%2d]: %10d %6.1f%% %8.2fs per %5d\n", i, render_count[i], complete, average, render_delta[i])
  55. }
  56. } else {
  57. print "Render: Not Started"
  58. }
  59. }
  60. /^Index:/ {
  61. index_time += $2
  62. n = $3
  63. index_delta = n - index_count
  64. index_count = n
  65. }
  66. /^make[[:space:]]+RENDER_BLOCK=.*parse/ {
  67. n = gensub("^[^=]*=" quotes "*([[:digit:]]+)" quotes "*.*$", "\\1", "", $2) + 0
  68. c = gensub("^[^=]*=" quotes "*([[:digit:]]+)" quotes "*.*$", "\\1", "", $4) + 0
  69. sub("k", "000", c)
  70. if ("all" == c) {
  71. c = 0
  72. }
  73. parse_max[n] = c
  74. render_max[n] = c
  75. }
  76. /^Parse\[/ {
  77. p1 = index($0, "-")
  78. p2 = index($0, ".")
  79. if (p1 > 0 && p2 > 0) {
  80. i = substr($0, p1 + 1, p2 - p1 - 1)
  81. if ("Total:" == $2) {
  82. parse_count[i] = $3
  83. parse_max[i] = $3
  84. } else {
  85. parse_time[i] += $2
  86. n = $3
  87. parse_delta[i] = n - parse_count[i]
  88. parse_count[i] = n
  89. }
  90. }
  91. }
  92. /^Render\[/ {
  93. p1 = index($0, "[")
  94. p2 = index($0, "]")
  95. if (p1 > 0 && p2 > 0) {
  96. i = substr($0, p1 + 1, p2 - p1 - 1)
  97. if ("Total:" == $2) {
  98. render_count[i] = $3
  99. render_max[i] = $3
  100. } else {
  101. render_time[i] += $2
  102. n = $3
  103. render_delta[i] = n - render_count[i]
  104. render_count[i] = n
  105. }
  106. }
  107. }
  108. ' "$@"