Skip to content

Commit

Permalink
add loaded-account-data-size-cost to qos metric (solana-labs#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
tao-stones authored May 15, 2024
1 parent 517e358 commit e86ab5a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ pub struct BatchedTransactionCostDetails {
pub batched_signature_cost: u64,
pub batched_write_lock_cost: u64,
pub batched_data_bytes_cost: u64,
pub batched_loaded_accounts_data_size_cost: u64,
pub batched_programs_execute_cost: u64,
}

Expand Down
25 changes: 25 additions & 0 deletions core/src/banking_stage/qos_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ impl QosService {
batched_transaction_details.costs.batched_data_bytes_cost,
Ordering::Relaxed,
);
self.metrics
.stats
.estimated_loaded_accounts_data_size_cu
.fetch_add(
batched_transaction_details
.costs
.batched_loaded_accounts_data_size_cost,
Ordering::Relaxed,
);
self.metrics.stats.estimated_programs_execute_cu.fetch_add(
batched_transaction_details
.costs
Expand Down Expand Up @@ -333,6 +342,12 @@ impl QosService {
batched_transaction_details.costs.batched_data_bytes_cost,
cost.data_bytes_cost()
);
saturating_add_assign!(
batched_transaction_details
.costs
.batched_loaded_accounts_data_size_cost,
cost.loaded_accounts_data_size_cost()
);
saturating_add_assign!(
batched_transaction_details
.costs
Expand Down Expand Up @@ -428,6 +443,9 @@ struct QosServiceMetricsStats {
/// accumulated estimated instruction data Compute Units to be packed into block
estimated_data_bytes_cu: AtomicU64,

/// accumulated estimated loaded accounts data size cost to be packed into block
estimated_loaded_accounts_data_size_cu: AtomicU64,

/// accumulated estimated program Compute Units to be packed into block
estimated_programs_execute_cu: AtomicU64,

Expand Down Expand Up @@ -512,6 +530,13 @@ impl QosServiceMetrics {
.swap(0, Ordering::Relaxed),
i64
),
(
"estimated_loaded_accounts_data_size_cu",
self.stats
.estimated_loaded_accounts_data_size_cu
.swap(0, Ordering::Relaxed),
i64
),
(
"estimated_programs_execute_cu",
self.stats
Expand Down

1 comment on commit e86ab5a

@TESLA-SATI
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(solana-labs#1369) - push

  • add loaded-account-data-size-cost to qos metric

  • rpc.rs: Add trace! when an error is mapped to GenericFailure

Please sign in to comment.