@@ -16,12 +16,13 @@ pub use micro_http::{Body, HttpServer, Request, Response, ServerError, StatusCod
1616use parsed_request:: { ParsedRequest , RequestAction } ;
1717use seccompiler:: BpfProgramRef ;
1818use serde_json:: json;
19- use utils:: eventfd :: EventFd ;
19+ use utils:: time :: { get_time_us , ClockType } ;
2020use vmm:: logger:: {
2121 debug, error, info, update_metric_with_elapsed_time, warn, ProcessTimeReporter , METRICS ,
2222} ;
2323use vmm:: rpc_interface:: { ApiRequest , ApiResponse , VmmAction } ;
2424use vmm:: vmm_config:: snapshot:: SnapshotType ;
25+ use vmm_sys_util:: eventfd:: EventFd ;
2526
2627/// Structure associated with the API server implementation.
2728#[ derive( Debug ) ]
@@ -101,17 +102,15 @@ impl ApiServer {
101102 }
102103 } ;
103104 for server_request in request_vec {
104- let request_processing_start_us =
105- utils:: time:: get_time_us ( utils:: time:: ClockType :: Monotonic ) ;
105+ let request_processing_start_us = get_time_us ( ClockType :: Monotonic ) ;
106106 // Use `self.handle_request()` as the processing callback.
107107 let response = server_request
108108 . process ( |request| self . handle_request ( request, request_processing_start_us) ) ;
109109 if let Err ( err) = server. respond ( response) {
110110 error ! ( "API Server encountered an error on response: {}" , err) ;
111111 } ;
112112
113- let delta_us = utils:: time:: get_time_us ( utils:: time:: ClockType :: Monotonic )
114- - request_processing_start_us;
113+ let delta_us = get_time_us ( ClockType :: Monotonic ) - request_processing_start_us;
115114 debug ! ( "Total previous API call duration: {} us." , delta_us) ;
116115 }
117116 }
@@ -205,14 +204,14 @@ mod tests {
205204 use std:: thread;
206205
207206 use micro_http:: HttpConnection ;
208- use utils:: tempfile:: TempFile ;
209207 use utils:: time:: ClockType ;
210208 use vmm:: builder:: StartMicrovmError ;
211209 use vmm:: logger:: StoreMetric ;
212210 use vmm:: rpc_interface:: { VmmActionError , VmmData } ;
213211 use vmm:: seccomp_filters:: get_empty_filters;
214212 use vmm:: vmm_config:: instance_info:: InstanceInfo ;
215213 use vmm:: vmm_config:: snapshot:: CreateSnapshotParams ;
214+ use vmm_sys_util:: tempfile:: TempFile ;
216215
217216 use super :: request:: cpu_configuration:: parse_put_cpu_config;
218217 use super :: * ;
@@ -259,7 +258,7 @@ mod tests {
259258 // latencies_us.pause_vm metric can be set to 0, failing the assertion below. By
260259 // subtracting 1 we assure that the metric will always be set to at least 1 (if it gets set
261260 // at all, which is what this test is trying to prove).
262- let start_time_us = utils :: time :: get_time_us ( ClockType :: Monotonic ) - 1 ;
261+ let start_time_us = get_time_us ( ClockType :: Monotonic ) - 1 ;
263262 assert_eq ! ( METRICS . latencies_us. pause_vm. fetch( ) , 0 ) ;
264263 to_api. send ( Box :: new ( Ok ( VmmData :: Empty ) ) ) . unwrap ( ) ;
265264 let response =
0 commit comments