MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / format_trace

Method format_trace

graphlite/src/plan/trace.rs:649–713  ·  view source on GitHub ↗

Format the trace for display

(&self)

Source from the content-addressed store, hash-verified

647
648 /// Format the trace for display
649 pub fn format_trace(&self) -> String {
650 let mut output = String::new();
651
652 output.push_str(&format!(
653 "Query Plan Trace (total: {:.2}ms)\n",
654 self.total_duration.as_secs_f64() * 1000.0
655 ));
656 output.push_str(&"=".repeat(50));
657 output.push('\n');
658
659 for (i, step) in self.steps.iter().enumerate() {
660 output.push_str(&format!(
661 "{}. {} ({:.2}ms)\n",
662 i + 1,
663 step.description,
664 step.duration.as_secs_f64() * 1000.0
665 ));
666
667 output.push_str(&format!(" Phase: {:?}\n", step.phase));
668
669 if let Some(cost) = &step.cost_estimate {
670 output.push_str(&format!(" Cost: {:.2}\n", cost.total_cost()));
671 }
672
673 if let Some(rows) = step.metadata.estimated_rows {
674 output.push_str(&format!(" Estimated rows: {}\n", rows));
675 }
676
677 if let Some(optimization) = &step.metadata.optimization_applied {
678 output.push_str(&format!(" Optimization: {}\n", optimization));
679 }
680
681 output.push('\n');
682 }
683
684 // Add logical plan
685 output.push_str("Logical Plan:\n");
686 output.push_str(&"-".repeat(20));
687 output.push('\n');
688 output.push_str(&self.format_logical_plan(&self.logical_plan.root, 0));
689 output.push('\n');
690
691 // Add physical plan
692 output.push_str("Physical Plan:\n");
693 output.push_str(&"-".repeat(20));
694 output.push('\n');
695 output.push_str(&self.format_physical_plan(&self.physical_plan.root, 0));
696 output.push('\n');
697
698 // Add summary statistics
699 output.push_str("Summary:\n");
700 output.push_str(&"-".repeat(20));
701 output.push('\n');
702 output.push_str(&format!(
703 "Total estimated cost: {:.2}\n",
704 self.physical_plan.estimated_cost
705 ));
706 output.push_str(&format!(

Callers

nothing calls this directly

Calls 3

format_logical_planMethod · 0.80
format_physical_planMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected