Merge #1068
1068: profiling crate first draft r=matklad a=pasa I've made this first draft for #961 Could you look at it? Is this something what you are looking for? It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues? Additionally I'm thinking about to implement procedural macros to annotate methods with this profiler. Will it be helpful? Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
mod analysis_stats;
|
||||
|
||||
use std::{fs, io::Read, path::Path, time::Instant};
|
||||
use std::{fs, io::Read, path::Path};
|
||||
|
||||
use clap::{App, Arg, SubCommand};
|
||||
use ra_ide_api::file_structure;
|
||||
use ra_syntax::{SourceFile, TreeArc, AstNode};
|
||||
use tools::collect_tests;
|
||||
use flexi_logger::Logger;
|
||||
use ra_prof::profile;
|
||||
|
||||
type Result<T> = ::std::result::Result<T, failure::Error>;
|
||||
|
||||
@@ -27,13 +28,11 @@ fn main() -> Result<()> {
|
||||
.get_matches();
|
||||
match matches.subcommand() {
|
||||
("parse", Some(matches)) => {
|
||||
let start = Instant::now();
|
||||
let _p = profile("parsing");
|
||||
let file = file()?;
|
||||
let elapsed = start.elapsed();
|
||||
if !matches.is_present("no-dump") {
|
||||
println!("{}", file.syntax().debug_dump());
|
||||
}
|
||||
eprintln!("parsing: {:?}", elapsed);
|
||||
::std::mem::forget(file);
|
||||
}
|
||||
("symbols", _) => {
|
||||
|
||||
Reference in New Issue
Block a user