mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-25 15:04:33 +00:00
Make log_fn_time a method
This commit is contained in:
parent
b4b2cbb299
commit
66d8e8b481
@ -138,13 +138,6 @@ fn fcx_has_nonzero_span(fcx: fn_ctxt) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_fn_time(ccx: @mut CrateContext, name: ~str, start: time::Timespec,
|
||||
end: time::Timespec) {
|
||||
let elapsed = 1000 * ((end.sec - start.sec) as int) +
|
||||
((end.nsec as int) - (start.nsec as int)) / 1000000;
|
||||
ccx.stats.fn_times.push((name, elapsed));
|
||||
}
|
||||
|
||||
pub fn decl_fn(llmod: ModuleRef,
|
||||
name: &str,
|
||||
cc: lib::llvm::CallConv,
|
||||
@ -1962,7 +1955,7 @@ pub fn trans_fn(ccx: @mut CrateContext,
|
||||
|_bcx| { });
|
||||
if do_time {
|
||||
let end = time::get_time();
|
||||
log_fn_time(ccx, the_path_str, start, end);
|
||||
ccx.log_fn_time(the_path_str, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3130,11 +3123,6 @@ pub fn trans_crate(sess: session::Session,
|
||||
io::println(fmt!("n_closures: %u", ccx.stats.n_closures));
|
||||
}
|
||||
|
||||
if ccx.sess.count_llvm_insns() {
|
||||
for ccx.stats.llvm_insns.each |&k, &v| {
|
||||
io::println(fmt!("%-7u %s", v, k));
|
||||
}
|
||||
}
|
||||
let llcx = ccx.llcx;
|
||||
let link_meta = ccx.link_meta;
|
||||
let llmod = ccx.llmod;
|
||||
|
@ -31,6 +31,7 @@ use core::hash;
|
||||
use core::hashmap::{HashMap, HashSet};
|
||||
use core::str;
|
||||
use core::local_data;
|
||||
use extra::time;
|
||||
use syntax::ast;
|
||||
|
||||
use middle::trans::common::{ExternMap,tydesc_info,BuilderRef_res,Stats,namegen,addrspace_gen};
|
||||
@ -222,6 +223,12 @@ impl CrateContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_fn_time(&mut self, name: ~str, start: time::Timespec, end: time::Timespec) {
|
||||
let elapsed = 1000 * ((end.sec - start.sec) as int) +
|
||||
((end.nsec as int) - (start.nsec as int)) / 1000000;
|
||||
self.stats.fn_times.push((name, elapsed));
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
|
@ -731,10 +731,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
|
||||
let start = time::get_time();
|
||||
let llval = make_generic_glue_inner(ccx, t, llfn, helper);
|
||||
let end = time::get_time();
|
||||
log_fn_time(ccx,
|
||||
fmt!("glue %s %s", name, ty_to_short_str(ccx.tcx, t)),
|
||||
start,
|
||||
end);
|
||||
ccx.log_fn_time(fmt!("glue %s %s", name, ty_to_short_str(ccx.tcx, t)), start, end);
|
||||
return llval;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user