(filename)
| 285 | |
| 286 | |
| 287 | def process_trace(filename): |
| 288 | trace = gc_nvp_common.parse_gc_trace(filename) |
| 289 | |
| 290 | marksweeps = filter(lambda r: r['gc'] == 'ms', trace) |
| 291 | scavenges = filter(lambda r: r['gc'] == 's', trace) |
| 292 | globalgcs = filter(lambda r: r['gc'] != 's', trace) |
| 293 | |
| 294 | |
| 295 | charts = plot_all(plots, trace, filename) |
| 296 | |
| 297 | def stats(out, prefix, trace, field): |
| 298 | n = len(trace) |
| 299 | total = calc_total(trace, field) |
| 300 | max = calc_max(trace, field) |
| 301 | if n > 0: |
| 302 | avg = total / n |
| 303 | else: |
| 304 | avg = 0 |
| 305 | if n > 1: |
| 306 | dev = math.sqrt(freduce(lambda t,r: t + (r - avg) ** 2, field, trace, 0) / |
| 307 | (n - 1)) |
| 308 | else: |
| 309 | dev = 0 |
| 310 | |
| 311 | out.write('<tr><td>%s</td><td>%d</td><td>%d</td>' |
| 312 | '<td>%d</td><td>%d [dev %f]</td></tr>' % |
| 313 | (prefix, n, total, max, avg, dev)) |
| 314 | |
| 315 | def HumanReadable(size): |
| 316 | suffixes = ['bytes', 'kB', 'MB', 'GB'] |
| 317 | power = 1 |
| 318 | for i in range(len(suffixes)): |
| 319 | if size < power*1024: |
| 320 | return "%.1f" % (float(size) / power) + " " + suffixes[i] |
| 321 | power *= 1024 |
| 322 | |
| 323 | def throughput(name, trace): |
| 324 | total_live_after = calc_total(trace, 'total_size_after') |
| 325 | total_live_before = calc_total(trace, 'total_size_before') |
| 326 | total_gc = calc_total(trace, 'pause') |
| 327 | if total_gc == 0: |
| 328 | return |
| 329 | out.write('GC %s Throughput (after): %s / %s ms = %s/ms<br/>' % |
| 330 | (name, |
| 331 | HumanReadable(total_live_after), |
| 332 | total_gc, |
| 333 | HumanReadable(total_live_after / total_gc))) |
| 334 | out.write('GC %s Throughput (before): %s / %s ms = %s/ms<br/>' % |
| 335 | (name, |
| 336 | HumanReadable(total_live_before), |
| 337 | total_gc, |
| 338 | HumanReadable(total_live_before / total_gc))) |
| 339 | |
| 340 | |
| 341 | with open(filename + '.html', 'w') as out: |
| 342 | out.write('<html><body>') |
| 343 | out.write('<table>') |
| 344 | out.write('<tr><td>Phase</td><td>Count</td><td>Time (ms)</td>') |
no test coverage detected
searching dependent graphs…