Skip to content

Commit

Permalink
small refactoring in weight-diff tool
Browse files Browse the repository at this point in the history
  • Loading branch information
StackOverflowExcept1on committed Aug 26, 2024
1 parent 2b3ff8b commit 7015952
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 76 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions core/src/gas_metering/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#![allow(rustdoc::broken_intra_doc_links, missing_docs)]
#![doc = r" This is auto-generated module that contains cost schedule from"]
#![doc = r" `pallets/gear/src/schedule.rs`."]
#![doc = r""]
#![doc = r" See `./scripts/weight-dump.sh` if you want to update it."]
#![allow(rustdoc::broken_intra_doc_links, missing_docs)]

use crate::costs::*;

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -1013,20 +1014,23 @@ impl Default for DbWeights {
}
}

#[doc = r" TODO: documentation"]
#[doc = r" Represents the computational time and storage space required for an operation."]
#[derive(Debug, Clone, Copy)]
pub struct Weight {
#[doc = r" Reference time"]
#[doc = r" The weight of computational time used based on some reference hardware."]
pub ref_time: u64,
#[doc = r" Storage size of the weight"]
#[doc = r" The weight of storage space used by proof of validity."]
pub proof_size: u64,
}

impl Weight {
#[doc = r" Return the reference time part of the weight."]
#[doc(hidden)]
pub const fn ref_time(&self) -> u64 {
self.ref_time
}
#[doc = r" Saturating [`Weight`] addition. Computes `self + rhs`, saturating at the numeric bounds of"]
#[doc = r" all fields instead of overflowing."]
#[doc(hidden)]
pub const fn saturating_add(&self, other: Self) -> Self {
Self {
Expand Down
2 changes: 2 additions & 0 deletions utils/weight-diff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ edition.workspace = true
license.workspace = true

[dependencies]
anyhow.workspace = true
heck.workspace = true
clap = { workspace = true, features = ["derive"] }
indexmap = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive"] }
Expand Down
Loading

0 comments on commit 7015952

Please sign in to comment.