polkadot_runtime_constants/weights/rocksdb_weights.rs
1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: Apache-2.0
5
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10// http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
19//! DATE: 2022-03-29 (Y/M/D)
20//!
21//! DATABASE: `RocksDb`, RUNTIME: `Polkadot`
22//! BLOCK-NUM: `BlockId::Number(9643856)`
23//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
24//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: `0`
25//! WEIGHT-PATH: `runtime/polkadot/constants/src/weights/`
26//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`
27
28// Executed Command:
29// ./target/production/polkadot
30// benchmark-storage
31// --state-version=0
32// --mul=1.1
33// --weight-path=runtime/polkadot/constants/src/weights/
34
35/// Storage DB weights for the `Polkadot` runtime and `RocksDb`.
36pub mod constants {
37 use frame_support::{
38 parameter_types,
39 weights::{constants, RuntimeDbWeight},
40 };
41
42 parameter_types! {
43 /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
44 /// the runtime.
45 pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
46 /// Time to read one storage item.
47 /// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
48 ///
49 /// Stats [NS]:
50 /// Min, Max: 5_015, 1_441_022
51 /// Average: 18_635
52 /// Median: 17_795
53 /// Std-Dev: 4829.75
54 ///
55 /// Percentiles [NS]:
56 /// 99th: 32_074
57 /// 95th: 26_658
58 /// 75th: 19_363
59 read: 20_499 * constants::WEIGHT_REF_TIME_PER_NANOS,
60
61 /// Time to write one storage item.
62 /// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
63 ///
64 /// Stats [NS]:
65 /// Min, Max: 16_368, 34_500_937
66 /// Average: 75_882
67 /// Median: 74_236
68 /// Std-Dev: 64706.41
69 ///
70 /// Percentiles [NS]:
71 /// 99th: 111_151
72 /// 95th: 92_666
73 /// 75th: 80_297
74 write: 83_471 * constants::WEIGHT_REF_TIME_PER_NANOS,
75 };
76 }
77
78 #[cfg(test)]
79 mod test_db_weights {
80 use super::constants::RocksDbWeight as W;
81 use frame_support::weights::constants;
82
83 /// Checks that all weights exist and have sane values.
84 // NOTE: If this test fails but you are sure that the generated values are fine,
85 // you can delete it.
86 #[test]
87 fn bound() {
88 // At least 1 µs.
89 assert!(
90 W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
91 "Read weight should be at least 1 µs."
92 );
93 assert!(
94 W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
95 "Write weight should be at least 1 µs."
96 );
97 // At most 1 ms.
98 assert!(
99 W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
100 "Read weight should be at most 1 ms."
101 );
102 assert!(
103 W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
104 "Write weight should be at most 1 ms."
105 );
106 }
107 }
108}