MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / perf_warm

Function perf_warm

xtask/src/main.rs:1625–1764  ·  view source on GitHub ↗
(args: &[String])

Source from the content-addressed store, hash-verified

1623}
1624
1625fn perf_warm(args: &[String]) -> Result<()> {
1626 let mut query_iterations = 100usize;
1627 let mut connection_iterations = 20usize;
1628 let mut cursor = 0usize;
1629 while cursor < args.len() {
1630 match args[cursor].as_str() {
1631 "--iterations" => {
1632 cursor += 1;
1633 let value = args
1634 .get(cursor)
1635 .ok_or_else(|| anyhow!("--iterations requires a value"))?;
1636 query_iterations = value
1637 .parse()
1638 .with_context(|| format!("parse --iterations value {value:?}"))?;
1639 }
1640 "--connections" => {
1641 cursor += 1;
1642 let value = args
1643 .get(cursor)
1644 .ok_or_else(|| anyhow!("--connections requires a value"))?;
1645 connection_iterations = value
1646 .parse()
1647 .with_context(|| format!("parse --connections value {value:?}"))?;
1648 }
1649 other => bail!("unknown perf warm flag: {other}"),
1650 }
1651 cursor += 1;
1652 }
1653 if query_iterations == 0 {
1654 bail!("--iterations must be greater than zero");
1655 }
1656 if connection_iterations == 0 {
1657 bail!("--connections must be greater than zero");
1658 }
1659
1660 let mut operations = Vec::new();
1661 operations.push(capture_operation(
1662 "warm_process_preload",
1663 "Warm runtime and representative extension artifacts before steady-state workloads.",
1664 "existing",
1665 "warm",
1666 "process_cache",
1667 "not_a_query",
1668 "runtime_and_extension_preload",
1669 "operation.total",
1670 || {
1671 Pglite::preload()?;
1672 Pglite::preload_extensions([extensions::VECTOR])
1673 },
1674 )?);
1675 operations.push(capture_operation(
1676 "warm_direct_repeated_scalar_queries",
1677 "Repeated direct API scalar extended-protocol queries on one already-open temporary database.",
1678 "warm_after_preload",
1679 "warm",
1680 "long_lived_temporary_direct_root",
1681 "steady_state_queries",
1682 "direct_select_with_bind",

Callers 1

perfFunction · 0.85

Tested by

no test coverage detected