oxirs_arq/executor/
stats.rs1use std::time::Duration;
6
7#[derive(Debug, Clone, Copy, PartialEq)]
9pub enum JoinAlgorithm {
10 NestedLoop,
11 Hash,
12 SortMerge,
13 IndexNestedLoop,
14}
15
16#[derive(Debug, Clone, Default)]
18pub struct ExecutionStats {
19 pub execution_time: Duration,
21 pub intermediate_results: usize,
23 pub final_results: usize,
25 pub memory_used: usize,
27 pub operations: usize,
29 pub property_path_evaluations: usize,
31 pub time_spent_on_paths: Duration,
33 pub service_calls: usize,
35 pub time_spent_on_services: Duration,
37 pub warnings: Vec<String>,
39}
40
41impl ExecutionStats {
42 pub fn new() -> Self {
44 Self::default()
45 }
46
47 pub fn merge_from(&mut self, other: &ExecutionStats) {
49 self.execution_time += other.execution_time;
50 self.intermediate_results += other.intermediate_results;
51 self.final_results += other.final_results;
52 self.memory_used += other.memory_used;
53 self.operations += other.operations;
54 self.property_path_evaluations += other.property_path_evaluations;
55 self.time_spent_on_paths += other.time_spent_on_paths;
56 self.service_calls += other.service_calls;
57 self.time_spent_on_services += other.time_spent_on_services;
58 self.warnings.extend(other.warnings.clone());
59 }
60
61 pub fn add_warning(&mut self, warning: String) {
63 self.warnings.push(warning);
64 }
65
66 pub fn increment_operations(&mut self) {
68 self.operations += 1;
69 }
70
71 pub fn add_memory_usage(&mut self, bytes: usize) {
73 self.memory_used += bytes;
74 }
75}