(args: &[String])
| 1809 | } |
| 1810 | |
| 1811 | fn perf_bench(args: &[String]) -> Result<()> { |
| 1812 | let mut suite = BenchmarkSuiteFilter::All; |
| 1813 | let mut mode = BenchmarkModeFilter::All; |
| 1814 | let mut rtt_iterations = 100usize; |
| 1815 | let mut speed_scale = 1.0f64; |
| 1816 | let mut speed_sql_source = SpeedSqlSource::Generated; |
| 1817 | let mut cursor = 0usize; |
| 1818 | while cursor < args.len() { |
| 1819 | match args[cursor].as_str() { |
| 1820 | "--suite" => { |
| 1821 | cursor += 1; |
| 1822 | let value = args |
| 1823 | .get(cursor) |
| 1824 | .ok_or_else(|| anyhow!("--suite requires a value"))?; |
| 1825 | suite = match value.as_str() { |
| 1826 | "all" => BenchmarkSuiteFilter::All, |
| 1827 | "rtt" | "roundtrip" | "round-trip" => BenchmarkSuiteFilter::Rtt, |
| 1828 | "speed" | "sqlite" | "sqlite-suite" => BenchmarkSuiteFilter::Speed, |
| 1829 | other => bail!("unknown --suite value {other:?}; use all, rtt, or speed"), |
| 1830 | }; |
| 1831 | } |
| 1832 | "--mode" => { |
| 1833 | cursor += 1; |
| 1834 | let value = args |
| 1835 | .get(cursor) |
| 1836 | .ok_or_else(|| anyhow!("--mode requires a value"))?; |
| 1837 | mode = match value.as_str() { |
| 1838 | "all" => BenchmarkModeFilter::All, |
| 1839 | "direct" => BenchmarkModeFilter::Direct, |
| 1840 | "server-sqlx" | "server_sqlx" | "sqlx" | "server" => { |
| 1841 | BenchmarkModeFilter::ServerSqlx |
| 1842 | } |
| 1843 | "server-tokio-postgres-simple" |
| 1844 | | "server_tokio_postgres_simple" |
| 1845 | | "tokio-postgres-simple" |
| 1846 | | "tokio_postgres_simple" |
| 1847 | | "tokio-postgres" |
| 1848 | | "tokio_postgres" => BenchmarkModeFilter::ServerTokioPostgresSimple, |
| 1849 | other => { |
| 1850 | bail!( |
| 1851 | "unknown --mode value {other:?}; use all, direct, server-sqlx, or server-tokio-postgres-simple" |
| 1852 | ) |
| 1853 | } |
| 1854 | }; |
| 1855 | } |
| 1856 | "--iterations" => { |
| 1857 | cursor += 1; |
| 1858 | let value = args |
| 1859 | .get(cursor) |
| 1860 | .ok_or_else(|| anyhow!("--iterations requires a value"))?; |
| 1861 | rtt_iterations = value |
| 1862 | .parse() |
| 1863 | .with_context(|| format!("parse --iterations value {value:?}"))?; |
| 1864 | } |
| 1865 | "--scale" => { |
| 1866 | cursor += 1; |
| 1867 | let value = args |
| 1868 | .get(cursor) |
no test coverage detected