pub struct TimeStamp {
pub amount: f64,
}
Fields§
§amount: f64
Implementations§
Source§impl TimeStamp
impl TimeStamp
Sourcepub fn new(amount: f64) -> Self
pub fn new(amount: f64) -> Self
Examples found in repository?
examples/perf.rs (line 25)
15fn insertions(db: &mut TsDb) {
16 let num_insertions = 1_000_000;
17 println!(
18 "Created database, now inserting {} data points into a signal.",
19 num_insertions
20 );
21
22 db.new_trace("fu");
23 let t1 = Instant::now();
24 for i in 0..num_insertions {
25 let ts = TimeStamp::new(i as f64);
26 let sample = Sample::new(i as f64);
27 let observation = Observation::new(ts, sample);
28 db.add_value("fu", observation);
29 }
30 let t2 = Instant::now();
31 let time_delta = t2 - t1;
32 let time_delta = time_delta.as_secs_f64();
33
34 println!(
35 "Inserted {} points in {} seconds.",
36 num_insertions, time_delta
37 );
38 let rate = num_insertions as f64 / time_delta;
39 println!("That means {} mega-points per second.", rate / 1.0e6);
40}
41
42fn do_query(db: &TsDb) {
43 // Query the data
44 println!("Querying the database!");
45
46 let query = Query::create()
47 .start(TimeStamp::new(0.0))
48 .end(TimeStamp::new(1000.0))
49 .build();
50 let result = db.query("fu", query);
51
52 println!("Got result: {:?}", result.query);
53 println!("Num result: {:?}", result.len());
54 // let raw_samples = result.into_vec();
55 // println!("Raw samples: {}", raw_samples.len());
56}
pub fn from_seconds(seconds: isize) -> Self
Trait Implementations§
Source§impl PartialOrd for TimeStamp
impl PartialOrd for TimeStamp
Source§impl TimeModifiers for TimeStamp
impl TimeModifiers for TimeStamp
impl StructuralPartialEq for TimeStamp
Auto Trait Implementations§
impl Freeze for TimeStamp
impl RefUnwindSafe for TimeStamp
impl Send for TimeStamp
impl Sync for TimeStamp
impl Unpin for TimeStamp
impl UnwindSafe for TimeStamp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more