expose some useful info that can be used in statistics of performence

This commit is contained in:
shutup 2023-07-07 11:52:58 +08:00
parent 3d2907d208
commit 1727e652f1
4 changed files with 20 additions and 1 deletions

View file

@ -151,6 +151,8 @@ def init_library():
handle.new_token.argtypes = [ctypes.c_int]
handle.get_stream_count.restype = ctypes.c_int
handle.has_finished.restype = ctypes.c_bool
handle.get_prompt_eval_time.restype = ctypes.c_float
handle.get_prompt_process_time.restype = ctypes.c_float
handle.abort_generate.restype = ctypes.c_bool
handle.get_pending_output.restype = ctypes.c_char_p
@ -485,7 +487,8 @@ class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
newprompt = fullprompt
gen = asyncio.run(self.handle_request(genparams, newprompt, basic_api_flag, kai_sse_stream_flag))
gen['prompt_process_time'] = handle.get_prompt_process_time()
gen['prompt_eval_time'] = handle.get_prompt_eval_time()
try:
self.send_response(200)
self.end_headers()