Skip to content

Commit 66f9329

Browse files
committed
Move time out of extra (cc #8784)
1 parent 2fa7d6b commit 66f9329

23 files changed

+54
-43
lines changed

AUTHORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Adrien Tétar <[email protected]>
77
Alan Andrade <[email protected]>
88
Aleksander Balicki <[email protected]>
99
Alex Crichton <[email protected]>
10+
Alex Lyon <[email protected]>
1011
Alex Rønne Petersen <[email protected]>
1112
Alexander Stavonin <[email protected]>
1213
Alexandros Tasos <[email protected]>

mk/crates.mk

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@
5050
################################################################################
5151

5252
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53-
uuid serialize sync getopts collections num test
53+
uuid serialize sync getopts collections num test time
5454
HOST_CRATES := syntax rustc rustdoc fourcc
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
5757

5858
DEPS_std := native:rustrt native:compiler-rt
59-
DEPS_extra := std term sync serialize getopts collections
59+
DEPS_extra := std term sync serialize getopts collections time
6060
DEPS_green := std native:context_switch
6161
DEPS_rustuv := std native:uv native:uv_support
6262
DEPS_native := std
6363
DEPS_syntax := std term serialize collections
6464
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
65-
collections extra
65+
collections time extra
6666
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
67-
test
67+
test time
6868
DEPS_flate := std native:miniz
6969
DEPS_arena := std collections
7070
DEPS_glob := std
@@ -78,6 +78,7 @@ DEPS_collections := std serialize
7878
DEPS_fourcc := syntax std
7979
DEPS_num := std extra
8080
DEPS_test := std extra collections getopts serialize term
81+
DEPS_time := std serialize
8182

8283
TOOL_DEPS_compiletest := test green rustuv getopts
8384
TOOL_DEPS_rustdoc := rustdoc green rustuv

src/doc/rust.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -875,14 +875,14 @@ An example of what will and will not work for `use` items:
875875

876876
~~~~
877877
# #[allow(unused_imports)];
878-
use foo::extra; // good: foo is at the root of the crate
878+
use foo::extra::json; // good: foo is at the root of the crate
879879
use foo::baz::foobaz; // good: foo is at the root of the crate
880880
881881
mod foo {
882882
extern crate extra;
883883
884-
use foo::extra::time; // good: foo is at crate root
885-
// use extra::*; // bad: extra is not at the crate root
884+
use foo::extra::json; // good: foo is at crate root
885+
// use extra::json::*; // bad: extra is not at the crate root
886886
use self::baz::foobaz; // good: self refers to module 'foo'
887887
use foo::bar::foobar; // good: foo is at crate root
888888

src/libextra/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ Rust extras are part of the standard Rust distribution.
3737
extern crate sync;
3838
extern crate serialize;
3939
extern crate collections;
40+
extern crate time;
4041

4142
// Utility modules
4243
pub mod c_vec;
4344
pub mod url;
4445
pub mod json;
4546
pub mod tempfile;
46-
pub mod time;
4747
pub mod workcache;
4848
pub mod stats;
4949

src/librustc/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern crate serialize;
3939
extern crate sync;
4040
extern crate getopts;
4141
extern crate collections;
42+
extern crate time;
4243

4344
use back::link;
4445
use driver::session;

src/librustc/metadata/loader.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ use std::io;
3232
use std::os::consts::{macos, freebsd, linux, android, win32};
3333
use std::str;
3434
use std::vec;
35+
3536
use flate;
37+
use time;
3638

3739
pub enum Os {
3840
OsMacos,
@@ -361,7 +363,6 @@ impl ArchiveMetadata {
361363

362364
// Just a small wrapper to time how long reading metadata takes.
363365
fn get_metadata_section(os: Os, filename: &Path) -> Option<MetadataBlob> {
364-
use extra::time;
365366
let start = time::precise_time_ns();
366367
let ret = get_metadata_section_imp(os, filename);
367368
info!("reading {} => {}ms", filename.filename_display(),

src/librustc/middle/trans/base.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ use util::ppaux::{Repr, ty_to_str};
7272
use util::sha2::Sha256;
7373

7474
use arena::TypedArena;
75-
use extra::time;
7675
use std::c_str::ToCStr;
7776
use std::cell::{Cell, RefCell};
7877
use std::hashmap::HashMap;
@@ -90,6 +89,8 @@ use syntax::visit::Visitor;
9089
use syntax::visit;
9190
use syntax::{ast, ast_util, ast_map};
9291

92+
use time;
93+
9394
pub use middle::trans::context::task_llcx;
9495

9596
local_data_key!(task_local_insn_key: ~[&'static str])

src/librustc/util/common.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ use syntax::visit;
1616
use syntax::visit::Visitor;
1717

1818
use std::local_data;
19-
use extra::time;
19+
20+
use time;
2021

2122
pub fn time<T, U>(do_it: bool, what: &str, u: U, f: |U| -> T) -> T {
2223
local_data_key!(depth: uint);

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ extern crate sync;
2424
extern crate getopts;
2525
extern crate collections;
2626
extern crate testing = "test";
27+
extern crate time;
2728

2829
use std::local_data;
2930
use std::io;
3031
use std::io::{File, MemWriter};
3132
use std::str;
3233
use extra::json;
3334
use serialize::{Decodable, Encodable};
34-
use extra::time;
3535

3636
pub mod clean;
3737
pub mod core;

src/libtest/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ extern crate extra;
2626
extern crate getopts;
2727
extern crate serialize;
2828
extern crate term;
29+
extern crate time;
2930

3031
use collections::TreeMap;
3132
use extra::json::ToJson;
3233
use extra::json;
3334
use extra::stats::Stats;
3435
use extra::stats;
35-
use extra::time::precise_time_ns;
36+
use time::precise_time_ns;
3637
use getopts::{OptGroup, optflag, optopt};
3738
use serialize::Decodable;
3839
use term::Terminal;

src/libextra/time.rs renamed to src/libtime/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[crate_id = "time#0.10-pre"];
12+
#[crate_type = "rlib"];
13+
#[crate_type = "dylib"];
14+
#[license = "MIT/ASL2"];
15+
1116
#[allow(missing_doc)];
1217

18+
extern crate serialize;
19+
1320
use std::io::BufReader;
1421
use std::libc;
1522
use std::num;
@@ -1035,7 +1042,8 @@ pub fn strftime(format: &str, tm: &Tm) -> ~str {
10351042
10361043
#[cfg(test)]
10371044
mod tests {
1038-
use super::*;
1045+
use super::{Timespec, get_time, precise_time_ns, precise_time_s, tzset,
1046+
at_utc, at, strptime};
10391047
10401048
use std::f64;
10411049
use std::result::{Err, Ok};

src/test/bench/core-map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
extern crate extra;
1211
extern crate collections;
12+
extern crate time;
1313

14-
use extra::time;
1514
use collections::TreeMap;
1615
use std::hashmap::{HashMap, HashSet};
1716
use std::os;

src/test/bench/core-set.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
// option. This file may not be copied, modified, or distributed
1111
// except according to those terms.
1212

13-
extern crate extra;
1413
extern crate collections;
14+
extern crate time;
1515

1616
use collections::bitv::BitvSet;
1717
use collections::TreeSet;
@@ -31,9 +31,9 @@ struct Results {
3131
}
3232

3333
fn timed(result: &mut f64, op: ||) {
34-
let start = extra::time::precise_time_s();
34+
let start = time::precise_time_s();
3535
op();
36-
let end = extra::time::precise_time_s();
36+
let end = time::precise_time_s();
3737
*result = (end - start);
3838
}
3939

@@ -191,13 +191,13 @@ fn main() {
191191
let s: TreeSet<~str> = TreeSet::new();
192192
s
193193
});
194-
write_results("extra::treemap::TreeSet", &results);
194+
write_results("collections::TreeSet", &results);
195195
}
196196

197197
{
198198
let mut rng: rand::IsaacRng = rand::SeedableRng::from_seed(seed);
199199
let mut results = empty_results();
200200
results.bench_int(&mut rng, num_keys, max, || BitvSet::new());
201-
write_results("extra::bitv::BitvSet", &results);
201+
write_results("collections::bitv::BitvSet", &results);
202202
}
203203
}

src/test/bench/core-std.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
#[feature(macro_rules)];
1414

15-
extern crate extra;
15+
extern crate time;
1616

17-
use extra::time::precise_time_s;
17+
use time::precise_time_s;
1818
use std::mem::swap;
1919
use std::os;
2020
use std::rand::Rng;

src/test/bench/msgsend-pipes-shared.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// different scalability characteristics compared to the select
1919
// version.
2020

21-
extern crate extra;
21+
extern crate time;
2222

2323
use std::comm;
2424
use std::os;
@@ -58,7 +58,7 @@ fn run(args: &[~str]) {
5858
let size = from_str::<uint>(args[1]).unwrap();
5959
let workers = from_str::<uint>(args[2]).unwrap();
6060
let num_bytes = 100;
61-
let start = extra::time::precise_time_s();
61+
let start = time::precise_time_s();
6262
let mut worker_results = ~[];
6363
for _ in range(0u, workers) {
6464
let to_child = to_child.clone();
@@ -84,7 +84,7 @@ fn run(args: &[~str]) {
8484
to_child.send(stop);
8585
move_out(to_child);
8686
let result = from_child.recv();
87-
let end = extra::time::precise_time_s();
87+
let end = time::precise_time_s();
8888
let elapsed = end - start;
8989
print!("Count is {:?}\n", result);
9090
print!("Test took {:?} seconds\n", elapsed);

src/test/bench/msgsend-pipes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
// I *think* it's the same, more or less.
1616

17-
extern crate extra;
17+
extern crate time;
1818

1919
use std::os;
2020
use std::task;
@@ -52,7 +52,7 @@ fn run(args: &[~str]) {
5252
let size = from_str::<uint>(args[1]).unwrap();
5353
let workers = from_str::<uint>(args[2]).unwrap();
5454
let num_bytes = 100;
55-
let start = extra::time::precise_time_s();
55+
let start = time::precise_time_s();
5656
let mut worker_results = ~[];
5757
let from_parent = if workers == 1 {
5858
let (from_parent, to_child) = Chan::new();
@@ -94,7 +94,7 @@ fn run(args: &[~str]) {
9494
//to_child.send(stop);
9595
//move_out(to_child);
9696
let result = from_child.recv();
97-
let end = extra::time::precise_time_s();
97+
let end = time::precise_time_s();
9898
let elapsed = end - start;
9999
print!("Count is {:?}\n", result);
100100
print!("Test took {:?} seconds\n", elapsed);

src/test/bench/msgsend-ring-mutex-arcs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515

1616
// This also serves as a pipes test, because Arcs are implemented with pipes.
1717

18-
extern crate extra;
1918
extern crate sync;
19+
extern crate time;
2020

2121
use sync::Arc;
2222
use sync::MutexArc;
2323
use sync::Future;
24-
use extra::time;
2524
use std::os;
2625
use std::uint;
2726

src/test/bench/msgsend-ring-rw-arcs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515

1616
// This also serves as a pipes test, because Arcs are implemented with pipes.
1717

18-
extern crate extra;
1918
extern crate sync;
19+
extern crate time;
2020

2121
use sync::RWArc;
2222
use sync::Future;
23-
use extra::time;
2423
use std::os;
2524
use std::uint;
2625

src/test/bench/shootout-pfib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
1919
*/
2020

21-
extern crate extra;
2221
extern crate getopts;
22+
extern crate time;
2323

24-
use extra::time;
2524
use std::os;
2625
use std::result::{Ok, Err};
2726
use std::task;

src/test/bench/std-smallintmap.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
// Microbenchmark for the smallintmap library
1212

13-
extern crate extra;
1413
extern crate collections;
14+
extern crate time;
1515

1616
use collections::SmallIntMap;
1717
use std::os;
@@ -46,11 +46,11 @@ fn main() {
4646

4747
for _ in range(0u, rep) {
4848
let mut map = SmallIntMap::new();
49-
let start = extra::time::precise_time_s();
49+
let start = time::precise_time_s();
5050
append_sequential(0u, max, &mut map);
51-
let mid = extra::time::precise_time_s();
51+
let mid = time::precise_time_s();
5252
check_sequential(0u, max, &map);
53-
let end = extra::time::precise_time_s();
53+
let end = time::precise_time_s();
5454

5555
checkf += (end - mid) as f64;
5656
appendf += (mid - start) as f64;

src/test/bench/task-perf-alloc-unwind.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
#[feature(managed_boxes)];
1212

13-
extern crate extra;
1413
extern crate collections;
14+
extern crate time;
1515

1616
use collections::list::{List, Cons, Nil};
17-
use extra::time::precise_time_s;
17+
use time::precise_time_s;
1818
use std::os;
1919
use std::task;
2020

0 commit comments

Comments
 (0)