(args: &[String])
| 1279 | } |
| 1280 | |
| 1281 | fn perf_cold(args: &[String]) -> Result<()> { |
| 1282 | let reset_cache = args.iter().any(|arg| arg == "--reset-cache"); |
| 1283 | for arg in args { |
| 1284 | if arg != "--reset-cache" { |
| 1285 | bail!("unknown perf cold flag: {arg}"); |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | let cache_dir = pglite_oxide_cache_dir()?; |
| 1290 | let cache_state_at_start = if reset_cache { |
| 1291 | if cache_dir.exists() { |
| 1292 | fs::remove_dir_all(&cache_dir) |
| 1293 | .with_context(|| format!("reset pglite-oxide cache {}", cache_dir.display()))?; |
| 1294 | } |
| 1295 | "cold_absent_after_reset" |
| 1296 | } else if cache_dir.exists() { |
| 1297 | "existing" |
| 1298 | } else { |
| 1299 | "cold_absent" |
| 1300 | }; |
| 1301 | |
| 1302 | let mut operations = Vec::new(); |
| 1303 | |
| 1304 | operations.push(capture_operation( |
| 1305 | "process_cold_runtime_preload", |
| 1306 | "First explicit runtime preload in this xtask process. With --reset-cache, this includes first-install cache bootstrap.", |
| 1307 | cache_state_at_start, |
| 1308 | "cold", |
| 1309 | "internal_preload_temp_root", |
| 1310 | "not_a_query", |
| 1311 | "runtime_preload", |
| 1312 | "operation.total", |
| 1313 | Pglite::preload, |
| 1314 | )?); |
| 1315 | operations.push(capture_operation( |
| 1316 | "process_warm_new_temp_direct_first_query", |
| 1317 | "First direct query for a newly opened temporary database after runtime preload in the same process.", |
| 1318 | "warm_after_runtime_preload", |
| 1319 | "warm", |
| 1320 | "new_temporary_root", |
| 1321 | "first_query_after_open", |
| 1322 | "direct_select_with_bind", |
| 1323 | "visible.direct_open_to_first_query", |
| 1324 | run_direct_select_one, |
| 1325 | )?); |
| 1326 | operations.push(capture_operation( |
| 1327 | "process_warm_second_new_temp_direct_first_query", |
| 1328 | "Repeat first direct query for a second newly opened temporary database in the same warm process.", |
| 1329 | "warm_after_runtime_preload", |
| 1330 | "warm", |
| 1331 | "second_new_temporary_root", |
| 1332 | "first_query_after_open", |
| 1333 | "direct_select_with_bind", |
| 1334 | "visible.direct_open_to_first_query", |
| 1335 | run_direct_select_one, |
| 1336 | )?); |
| 1337 | operations.push(capture_operation( |
| 1338 | "process_warm_vector_preload", |
no test coverage detected