| 5064 | } |
| 5065 | |
| 5066 | fn unique_perf_root(name: &str) -> Result<PathBuf> { |
| 5067 | let now = SystemTime::now() |
| 5068 | .duration_since(UNIX_EPOCH) |
| 5069 | .context("read system clock for perf root")? |
| 5070 | .as_nanos(); |
| 5071 | let root = env::temp_dir().join(format!("pglite-oxide-{name}-{}-{now}", std::process::id())); |
| 5072 | if root.exists() { |
| 5073 | fs::remove_dir_all(&root) |
| 5074 | .with_context(|| format!("remove stale perf root {}", root.display()))?; |
| 5075 | } |
| 5076 | fs::create_dir_all(&root).with_context(|| format!("create perf root {}", root.display()))?; |
| 5077 | Ok(root) |
| 5078 | } |
| 5079 | |
| 5080 | fn ensure_json_int(value: &serde_json::Value, expected: i64) -> Result<()> { |
| 5081 | let Some(actual) = value.as_i64() else { |