Very good question!
The weights that you mentioned are also generated by the benchmark
command.
It has several sub-commands which are explained in the README:
$ cargo run --profile=production -- benchmark
Sub-commands concerned with benchmarking.
USAGE:
substrate benchmark <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
block Benchmark the execution time of historic blocks
machine Command to benchmark the hardware.
overhead Benchmark the execution overhead per-block and per-extrinsic
pallet Benchmark the extrinsic weight of FRAME Pallets
storage Benchmark the storage speed of a chain snapshot
The equivalence here is:
benchmark storage
creates RocksDbWeight
and ParityDbWeight
benchmark overhead
creates BlockExecutionWeight
and ExtrinsicBaseWeight
All this is documented in the linked README above.
You can get an impression what parameters to use for these commands when looking at the header of each weigh file in Polkadot. There you will see something like:
//! DATABASE: `ParityDb`, RUNTIME: `Polkadot`
//! BLOCK-NUM: `BlockId::Number(9653477)`
//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1`
//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: `0`
//! WEIGHT-PATH: `runtime/polkadot/constants/src/weights/`
//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0`
// Executed Command:
// ./target/production/polkadot
// benchmark storage
// --db=paritydb
// --state-version=0
// --mul=1.1
// --weight-path=runtime/polkadot/constants/src/weights/
Which tells you how it was called.
PS: The commands had a -
in the name formerly which got removed now.