This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
replaced println with log Closes #12338 #12348
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
30dbc19
replaced println with log Closes #12338
MrishoLukamba 5a6ca39
fixed println
MrishoLukamba 4817e5c
Merge branch 'master' into log
MrishoLukamba 3da3816
Apply suggestions from code review
shawntabrizi 8a393b6
Update utils/frame/benchmarking-cli/src/pallet/command.rs
shawntabrizi a2401ad
Apply suggestions from code review
shawntabrizi 997560a
".git/.scripts/fmt.sh" 1
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
replaced println with log Closes #12338
- Loading branch information
commit 30dbc1918732013e28a578e09bc98c2399e7461c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,10 @@ use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStorePtr}; | |
| use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; | ||
| use sp_state_machine::StateMachine; | ||
| use std::{collections::HashMap, fmt::Debug, fs, sync::Arc, time}; | ||
| use log; | ||
|
|
||
| /// Logging target | ||
| const LOG_TARGET:&'static str = "frame::benchmark::pallet"; | ||
|
|
||
| /// The inclusive range of a component. | ||
| #[derive(Serialize, Debug, Clone, Eq, PartialEq)] | ||
|
|
@@ -228,7 +232,7 @@ impl PalletCmd { | |
| let mut component_ranges = HashMap::<(Vec<u8>, Vec<u8>), Vec<ComponentRange>>::new(); | ||
|
|
||
| for (pallet, extrinsic, components) in benchmarks_to_run { | ||
| log::info!( | ||
| log::info!(target:LOG_TARGET, | ||
shawntabrizi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "Starting benchmark: {}::{}", | ||
| String::from_utf8(pallet.clone()).expect("Encoded from String; qed"), | ||
| String::from_utf8(extrinsic.clone()).expect("Encoded from String; qed"), | ||
|
|
@@ -376,7 +380,7 @@ impl PalletCmd { | |
| if let Ok(elapsed) = timer.elapsed() { | ||
| if elapsed >= time::Duration::from_secs(5) { | ||
| timer = time::SystemTime::now(); | ||
| log::info!( | ||
| log::info!(target:LOG_TARGET, | ||
shawntabrizi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "Running Benchmark: {}.{}({} args) {}/{} {}/{}", | ||
| String::from_utf8(pallet.clone()) | ||
| .expect("Encoded from String; qed"), | ||
|
|
@@ -422,7 +426,7 @@ impl PalletCmd { | |
| if let Some(path) = &self.json_file { | ||
| fs::write(path, json)?; | ||
| } else { | ||
| println!("{}", json); | ||
| log::info!(target:LOG_TARGET,"{}", json); | ||
shawntabrizi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return Ok(true) | ||
| } | ||
| } | ||
|
|
@@ -438,7 +442,7 @@ impl PalletCmd { | |
| ) { | ||
| for batch in batches.iter() { | ||
| // Print benchmark metadata | ||
| println!( | ||
| log::info!(target:LOG_TARGET, | ||
| "Pallet: {:?}, Extrinsic: {:?}, Lowest values: {:?}, Highest values: {:?}, Steps: {:?}, Repeat: {:?}", | ||
| String::from_utf8(batch.pallet.clone()).expect("Encoded from String; qed"), | ||
| String::from_utf8(batch.benchmark.clone()).expect("Encoded from String; qed"), | ||
|
|
@@ -456,51 +460,51 @@ impl PalletCmd { | |
| if !self.no_storage_info { | ||
| let mut comments: Vec<String> = Default::default(); | ||
| writer::add_storage_comments(&mut comments, &batch.db_results, storage_info); | ||
| println!("Raw Storage Info\n========"); | ||
| log::warn!(target:LOG_TARGET,"Raw Storage Info\n========"); | ||
| for comment in comments { | ||
| println!("{}", comment); | ||
| log::warn!(target:LOG_TARGET,"{}", comment); | ||
| } | ||
| println!(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think these should also be println, since it is part of a command flag to output this information |
||
| log::warn!(target:LOG_TARGET,""); | ||
| } | ||
|
|
||
| // Conduct analysis. | ||
| if !self.no_median_slopes { | ||
| println!("Median Slopes Analysis\n========"); | ||
| log::warn!(target:LOG_TARGET,"Median Slopes Analysis\n========"); | ||
| if let Some(analysis) = | ||
| Analysis::median_slopes(&batch.time_results, BenchmarkSelector::ExtrinsicTime) | ||
| { | ||
| println!("-- Extrinsic Time --\n{}", analysis); | ||
| log::warn!(target:LOG_TARGET,"-- Extrinsic Time --\n{}", analysis); | ||
| } | ||
| if let Some(analysis) = | ||
| Analysis::median_slopes(&batch.db_results, BenchmarkSelector::Reads) | ||
| { | ||
| println!("Reads = {:?}", analysis); | ||
| log::warn!(target:LOG_TARGET,"Reads = {:?}", analysis); | ||
| } | ||
| if let Some(analysis) = | ||
| Analysis::median_slopes(&batch.db_results, BenchmarkSelector::Writes) | ||
| { | ||
| println!("Writes = {:?}", analysis); | ||
| log::warn!(target:LOG_TARGET,"Writes = {:?}", analysis); | ||
| } | ||
| println!(); | ||
| log::warn!(target:LOG_TARGET,""); | ||
| } | ||
| if !self.no_min_squares { | ||
| println!("Min Squares Analysis\n========"); | ||
| log::warn!(target:LOG_TARGET,"Min Squares Analysis\n========"); | ||
| if let Some(analysis) = | ||
| Analysis::min_squares_iqr(&batch.time_results, BenchmarkSelector::ExtrinsicTime) | ||
| { | ||
| println!("-- Extrinsic Time --\n{}", analysis); | ||
| log::warn!(target:LOG_TARGET,"-- Extrinsic Time --\n{}", analysis); | ||
| } | ||
| if let Some(analysis) = | ||
| Analysis::min_squares_iqr(&batch.db_results, BenchmarkSelector::Reads) | ||
| { | ||
| println!("Reads = {:?}", analysis); | ||
| log::warn!(target:LOG_TARGET,"Reads = {:?}", analysis); | ||
|
||
| } | ||
| if let Some(analysis) = | ||
| Analysis::min_squares_iqr(&batch.db_results, BenchmarkSelector::Writes) | ||
| { | ||
| println!("Writes = {:?}", analysis); | ||
| log::warn!(target:LOG_TARGET,"Writes = {:?}", analysis); | ||
| } | ||
| println!(); | ||
| log::warn!(target:LOG_TARGET,""); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -521,8 +525,8 @@ impl CliConfiguration for PalletCmd { | |
|
|
||
| /// List the benchmarks available in the runtime, in a CSV friendly format. | ||
| fn list_benchmark(benchmarks_to_run: Vec<(Vec<u8>, Vec<u8>, Vec<(BenchmarkParameter, u32, u32)>)>) { | ||
| println!("pallet, benchmark"); | ||
| log::info!(target:LOG_TARGET,"pallet, benchmark"); | ||
| for (pallet, extrinsic, _components) in benchmarks_to_run { | ||
| println!("{}, {}", String::from_utf8_lossy(&pallet), String::from_utf8_lossy(&extrinsic)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should still be println since it is a command output |
||
| log::info!(target:LOG_TARGET,"{}, {}", String::from_utf8_lossy(&pallet), String::from_utf8_lossy(&extrinsic)); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.