MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / RequestMetrics

Class RequestMetrics

fastdeploy/engine/request.py:802–956  ·  view source on GitHub ↗

Metrics associated with a request. Attributes: arrival_time: The time when the request arrived. preprocess_start_time: The time when the preprocess started. preprocess_end_time: The time when the preprocess ended. scheduler_recv_req_time: The time when the schedu

Source from the content-addressed store, hash-verified

800
801@dataclass(slots=True)
802class RequestMetrics:
803 """Metrics associated with a request.
804
805 Attributes:
806 arrival_time: The time when the request arrived.
807 preprocess_start_time: The time when the preprocess started.
808 preprocess_end_time: The time when the preprocess ended.
809 scheduler_recv_req_time: The time when the scheduler received the request.
810 engine_get_req_time: The time when the engine got the request.
811 ask_decode_resource_start_time: The time when the engine asks for decode resource.
812 ask_decode_resource_finish_time: The time when the engine has asked for decode resource.
813 inference_start_time: The time when engine adds request to the running queue in resource manager.
814 wait_for_sending_cache_time: The time when the engine waited for sending cache.
815 send_request_output_to_decode_time: The time when the engine sent request_output to decode.
816 decode_recv_req_time: The time when the decode received the request.
817 decode_preallocate_req_time: The time when the decode has preallocated resource for the request.
818 decode_recv_first_token_time: The time when the decode received the first token.
819 decode_inference_start_time: The time when the decode sent the request to worker.
820 decode_recv_second_token_time: The time when the decode received the second token.
821
822 first_token_time: The cost time between engine_recv_first_token_time and inference_start_time
823 time_in_queue: The time the request spent in the queue.
824 model_forward_time: The time spent in the model forward pass when this
825 request was in the batch.
826 model_execute_time: The time spent in the model execute function. This
827 will include model forward, block/sync across
828 workers, cpu-gpu sync time and sampling time.
829 request_start_time: Time to accept the request
830
831 """
832
833 arrival_time: Optional[float] = None # api server receives request
834 preprocess_start_time: Optional[float] = None # preprocess start time in api server
835 preprocess_end_time: Optional[float] = None # preprocess end time in api server
836
837 scheduler_recv_req_time: Optional[float] = None # scheduler receives request and add to scheduler
838 engine_get_req_time: Optional[float] = None # engine gets request from scheduler
839 ask_decode_resource_start_time: Optional[float] = None # engine asks decode resource (only valid for prefill)
840 ask_decode_resource_finish_time: Optional[float] = None # engine has got decode resource (only valid for prefill)
841 add_req_to_resource_manager_time: Optional[float] = None # engine adds request to resource manager
842 inference_start_time: Optional[float] = None # requests are added into the engine work queue
843 engine_recv_latest_token_time: Optional[float] = None # receive the latest token from worker
844 engine_recv_first_token_time: Optional[float] = None # receive first token from worker
845 wait_for_sending_cache_time: Optional[float] = None # wait for sending cache (only valid for prefill)
846 send_request_output_to_decode_time: Optional[float] = (
847 None # send request_output to worker (only valid for prefill)
848 )
849
850 decode_recv_req_time: Optional[float] = None # decode receive request from prefill (only valid for decode)
851 decode_preallocate_req_time: Optional[float] = (
852 None # decode has preallocatee resource for req (only valid for decode)
853 )
854 decode_recv_first_token_time: Optional[float] = (
855 None # decode receive request_output with first token from prefill (only valid for decode)
856 )
857 decode_inference_start_time: Optional[float] = (
858 None # decode adds request to the engine work queue (only valid for decode)
859 )

Calls

no outgoing calls