Various minor fixes (#2860)

* Make sr-api-macros benchmark work again

It broke with 4f888f34d3.

* Give better indication of import progress

* Only send consensus info when explicitly enabled

This is only necessary for validators and they can
explicitly enable it via

	--telemetry-url 'wss://telemetry.polkadot.io 1'

(or some other endpoint)

* Remove unnecessary mutable

* Fix style
This commit is contained in:
Michael Müller
2019-06-13 18:23:04 +02:00
committed by Gavin Wood
parent 12bbc2ffd9
commit 5c3d1f82cd
4 changed files with 16 additions and 6 deletions
+8 -1
View File
@@ -175,7 +175,7 @@ pub fn import_blocks<F, E, R>(
block_count = b;
if b % 1000 == 0 {
info!("#{}", b);
info!("#{} blocks were added to the queue", b);
}
}
@@ -184,6 +184,13 @@ pub fn import_blocks<F, E, R>(
wait_recv.recv()
.expect("Importing thread has panicked. Then the main process will die before this can be reached. qed.");
blocks_imported += 1;
if blocks_imported % 1000 == 0 {
info!(
"#{} blocks were imported (#{} left)",
blocks_imported,
count - blocks_imported
);
}
}
info!("Imported {} blocks. Best: #{}", block_count, client.info().chain.best_number);
@@ -15,7 +15,10 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use criterion::{Criterion, criterion_group, criterion_main};
use test_client::runtime::TestAPI;
use test_client::{
DefaultTestClientBuilderExt, TestClientBuilder,
TestClientBuilderExt, runtime::TestAPI,
};
use runtime_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
use state_machine::ExecutionStrategy;
@@ -53,13 +56,13 @@ fn sr_api_benchmark(c: &mut Criterion) {
});
c.bench_function("calling function by function pointer in wasm", |b| {
let client = test_client::new_with_execution_strategy(ExecutionStrategy::AlwaysWasm);
let client = TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::AlwaysWasm).build();
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_indirect_call(&block_id).unwrap())
});
c.bench_function("calling function in wasm", |b| {
let client = test_client::new_with_execution_strategy(ExecutionStrategy::AlwaysWasm);
let client = TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::AlwaysWasm).build();
let block_id = BlockId::Number(client.info().chain.best_number);
b.iter(|| client.runtime_api().benchmark_direct_call(&block_id).unwrap())
});
+1 -1
View File
@@ -111,7 +111,7 @@ pub const SUBSTRATE_INFO: &str = "0";
pub const CONSENSUS_TRACE: &str = "9";
pub const CONSENSUS_DEBUG: &str = "5";
pub const CONSENSUS_WARN: &str = "4";
pub const CONSENSUS_INFO: &str = "0";
pub const CONSENSUS_INFO: &str = "1";
/// Telemetry object. Implements `Future` and must be polled regularly.
/// Contains an `Arc` and can be cloned and pass around. Only one clone needs to be polled
@@ -83,7 +83,7 @@ where
let seed = factory_state.start_number() + factory_state.block_no();
let to = RA::gen_random_account_id(&seed);
let mut amount;
let amount;
if factory_state.round() == RA::Number::zero() {
amount = RA::minimum_balance() * factory_state.rounds();
} else {