node.js / expressアプリの最初にmicrotime()関数のようなものがあります。
function microtime (get_as_float) {
// Returns either a string or a float containing the current time in seconds and microseconds
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/microtime
// + original by: Paulo Freitas
// * example 1: timeStamp = microtime(true);
// * results 1: timeStamp > 1000000000 && timeStamp < 2000000000
var now = new Date().getTime() / 1000;
var s = parseInt(now, 10);
return (get_as_float) ? now : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
}
実際のアプリのコードは次のようになります。
application.post('/', function(request, response) {
t1 = microtime(true);
//code
//code
response.send(something);
console.log("Time elapsed: " + (microtime(true) - t1));
}
経過時間:0.00599980354309082
私の質問は、これは、POSTリクエストがサーバーにヒットしてから、応答が送信されるまでに、約0.005秒かかることを意味しますか?
クライアント側で測定しましたが、インターネットがかなり遅いので、アプリケーション自体とは関係のないラグがあると思います。リクエストがどのくらいの速さで処理されているかをすばやく簡単に確認する方法は何ですか?