Skip to content

Commit

Permalink
fix1
Browse files Browse the repository at this point in the history
  • Loading branch information
AshinGau committed Dec 3, 2024
1 parent 3e8cc66 commit d59866e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use ahash::{AHashMap as HashMap, AHashSet as HashSet};
use atomic::Atomic;
use dashmap::DashSet;
use fastrace::Span;
use lazy_static::lazy_static;
use metrics::{gauge, histogram};
use revm::{
primitives::{
Expand Down Expand Up @@ -550,12 +549,12 @@ where
/// If the smallest TxID is a conflict transaction, return an error.
#[fastrace::trace]
fn find_continuous_min_txid(&mut self) -> Result<usize, GrevmError<DB::Error>> {
let mut min_execute_time = Duration::from_secs(u64::MAX);
let mut sum_execute_time = Duration::from_secs(0);
let mut max_execute_time = Duration::from_secs(0);
for executor in &self.partition_executors {
let mut executor = executor.write().unwrap();
self.metrics.reusable_tx_cnt += executor.metrics.reusable_tx_cnt;
min_execute_time = min_execute_time.min(executor.metrics.execute_time);
sum_execute_time += executor.metrics.execute_time;
max_execute_time = max_execute_time.max(executor.metrics.execute_time);
if executor.assigned_txs[0] == self.num_finality_txs &&
self.tx_states[self.num_finality_txs].tx_status == TransactionStatus::Conflict
Expand All @@ -568,7 +567,9 @@ where
let mut conflict_tx_cnt = 0;
let mut unconfirmed_tx_cnt = 0;
let mut finality_tx_cnt = 0;
self.metrics.partition_et_diff += (max_execute_time - min_execute_time).as_nanos() as u64;
let avg_execution_time =
sum_execute_time.as_nanos() / self.partition_executors.len() as u128;
self.metrics.partition_et_diff += (max_execute_time.as_nanos() - avg_execution_time) as u64;
#[allow(invalid_reference_casting)]
let tx_states =
unsafe { &mut *(&(*self.tx_states) as *const Vec<TxState> as *mut Vec<TxState>) };
Expand Down
11 changes: 6 additions & 5 deletions src/tx_dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
pub(crate) type DependentTxsVec = SmallVec<[TxId; 1]>;

use ahash::{AHashMap as HashMap, AHashSet as HashSet};
use metrics::counter;
use metrics::{counter, histogram};

const RAW_TRANSFER_WEIGHT: usize = 1;

Expand Down Expand Up @@ -214,12 +214,13 @@ impl TxDependency {
if !(*DEBUG_BOTTLENECK) {
return;
}
if let Some(0) = self.round {
counter!("grevm.total_block_cnt").increment(1);
}
let num_finality_txs = self.num_finality_txs;
let num_txs = num_finality_txs + self.tx_dependency.len();
let num_remaining = self.tx_dependency.len();
if let Some(0) = self.round {
counter!("grevm.total_block_cnt").increment(1);
histogram!("grevm.txs_per_block").record(num_txs as f64);
}
if num_txs < 64 || num_remaining < num_txs / 3 {
return;
}
Expand Down Expand Up @@ -265,7 +266,7 @@ impl TxDependency {
if chain_len > graph_len * 2 / 3 {
// Long chain
counter!("grevm.large_graph", "type" => "chain", "tip" => tip.clone()).increment(1);
} else if chain_len < max(3, graph_len / 8) {
} else if chain_len < max(3, graph_len / 6) {
// Star Graph
counter!("grevm.large_graph", "type" => "star", "tip" => tip.clone()).increment(1);
} else {
Expand Down

0 comments on commit d59866e

Please sign in to comment.