{"record":{"id":"aafcc44acd2b8bf0","repo":"tursodatabase/turso","slug":"no-cpu-samples-collected-increase-queries-or-seconds","errorCode":null,"errorMessage":"no CPU samples collected; increase --queries or --seconds","messagePattern":"no CPU samples collected; increase --queries or --seconds","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"perf/fts/src/profiling.rs","lineNumber":31,"sourceCode":"    #[cfg(any(\n        target_arch = \"x86_64\",\n        target_arch = \"aarch64\",\n        target_arch = \"riscv64\",\n        target_arch = \"loongarch64\"\n    ))]\n    let builder = builder.blocklist(&[\"libc\", \"libgcc\", \"pthread\", \"vdso\"]);\n    Ok(Some(builder.build()?))\n}\n\npub fn finish(profiler: Option<pprof::ProfilerGuard<'static>>, path: Option<&Path>) -> Result<()> {\n    let Some(profiler) = profiler else {\n        assert!(path.is_none());\n        return Ok(());\n    };\n    let report = profiler.report().build()?;\n    drop(profiler);\n    let path = path.expect(\"enabled profiler must have an output path\");\n    ensure!(\n        !report.data.is_empty(),\n        \"no CPU samples collected; increase --queries or --seconds\"\n    );\n    let mut stacks = BTreeMap::<String, isize>::new();\n    for (frames, count) in &report.data {\n        let mut names = vec![frames.thread_name_or_id()];\n        for frame in frames.frames.iter().rev() {\n            for symbol in frame.iter().rev() {\n                names.push(symbol.name().replace(';', \":\"));\n            }\n        }\n        *stacks.entry(names.join(\";\")).or_default() += count;\n    }\n    let mut folded = BufWriter::new(File::create_new(path.with_extension(\"folded\"))?);\n    for (stack, count) in stacks {\n        writeln!(folded, \"{stack} {count}\")?;\n    }\n    folded.flush()?;","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/tursodatabase/turso/blob/8d4a589f8d13ac184700d2a8f724f27e1995be3b/perf/fts/src/profiling.rs#L13-L49","documentation":"After stopping the CPU profiler, finish() builds a report and requires at least one collected sample before producing a flamegraph. ensure! in perf/fts/src/profiling.rs:31 fails when report.data is empty, meaning the profiled workload was too short or too light for the sampler to record any frames.","triggerScenarios":"Calling finish() on an enabled profiler whose capture window contained no samples — typically a benchmark run with very few queries (--queries 1) or a sub-second --seconds window, so the sampling interval never fired.","commonSituations":"Profiling a quick smoke test instead of a real run; high sampling interval combined with tiny workloads; records_worker_cpu_without_rendering_svg-style tests driving a profiler with minimal work; profiler attached but workload finishing before the first tick.","solutions":["Increase --queries (search mode) or --seconds (throughput mode) so the run lasts long enough to sample","Lower the profiler sampling interval if the profiler configuration allows it","Skip profiling for tiny runs: only enable the profiler for realistically sized workloads","Confirm the profiler was actually enabled/attached (an enabled profiler with no path or no samples may indicate attachment failure)"],"exampleFix":"// before\nfts-bench --benchmark search --queries 1 --profile out.svg\n// after\nfts-bench --benchmark search --queries 100000 --profile out.svg","handlingStrategy":"validation","validationCode":"if queries < 10_000 && seconds.unwrap_or(5.0) < 1.0 { eprintln!(\"workload too small for CPU profiling; increase --queries or --seconds\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only enable profiling for workloads running at least a few seconds","Scale --queries/--seconds up whenever --profile is passed","Check profiler attachment (output path present) before interpreting empty reports","Lower sampling interval for short runs if the profiler supports it"],"tags":["profiling","cpu","empty-data","benchmark"],"backgroundTag":"empty-result-set","analyzedSha":"8d4a589f8d13ac184700d2a8f724f27e1995be3b","analyzedAt":"2026-09-20T13:18:14.658Z","contentChangedAt":"2026-09-20T13:18:14.658Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}