File tree 2 files changed +11
-3
lines changed
lading/src/generator/file_gen
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,11 @@ impl Server {
113
113
& config. variant ,
114
114
) ?;
115
115
116
+ let start_time = std:: time:: Instant :: now ( ) ;
117
+ let start_time_system = std:: time:: SystemTime :: now ( ) ;
116
118
let state = model:: State :: new (
117
119
& mut rng,
120
+ start_time. elapsed ( ) . as_secs ( ) ,
118
121
config. bytes_per_second . get_bytes ( ) as u64 ,
119
122
config. total_rotations ,
120
123
config. maximum_bytes_per_log . get_bytes ( ) as u64 ,
@@ -131,8 +134,8 @@ impl Server {
131
134
let fs = LogrotateFS {
132
135
state : Arc :: new ( Mutex :: new ( state) ) ,
133
136
open_files : Arc :: new ( Mutex :: new ( HashMap :: new ( ) ) ) ,
134
- start_time : std :: time :: Instant :: now ( ) ,
135
- start_time_system : std :: time :: SystemTime :: now ( ) ,
137
+ start_time,
138
+ start_time_system,
136
139
} ;
137
140
138
141
let options = vec ! [
Original file line number Diff line number Diff line change @@ -347,8 +347,10 @@ pub(crate) enum NodeType {
347
347
impl State {
348
348
/// Create a new instance of `State`.
349
349
#[ tracing:: instrument( skip( rng, block_cache) ) ]
350
+ #[ allow( clippy:: too_many_arguments) ]
350
351
pub ( crate ) fn new < R > (
351
352
rng : & mut R ,
353
+ initial_tick : Tick ,
352
354
bytes_per_tick : u64 ,
353
355
max_rotations : u8 ,
354
356
max_bytes_per_file : u64 ,
@@ -374,7 +376,7 @@ impl State {
374
376
let mut state = State {
375
377
nodes,
376
378
root_inode,
377
- now : 0 ,
379
+ now : initial_tick ,
378
380
block_cache,
379
381
max_bytes_per_file,
380
382
max_rotations,
@@ -955,6 +957,7 @@ mod test {
955
957
1024u64 ..=500_000u64 , // max_bytes_per_file
956
958
1u8 ..=4u8 , // max_depth
957
959
1u16 ..=16u16 , // concurrent_logs
960
+ 1u64 ..=1000u64 , // initial_tick
958
961
)
959
962
. prop_map (
960
963
|(
@@ -964,6 +967,7 @@ mod test {
964
967
max_bytes_per_file,
965
968
max_depth,
966
969
concurrent_logs,
970
+ initial_tick,
967
971
) | {
968
972
let mut rng = StdRng :: seed_from_u64 ( seed) ;
969
973
let block_cache = block:: Cache :: fixed (
@@ -976,6 +980,7 @@ mod test {
976
980
977
981
State :: new (
978
982
& mut rng,
983
+ initial_tick,
979
984
bytes_per_tick,
980
985
max_rotations,
981
986
max_bytes_per_file,
You can’t perform that action at this time.
0 commit comments