예제 #1
0
def _more_custom(trace: ProcessedTrace) -> None:
    rows: List[Row] = []
    for gc in trace.gcs:
        if not gc.IsBackground:
            continue
        rows.append((Cell(gc.Number), Cell(str(gc.reason))))

    handle_doc(single_table_document(Table(headers=("number", "reason"), rows=rows)))
예제 #2
0
def _custom2(trace: ProcessedTrace) -> None:
    gen_to_suspension_datas: List[List[_SuspensionData]] = [[] for _ in range(3)]

    for gc in trace.gcs:
        if gc.PauseDurationMSec < 50:
            continue

        gen_to_suspension_datas[enum_value(gc.Generation)].append(
            _SuspensionData(
                PauseToStartMSec=gc.SuspendToGCStartMSec,
                DurationMSec=gc.DurationMSec,
                PauseDurationMSec=gc.PauseDurationMSec,
                SuspendDurationMSec=gc.SuspendDurationMSec,
                PromotedMB=gc.PromotedMB,
            )
        )

    for gen in ALL_GC_GENS:
        print(f"\n=== {gen.name} suspensions ===\n")
        rows = []
        for susp_data in sorted(
            gen_to_suspension_datas[0], key=lambda sd: sd.DurationMSec, reverse=True
        ):
            rows.append(
                [
                    Cell(x)
                    for x in (
                        susp_data.PauseDurationMSec,
                        susp_data.DurationMSec,
                        # susp_data.PctPauseFromSuspend,
                        # susp_data.PauseToStartMSec,
                        susp_data.SuspendDurationMSec,
                        # susp_data.SuspensionPercent,
                        susp_data.PromotedMB,
                        susp_data.PromotedMBPerSec,
                    )
                ]
            )
        handle_doc(
            single_table_document(
                Table(
                    headers=(
                        "pause msec",
                        "duration msec",
                        # "pause %",
                        # "pause to start",
                        "suspend msec",
                        # "suspend %",
                        "promoted mb",
                        "promoted mb/sec",
                    ),
                    rows=rows,
                )
            )
        )
예제 #3
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)