Example #1
0
def _custom(trace: ProcessedTrace) -> None:
    gen2_gcs = [gc for gc in trace.gcs if gc.IsGen2]
    datas: List[_GCData] = []
    for gc in gen2_gcs:
        bytes_since_last_same_gen_gc = (unwrap(
            get_bytes_allocated_since_last_gc(trace.gcs, trace.gcs.index(gc),
                                              Gens.GenLargeObj))
                                        if gc.IsGen2 else None)

        datas.append(
            _GCData(
                Number=gc.Number,
                MBSOHSinceLastGen2=bytes_to_mb(
                    unwrap(
                        get_bytes_allocated_since_last_gc(
                            trace.gcs, trace.gcs.index(gc), Gens.Gen2)))
                if gc.IsGen2 else None,
                MBLOHSinceLastGen2=bytes_to_mb(
                    non_null(bytes_since_last_same_gen_gc))
                if gc.IsGen2 else None,
                Gen2BudgetMB=gc.Gen2BudgetMB if gc.IsGen2 else None,
                LOHBudgetMB=gc.LOHBudgetMB if gc.IsGen2 else None,
            ))

    rows = []
    for data in datas:
        rows.append([
            Cell(str(int(x))) if x is not None else Cell() for x in (
                data.Number,
                data.MBSOHSinceLastGen2,
                data.MBLOHSinceLastGen2,
                data.Gen2BudgetMB,
                data.LOHBudgetMB,
            )
        ])

    g2_numbers = ", ".join(str(gc.Number) for gc in gen2_gcs)
    gens = f"Gen2 numbers are: {g2_numbers}"

    doc = single_table_document(
        Table(
            text=gens,
            headers=(
                "number",
                "MB on SOH since last gen2",
                "MB on LOH since last gen2",
                "gen2 budget MB",
                "loh budget MB",
            ),
            rows=rows,
        ))
    handle_doc(doc)
Example #2
0
#%% show-condemned-reasons custom


def _show_condemned_reasons_for_gen2(trace: ProcessedTrace) -> None:
    gcs = [gc for gc in trace.gcs if gc.IsGen2]
    for gc in gcs:
        print(f"gc {gc.Number}")
        print(show_brief_condemned_reasons_for_gc(gc))


_show_condemned_reasons_for_gen2(_TRACE)

#%% print-events

print_events_for_jupyter(path=non_null(_TRACE.test_result.trace_path),
                         time_span_msec=(0, 100),
                         include="thread_times")

#%% custom analysis

total_duration = sum(gc.DurationMSec for gc in _TRACE.gcs)
assert total_duration == _TRACE.unwrap_metric_from_name("DurationMSec_Sum")
print(
    f"{len(_TRACE.gcs)} gcs * {total_duration / len(_TRACE.gcs)} msec avg = {total_duration} msec"
)

#%% custom charting


def _custom_chart() -> None:
Example #3
0

def _show_condemned_reasons_for_gen2(trace: ProcessedTrace) -> None:
    gcs = [gc for gc in trace.gcs if gc.IsGen2]
    for gc in gcs:
        print(f"gc {gc.Number}")
        print(show_brief_condemned_reasons_for_gc(gc))


_show_condemned_reasons_for_gen2(_TRACE)


#%% print-events

print_events_for_jupyter(
    path=non_null(_TRACE.test_result.trace_path), time_span_msec=(0, 100), include="cswitch"
)


#%% custom analysis

total_duration = sum(gc.DurationMSec for gc in _TRACE.gcs)
assert total_duration == _TRACE.unwrap_metric_from_name("DurationMSec_Sum")
print(
    f"{len(_TRACE.gcs)} gcs * {total_duration / len(_TRACE.gcs)} msec avg = {total_duration} msec"
)


#%% custom charting