ctx.pic 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. .sp .10i
  2. .in +.07i
  3. .PS
  4. .ps 9
  5. .vs 9
  6. .ft CB
  7. [
  8. # Variables, tweak these.
  9. xtick = 2.000000 # width of an X tick
  10. xlower = 0.000000 # where the xtick start
  11. xupper = 22.000000 # upper range of graph
  12. xn = 11 # number of ticks to do
  13. ytick = 50.000000 # width of an Y tick
  14. ylower = 0.000000 # where the ytick start
  15. yupper = 450.000000 # upper range of graph
  16. yn = 9 # number of ticks to do
  17. xsize = 2.05 # width of the graph
  18. ysize = 2.1 # height of the graph
  19. yscale = ysize / (yupper - ylower) # scale data to paper
  20. xscale = xsize / (xupper - xlower) # scale data to paper
  21. tick = 0.10000000000000001 # distance towards numbers
  22. gthk = .1 # thickness of grid lines
  23. thk = 0.75 # thickness of data lines
  24. qthk = 2.0 # thickness of quartile lines
  25. vs = .10 # works for 10 point fonts
  26. # Draw the graph borders and tick marks
  27. O: box thick 1.5 ht ysize wid xsize
  28. j = ylower
  29. t = tick * .5
  30. for i = 0 to yn by 1 do {
  31. ys = j - ylower
  32. g = ys * yscale
  33. line thick 1.5 from O.sw + (-tick, g) to O.sw + (0, g)
  34. if (i < yn) then {
  35. y2 = (ys + (ytick / 2)) * yscale
  36. line thick .5 from O.sw + (-t, y2) to O.sw + (0, y2)
  37. }
  38. if (yupper - ylower > 999) then {
  39. sprintf("%.0f", j) rjust at O.sw + (-.2, g - .02)
  40. } else { if (yupper - ylower > 10) then {
  41. sprintf("%.0f", j) rjust at O.sw + (-.2, g - .02)
  42. } else { if (yupper - ylower > 1) then {
  43. sprintf("%.1f", j) rjust at O.sw + (-.2, g - .02)
  44. } else {
  45. sprintf("%.2f", j) rjust at O.sw + (-.2, g - .02)
  46. }}}
  47. j = j + ytick
  48. }
  49. j = xlower
  50. for i = 0 to xn by 1 do {
  51. xs = j - xlower
  52. g = xs * xscale
  53. line thick 1.5 from O.sw + (g, -tick) to O.sw + (g, 0)
  54. if (i < xn) then {
  55. x2 = (xs + (xtick / 2)) * xscale
  56. line thick .5 from O.sw + (x2, 0) to O.sw + (x2, -t)
  57. }
  58. if (xupper - xlower > 999) then {
  59. sprintf("%.0f", j) at O.sw + (g, -.25)
  60. } else { if (xupper - xlower > 10) then {
  61. sprintf("%.0f", j) at O.sw + (g, -.25)
  62. } else { if (xupper - xlower > 1) then {
  63. sprintf("%.1f", j) at O.sw + (g, -.25)
  64. } else {
  65. sprintf("%.2f", j) at O.sw + (g, -.25)
  66. }}}
  67. j = j + xtick
  68. }
  69. # DATASET: Process size=0 overhead=10, MARK 0
  70. [ "\(ci" ] at O.sw + \
  71. (xscale * (2 - xlower), yscale * (6 - ylower))
  72. [ "\(ci" ] at O.sw + \
  73. (xscale * (4 - xlower), yscale * (7 - ylower))
  74. line thick thk from 2nd last [].c to last [].c
  75. [ "\(ci" ] at O.sw + \
  76. (xscale * (8 - xlower), yscale * (7 - ylower))
  77. line thick thk from 2nd last [].c to last [].c
  78. [ "\(ci" ] at O.sw + \
  79. (xscale * (16 - xlower), yscale * (8 - ylower))
  80. line thick thk from 2nd last [].c to last [].c
  81. [ "\(ci" ] at O.sw + \
  82. (xscale * (20 - xlower), yscale * (8 - ylower))
  83. line thick thk from 2nd last [].c to last [].c
  84. # DATASET: Process size=4 overhead=19, MARK 1
  85. [ "\(sq" ] at O.sw + \
  86. (xscale * (2 - xlower), yscale * (7 - ylower))
  87. [ "\(sq" ] at O.sw + \
  88. (xscale * (4 - xlower), yscale * (8 - ylower))
  89. line thick thk from 2nd last [].c to last [].c
  90. [ "\(sq" ] at O.sw + \
  91. (xscale * (8 - xlower), yscale * (9 - ylower))
  92. line thick thk from 2nd last [].c to last [].c
  93. [ "\(sq" ] at O.sw + \
  94. (xscale * (16 - xlower), yscale * (10 - ylower))
  95. line thick thk from 2nd last [].c to last [].c
  96. [ "\(sq" ] at O.sw + \
  97. (xscale * (20 - xlower), yscale * (12 - ylower))
  98. line thick thk from 2nd last [].c to last [].c
  99. # DATASET: Process size=16 overhead=66, MARK 2
  100. [ "\(*D" ] at O.sw + \
  101. (xscale * (2 - xlower), yscale * (14 - ylower))
  102. [ "\(*D" ] at O.sw + \
  103. (xscale * (4 - xlower), yscale * (15 - ylower))
  104. line thick thk from 2nd last [].c to last [].c
  105. [ "\(*D" ] at O.sw + \
  106. (xscale * (8 - xlower), yscale * (18 - ylower))
  107. ".12M" at O.sw + \
  108. (xscale * (8 - xlower), .12 + yscale * (18 - ylower))
  109. line thick thk from 2nd last [].c to last [].c
  110. [ "\(*D" ] at O.sw + \
  111. (xscale * (16 - xlower), yscale * (46 - ylower))
  112. ".25M" at O.sw + \
  113. (xscale * (16 - xlower), .12 + yscale * (46 - ylower))
  114. line thick thk from 2nd last [].c to last [].c
  115. [ "\(*D" ] at O.sw + \
  116. (xscale * (20 - xlower), yscale * (88 - ylower))
  117. line thick thk from 2nd last [].c to last [].c
  118. # DATASET: Process size=32 overhead=129, MARK 3
  119. [ "\(mu" ] at O.sw + \
  120. (xscale * (2 - xlower), yscale * (22 - ylower))
  121. [ "\(mu" ] at O.sw + \
  122. (xscale * (4 - xlower), yscale * (24 - ylower))
  123. line thick thk from 2nd last [].c to last [].c
  124. [ "\(mu" ] at O.sw + \
  125. (xscale * (8 - xlower), yscale * (107 - ylower))
  126. ".25M" at O.sw + \
  127. (xscale * (8 - xlower), .12 + yscale * (107 - ylower))
  128. line thick thk from 2nd last [].c to last [].c
  129. [ "\(mu" ] at O.sw + \
  130. (xscale * (16 - xlower), yscale * (187 - ylower))
  131. ".5M" at O.sw + \
  132. (xscale * (16 - xlower), .12 + yscale * (187 - ylower))
  133. line thick thk from 2nd last [].c to last [].c
  134. [ "\(mu" ] at O.sw + \
  135. (xscale * (20 - xlower), yscale * (188 - ylower))
  136. line thick thk from 2nd last [].c to last [].c
  137. # DATASET: Process size=64 overhead=255, MARK 4
  138. [ "\s+4\(bu\s0" ] at O.sw + \
  139. (xscale * (2 - xlower), yscale * (38 - ylower))
  140. ".12M" at O.sw + \
  141. (xscale * (2 - xlower), .12 + yscale * (38 - ylower))
  142. [ "\s+4\(bu\s0" ] at O.sw + \
  143. (xscale * (4 - xlower), yscale * (140 - ylower))
  144. ".25M" at O.sw + \
  145. (xscale * (4 - xlower) - .14, .12 + yscale * (140 - ylower))
  146. line thick thk from 2nd last [].c to last [].c
  147. [ "\s+4\(bu\s0" ] at O.sw + \
  148. (xscale * (8 - xlower), yscale * (363 - ylower))
  149. ".5M" at O.sw + \
  150. (xscale * (8 - xlower), .12 + yscale * (363 - ylower))
  151. line thick thk from 2nd last [].c to last [].c
  152. [ "\s+4\(bu\s0" ] at O.sw + \
  153. (xscale * (16 - xlower), yscale * (367 - ylower))
  154. "1M" at O.sw + \
  155. (xscale * (16 - xlower), .12 + yscale * (367 - ylower))
  156. line thick thk from 2nd last [].c to last [].c
  157. [ "\s+4\(bu\s0" ] at O.sw + \
  158. (xscale * (20 - xlower), yscale * (367 - ylower))
  159. line thick thk from 2nd last [].c to last [].c
  160. # Xaxis title.
  161. "\s+1Processes\s0" rjust at O.se - (-.15, .6)
  162. # Yaxis title (Time in microseconds)
  163. .ps +1
  164. "T" "i" "m" "e" " " "i" "n" at O.w - (.85, 0)
  165. "m" "i" "c" "r" "o" "s" "e" "c" "o" "n" "d" "s" at O.w - (.68, 0)
  166. .ps
  167. # Graph title.
  168. .vs 12
  169. "\s+2Context switches for" "Linux i686@167Mhz\s0" at O.n + (-.5, .4)
  170. .vs
  171. # Title.
  172. [ "\(ci" ] at O.sw - (.80, .50 + 0 * vs)
  173. "size=0KB \ overhead=10" ljust at last [].e + (.1, 0)
  174. [ "\(sq" ] at last [] - (0, vs)
  175. "size=4KB \ overhead=19" ljust at last [].e + (.1, 0)
  176. [ "\(*D" ] at last [] - (0, vs)
  177. "size=16KB overhead=66" ljust at last [].e + (.1, 0)
  178. [ "\(mu" ] at last [] - (0, vs)
  179. "size=32KB overhead=129" ljust at last [].e + (.1, 0)
  180. [ "\s+4\(bu\s0" ] at last [] - (0, vs)
  181. "size=64KB overhead=255" ljust at last [].e + (.1, 0)
  182. ]
  183. .ft
  184. .ps
  185. .in
  186. .PE