2016-06-28 3 views
1

現在、Webアプリケーションのパフォーマンスを分析するために、httpCallの期間を保存しています。私はwindow.performance.getEntries()を使用し、必要な呼び出しのみを取得します。window.performanceを使用したhttpコールのサイズ

すべてが完璧に動作していますが、この保存された呼び出しのサイズを取得したいと思います。これはwindow.performanceを使って可能でしたか?私よりも同じことをしたいもののために

答えて

0

、私はMDNにそのことについて話すの文書が見つかりました:

https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/encodedBodySize

方法は存在しますが、ブラウザにはまだそれを実装しないでください。ここ

MDNからコードのサンプル:

function log_sizes(perfEntry){ 
    // Check for support of the PerformanceEntry.*size properties and print their values 
    // if supported. 
    if ("decodedBodySize" in perfEntry) 
    console.log("decodedBodySize = " + perfEntry.decodedBodySize); 
    else 
    console.log("decodedBodySize = NOT supported"); 

    if ("encodedBodySize" in perfEntry) 
    console.log("encodedBodySize = " + perfEntry.encodedBodySize); 
    else 
    console.log("encodedBodySize = NOT supported"); 

    if ("transferSize" in perfEntry) 
    console.log("transferSize = " + perfEntry.transferSize); 
    else 
    console.log("transferSize = NOT supported"); 
} 
function check_PerformanceEntries() { 
    // Use getEntriesByType() to just get the "resource" events 
    var p = performance.getEntriesByType("resource"); 
    for (var i=0; i < p.length; i++) { 
    log_sizes(p[i]); 
    } 
} 
関連する問題