@@ -43,11 +43,12 @@ pub struct Env {
4343 netns : Option < String > ,
4444 daemonize : bool ,
4545 seccomp_level : u32 ,
46- start_time_ms : u64 ,
46+ start_time_us : u64 ,
47+ start_time_cpu_us : u64 ,
4748}
4849
4950impl Env {
50- pub fn new ( args : ArgMatches , start_time_ms : u64 ) -> Result < Self > {
51+ pub fn new ( args : ArgMatches , start_time_us : u64 , start_time_cpu_us : u64 ) -> Result < Self > {
5152 // All arguments are either mandatory, or have default values, so the unwraps
5253 // should not fail.
5354 let id = args. value_of ( "id" ) . unwrap ( ) ;
@@ -117,7 +118,8 @@ impl Env {
117118 netns,
118119 daemonize,
119120 seccomp_level,
120- start_time_ms,
121+ start_time_us,
122+ start_time_cpu_us,
121123 } )
122124 }
123125
@@ -271,7 +273,8 @@ impl Env {
271273 id : self . id . clone ( ) ,
272274 jailed : true ,
273275 seccomp_level : self . seccomp_level ,
274- start_time_ms : self . start_time_ms ,
276+ start_time_us : self . start_time_us ,
277+ start_time_cpu_us : self . start_time_cpu_us ,
275278 } ;
276279
277280 Err ( Error :: Exec (
@@ -358,6 +361,7 @@ mod tests {
358361 true ,
359362 ) ,
360363 0 ,
364+ 0 ,
361365 ) . expect ( "This new environment should be created successfully." ) ;
362366
363367 let mut chroot_dir = PathBuf :: from ( chroot_base) ;
@@ -374,14 +378,16 @@ mod tests {
374378 let another_good_env = Env :: new (
375379 make_args ( node, id, exec_file, uid, gid, chroot_base, None , false ) ,
376380 0 ,
381+ 0 ,
377382 ) . expect ( "This another new environment should be created successfully." ) ;
378383 assert ! ( !another_good_env. daemonize) ;
379384
380385 // Not fine - invalid node.
381386 assert ! (
382387 Env :: new(
383388 make_args( "zzz" , id, exec_file, uid, gid, chroot_base, None , true ) ,
384- 0
389+ 0 ,
390+ 0 ,
385391 ) . is_err( )
386392 ) ;
387393
@@ -398,6 +404,7 @@ mod tests {
398404 None ,
399405 true
400406 ) ,
407+ 0 ,
401408 0
402409 ) . is_err( )
403410 ) ;
@@ -415,6 +422,7 @@ mod tests {
415422 None ,
416423 true
417424 ) ,
425+ 0 ,
418426 0
419427 ) . is_err( )
420428 ) ;
@@ -423,6 +431,7 @@ mod tests {
423431 assert ! (
424432 Env :: new(
425433 make_args( node, id, exec_file, "zzz" , gid, chroot_base, None , true ) ,
434+ 0 ,
426435 0
427436 ) . is_err( )
428437 ) ;
@@ -431,6 +440,7 @@ mod tests {
431440 assert ! (
432441 Env :: new(
433442 make_args( node, id, exec_file, uid, "zzz" , chroot_base, None , true ) ,
443+ 0 ,
434444 0
435445 ) . is_err( )
436446 ) ;
0 commit comments