MCPcopy Create free account
hub / github.com/docling-project/docling-parse / write_per_document_csv

Function write_per_document_csv

perf/run_perf.py:484–520  ·  view source on GitHub ↗
(rows: List[Row], out_path: Path)

Source from the content-addressed store, hash-verified

482
483
484def write_per_document_csv(rows: List[Row], out_path: Path) -> Path:
485 per_doc = compute_per_document_stats(rows)
486 per_doc_path = out_path.with_name(out_path.stem + "_per_doc" + out_path.suffix)
487 with per_doc_path.open("w", newline="") as f:
488 w = csv.writer(f)
489 w.writerow(
490 [
491 "basename",
492 "document",
493 "pages",
494 "total",
495 "mean",
496 "median",
497 "min",
498 "max",
499 "p90",
500 "p95",
501 "p99",
502 ]
503 )
504 for s in per_doc:
505 w.writerow(
506 [
507 Path(s["document"]).name,
508 s["document"],
509 s["pages"],
510 fmt_seconds(s["total"]),
511 fmt_seconds(s["mean"]),
512 fmt_seconds(s["median"]),
513 fmt_seconds(s["min"]),
514 fmt_seconds(s["max"]),
515 fmt_seconds(s["p90"]),
516 fmt_seconds(s["p95"]),
517 fmt_seconds(s["p99"]),
518 ]
519 )
520 return per_doc_path
521
522
523def _get_timing_keys_from_rows(rows: List[Row]) -> List[str]:

Callers 1

mainFunction · 0.85

Calls 2

fmt_secondsFunction · 0.85

Tested by

no test coverage detected