Move time out of extra (cc #8784)

This commit is contained in:
Arcterus 2014-02-19 19:08:12 -08:00
parent 2fa7d6b44f
commit 66f93291ec
23 changed files with 54 additions and 43 deletions

View File

@ -7,6 +7,7 @@ Adrien Tétar <adri-from-59@hotmail.fr>
Alan Andrade <alan.andradec@gmail.com>
Aleksander Balicki <balicki.aleksander@gmail.com>
Alex Crichton <alex@alexcrichton.com>
Alex Lyon <arcterus@mail.com>
Alex Rønne Petersen <alex@lycus.org>
Alexander Stavonin <a.stavonin@gmail.com>
Alexandros Tasos <sdi1100085@di.uoa.gr>

View File

@ -50,21 +50,21 @@
################################################################################
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test
uuid serialize sync getopts collections num test time
HOST_CRATES := syntax rustc rustdoc fourcc
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc
DEPS_std := native:rustrt native:compiler-rt
DEPS_extra := std term sync serialize getopts collections
DEPS_extra := std term sync serialize getopts collections time
DEPS_green := std native:context_switch
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
DEPS_syntax := std term serialize collections
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections extra
collections time extra
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
test
test time
DEPS_flate := std native:miniz
DEPS_arena := std collections
DEPS_glob := std
@ -78,6 +78,7 @@ DEPS_collections := std serialize
DEPS_fourcc := syntax std
DEPS_num := std extra
DEPS_test := std extra collections getopts serialize term
DEPS_time := std serialize
TOOL_DEPS_compiletest := test green rustuv getopts
TOOL_DEPS_rustdoc := rustdoc green rustuv

View File

@ -875,14 +875,14 @@ An example of what will and will not work for `use` items:
~~~~
# #[allow(unused_imports)];
use foo::extra; // good: foo is at the root of the crate
use foo::extra::json; // good: foo is at the root of the crate
use foo::baz::foobaz; // good: foo is at the root of the crate
mod foo {
extern crate extra;
use foo::extra::time; // good: foo is at crate root
// use extra::*; // bad: extra is not at the crate root
use foo::extra::json; // good: foo is at crate root
// use extra::json::*; // bad: extra is not at the crate root
use self::baz::foobaz; // good: self refers to module 'foo'
use foo::bar::foobar; // good: foo is at crate root

View File

@ -37,13 +37,13 @@ Rust extras are part of the standard Rust distribution.
extern crate sync;
extern crate serialize;
extern crate collections;
extern crate time;
// Utility modules
pub mod c_vec;
pub mod url;
pub mod json;
pub mod tempfile;
pub mod time;
pub mod workcache;
pub mod stats;

View File

@ -39,6 +39,7 @@ extern crate serialize;
extern crate sync;
extern crate getopts;
extern crate collections;
extern crate time;
use back::link;
use driver::session;

View File

@ -32,7 +32,9 @@ use std::io;
use std::os::consts::{macos, freebsd, linux, android, win32};
use std::str;
use std::vec;
use flate;
use time;
pub enum Os {
OsMacos,
@ -361,7 +363,6 @@ impl ArchiveMetadata {
// Just a small wrapper to time how long reading metadata takes.
fn get_metadata_section(os: Os, filename: &Path) -> Option<MetadataBlob> {
use extra::time;
let start = time::precise_time_ns();
let ret = get_metadata_section_imp(os, filename);
info!("reading {} => {}ms", filename.filename_display(),

View File

@ -72,7 +72,6 @@ use util::ppaux::{Repr, ty_to_str};
use util::sha2::Sha256;
use arena::TypedArena;
use extra::time;
use std::c_str::ToCStr;
use std::cell::{Cell, RefCell};
use std::hashmap::HashMap;
@ -90,6 +89,8 @@ use syntax::visit::Visitor;
use syntax::visit;
use syntax::{ast, ast_util, ast_map};
use time;
pub use middle::trans::context::task_llcx;
local_data_key!(task_local_insn_key: ~[&'static str])

View File

@ -16,7 +16,8 @@ use syntax::visit;
use syntax::visit::Visitor;
use std::local_data;
use extra::time;
use time;
pub fn time<T, U>(do_it: bool, what: &str, u: U, f: |U| -> T) -> T {
local_data_key!(depth: uint);

View File

@ -24,6 +24,7 @@ extern crate sync;
extern crate getopts;
extern crate collections;
extern crate testing = "test";
extern crate time;
use std::local_data;
use std::io;
@ -31,7 +32,6 @@ use std::io::{File, MemWriter};
use std::str;
use extra::json;
use serialize::{Decodable, Encodable};
use extra::time;
pub mod clean;
pub mod core;

View File

@ -26,13 +26,14 @@ extern crate extra;
extern crate getopts;
extern crate serialize;
extern crate term;
extern crate time;
use collections::TreeMap;
use extra::json::ToJson;
use extra::json;
use extra::stats::Stats;
use extra::stats;
use extra::time::precise_time_ns;
use time::precise_time_ns;
use getopts::{OptGroup, optflag, optopt};
use serialize::Decodable;
use term::Terminal;

View File

@ -8,8 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[crate_id = "time#0.10-pre"];
#[crate_type = "rlib"];
#[crate_type = "dylib"];
#[license = "MIT/ASL2"];
#[allow(missing_doc)];
extern crate serialize;
use std::io::BufReader;
use std::libc;
use std::num;
@ -1035,7 +1042,8 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str {
#[cfg(test)]
mod tests {
use super::*;
use super::{Timespec, get_time, precise_time_ns, precise_time_s, tzset,
at_utc, at, strptime};
use std::f64;
use std::result::{Err, Ok};

@ -1 +1 @@
Subproject commit b015ecddd3129490fa26e5278a1acee79f2ee5ef
Subproject commit f5f1ffea207b6b380127ff34f14015ae005d1413

View File

@ -8,10 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
extern crate collections;
extern crate time;
use extra::time;
use collections::TreeMap;
use std::hashmap::{HashMap, HashSet};
use std::os;

View File

@ -10,8 +10,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate extra;
extern crate collections;
extern crate time;
use collections::bitv::BitvSet;
use collections::TreeSet;
@ -31,9 +31,9 @@ struct Results {
}
fn timed(result: &mut f64, op: ||) {
let start = extra::time::precise_time_s();
let start = time::precise_time_s();
op();
let end = extra::time::precise_time_s();
let end = time::precise_time_s();
*result = (end - start);
}
@ -191,13 +191,13 @@ fn main() {
let s: TreeSet<~str> = TreeSet::new();
s
});
write_results("extra::treemap::TreeSet", &results);
write_results("collections::TreeSet", &results);
}
{
let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed);
let mut results = empty_results();
results.bench_int(&mut rng, num_keys, max, || BitvSet::new());
write_results("extra::bitv::BitvSet", &results);
write_results("collections::bitv::BitvSet", &results);
}
}

View File

@ -12,9 +12,9 @@
#[feature(macro_rules)];
extern crate extra;
extern crate time;
use extra::time::precise_time_s;
use time::precise_time_s;
use std::mem::swap;
use std::os;
use std::rand::Rng;

View File

@ -18,7 +18,7 @@
// different scalability characteristics compared to the select
// version.
extern crate extra;
extern crate time;
use std::comm;
use std::os;
@ -58,7 +58,7 @@ fn run(args: &[~str]) {
let size = from_str::<uint>(args[1]).unwrap();
let workers = from_str::<uint>(args[2]).unwrap();
let num_bytes = 100;
let start = extra::time::precise_time_s();
let start = time::precise_time_s();
let mut worker_results = ~[];
for _ in range(0u, workers) {
let to_child = to_child.clone();
@ -84,7 +84,7 @@ fn run(args: &[~str]) {
to_child.send(stop);
move_out(to_child);
let result = from_child.recv();
let end = extra::time::precise_time_s();
let end = time::precise_time_s();
let elapsed = end - start;
print!("Count is {:?}\n", result);
print!("Test took {:?} seconds\n", elapsed);

View File

@ -14,7 +14,7 @@
//
// I *think* it's the same, more or less.
extern crate extra;
extern crate time;
use std::os;
use std::task;
@ -52,7 +52,7 @@ fn run(args: &[~str]) {
let size = from_str::<uint>(args[1]).unwrap();
let workers = from_str::<uint>(args[2]).unwrap();
let num_bytes = 100;
let start = extra::time::precise_time_s();
let start = time::precise_time_s();
let mut worker_results = ~[];
let from_parent = if workers == 1 {
let (from_parent, to_child) = Chan::new();
@ -94,7 +94,7 @@ fn run(args: &[~str]) {
//to_child.send(stop);
//move_out(to_child);
let result = from_child.recv();
let end = extra::time::precise_time_s();
let end = time::precise_time_s();
let elapsed = end - start;
print!("Count is {:?}\n", result);
print!("Test took {:?} seconds\n", elapsed);

View File

@ -15,13 +15,12 @@
// This also serves as a pipes test, because Arcs are implemented with pipes.
extern crate extra;
extern crate sync;
extern crate time;
use sync::Arc;
use sync::MutexArc;
use sync::Future;
use extra::time;
use std::os;
use std::uint;

View File

@ -15,12 +15,11 @@
// This also serves as a pipes test, because Arcs are implemented with pipes.
extern crate extra;
extern crate sync;
extern crate time;
use sync::RWArc;
use sync::Future;
use extra::time;
use std::os;
use std::uint;

View File

@ -18,10 +18,9 @@
*/
extern crate extra;
extern crate getopts;
extern crate time;
use extra::time;
use std::os;
use std::result::{Ok, Err};
use std::task;

View File

@ -10,8 +10,8 @@
// Microbenchmark for the smallintmap library
extern crate extra;
extern crate collections;
extern crate time;
use collections::SmallIntMap;
use std::os;
@ -46,11 +46,11 @@ fn main() {
for _ in range(0u, rep) {
let mut map = SmallIntMap::new();
let start = extra::time::precise_time_s();
let start = time::precise_time_s();
append_sequential(0u, max, &mut map);
let mid = extra::time::precise_time_s();
let mid = time::precise_time_s();
check_sequential(0u, max, &map);
let end = extra::time::precise_time_s();
let end = time::precise_time_s();
checkf += (end - mid) as f64;
appendf += (mid - start) as f64;

View File

@ -10,11 +10,11 @@
#[feature(managed_boxes)];
extern crate extra;
extern crate collections;
extern crate time;
use collections::list::{List, Cons, Nil};
use extra::time::precise_time_s;
use time::precise_time_s;
use std::os;
use std::task;

View File

@ -14,6 +14,7 @@
#[feature(managed_boxes)];
extern crate extra;
extern crate time;
// These tests used to be separate files, but I wanted to refactor all
// the common code.
@ -26,7 +27,6 @@ use std::cmp::Eq;
use std::cmp;
use std::io;
use serialize::{Decodable, Encodable};
use extra::time;
fn test_ebml<'a, A:
Eq +