Fix raw HTTP request timing logs
This commit is contained in:
@@ -858,6 +858,8 @@ FastCGIServer::process_http_request(FastCGIRequest& request, String& data)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(request.stats.time_start == 0)
|
||||
request.stats.time_start = time_precise();
|
||||
on_complete(request);
|
||||
|
||||
assemble_output_buffer(
|
||||
@@ -1332,10 +1334,13 @@ FastCGIServer::assemble_output_buffer(FastCGIRequest& request, Connection* conne
|
||||
request.stats.time_end = time_precise();
|
||||
if(request.flags.log_request)
|
||||
{
|
||||
const char* transport = !connection ? "fastcgi" :
|
||||
connection->type == 'H' ? "http" :
|
||||
connection->type == 'C' ? "cli" : "unknown";
|
||||
auto elapsed_us = [&](f64 from, f64 to) -> f64 {
|
||||
return(from > 0 && to >= from ? (to - from) * 1000000.0 : 0.0);
|
||||
};
|
||||
printf("(r) pid:%i\t%s\t%0.6fs\tfps:%0.0f\tout:%0.1fkB\tmem:%0.0f/%0.0fkB\twasm-ready:%0.3fms\twasm:%0.3fms\tworkspace:%0.3fms\tinvoke:%0.3fms\tcollect:%0.3fms\tpost:%0.3fms\n",
|
||||
printf("(r) pid:%i\t%s\t%0.6fs\tfps:%0.0f\tout:%0.1fkB\tmem:%0.0f/%0.0fkB\twasm-ready:%0.3fms\twasm:%0.3fms\tworkspace:%0.3fms\tinvoke:%0.3fms\tcollect:%0.3fms\tpost:%0.3fms\ttransport:%s\n",
|
||||
my_pid,
|
||||
request.params["REQUEST_URI"].c_str(),
|
||||
request.stats.time_end - request.stats.time_start,
|
||||
@@ -1348,7 +1353,8 @@ FastCGIServer::assemble_output_buffer(FastCGIRequest& request, Connection* conne
|
||||
(f64)request.stats.wasm_workspace_complete_us / 1000.0,
|
||||
(f64)request.stats.wasm_entry_invoke_us / 1000.0,
|
||||
(f64)request.stats.wasm_output_collect_us / 1000.0,
|
||||
elapsed_us(request.stats.wasm_backend_finished, request.stats.time_end) / 1000.0
|
||||
elapsed_us(request.stats.wasm_backend_finished, request.stats.time_end) / 1000.0,
|
||||
transport
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user