Get phase timing breakdown for a provenance graph. Returns timing data for each phase in the turn. Populated from the per-phase token breakdown that Sherpa graphs carry; empty for agents that do not emit phase timing.
(
&self,
provenance_id: u64,
)
| 766 | /// per-phase token breakdown that Sherpa graphs carry; empty for agents |
| 767 | /// that do not emit phase timing. |
| 768 | pub fn get_session_phases( |
| 769 | &self, |
| 770 | provenance_id: u64, |
| 771 | ) -> PristineResult<Vec<crate::change::session::PhaseTimingEntry>> { |
| 772 | use crate::change::session::{encode_session_prefix, PhaseTimingEntry}; |
| 773 | |
| 774 | let table = self.txn.open_table(SESSION_PHASES)?; |
| 775 | let mut phases = Vec::new(); |
| 776 | |
| 777 | // Bounded prefix scan: all phase keys for this provenance_id lie in |
| 778 | // [prefix(id), prefix(id+1)). |
| 779 | let start = encode_session_prefix(provenance_id); |
| 780 | let end = encode_session_prefix(provenance_id.saturating_add(1)); |
| 781 | for result in table.range::<&[u8; 16]>(&start..&end)? { |
| 782 | let (_key, value) = result?; |
| 783 | match PhaseTimingEntry::from_bytes(value.value()) { |
| 784 | Ok(entry) => phases.push(entry), |
| 785 | Err(e) => { |
| 786 | log::warn!("Failed to deserialize phase timing entry: {}", e); |
| 787 | } |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | Ok(phases) |
| 792 | } |
| 793 | |
| 794 | /// Get intent metadata for a provenance graph. |
| 795 | /// |
nothing calls this directly
no test coverage detected