From: Paul Hänsch Date: Wed, 13 Mar 2024 23:36:35 +0000 (+0100) Subject: calculate request run time X-Git-Url: http://git.plutz.net/?a=commitdiff_plain;h=1a3925fc31df0c8810d3a938e750ee2b2bf460df;p=rigidfind calculate request run time --- diff --git a/index.cgi b/index.cgi index 532a323..94c3970 100755 --- a/index.cgi +++ b/index.cgi @@ -1,11 +1,13 @@ #!/bin/sh +read _DATE _date_n <<-EOF + $(date +"%s %N") + EOF + . "${_EXEC:-${0%/*}}/cgilite/cgilite.sh" . "${_EXEC:-${0%/*}}/cgilite/storage.sh" . "${_EXEC:-${0%/*}}/cgilite/json.sh" -[ "$_DATE" ] || _DATE="$(date +%s)" - debug "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL $_DATE" ingest() { @@ -234,14 +236,14 @@ elif [ "$REQUEST_METHOD" = "POST" ]; then )" results="${results% }" - times >&2 + t="$(( ${_DATE}${_date_n} - $(date +%s%N) ))" cat <<-EOF Status: 200 OK X-elastic-product: Elasticsearch Content-Type: application/vnd.elasticsearch+json;compatible-with=8 - { "took":0, + { "took":$((t / 1000)), "timed_out":false, "hits": { "total":{"value": $(DB2 "$results" count @) ,"relation":"eq"},