本文介绍了如何自我&使用Google Chrome的devtools配置文件报告(cpuprofile文件)计算总时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写工具来解析和提取一些来自 cpuprofile 文件(当我保存配置文件报告时产生的文件)的数据,而且我有一些精度为Self的问题&安培;总时间计算。因此,时间取决于字段 hitCount 的值,但是。当 hitCount 小( hitCount 和自我时间〜1.033。但随着 hitCount 的增长,系数也在增长。
所以,当hitCount = 3585时,k是1.057。当hitCount = 7265时:k = 1.066。



目前我使用1.035作为系数,我试着最小化我的样本数据的错误。但我对近似值不满意。我不熟悉Chromium代码库,直接在源代码中找出它。



那么如何获得具有hitCount值的函数调用的自我时间?

解决方案

基本上它是:

  sampleDuration = totalRecordingDuration / totalHitCount 
nodeSelfTime = nodeHitCount * sampleDuration

你可以在这里找到它:

I'm writing tool to parse and extract some data from cpuprofile file (file produced when I save profile report) and I'm having some troubles with precision of Self & Total times calculations. So, time depends on the value from field hitCount, but. When hitCount is small (<300) the coefficient between hitCount and Self time ~1.033. But as hitCount grows, coefficient also grows.So, when hitCount=3585, k is 1.057. When hitCount=7265: k=1.066.

Currently I'm using 1.035 as coefficient, I tried to minimize error on my sample data. But I'm not happy with approximation. I'm not familiar with Chromium code base to go and figure it out directly in the source code.

So how do I get Self time for function call having hitCount value?

解决方案

Basically it's:

sampleDuration = totalRecordingDuration / totalHitCount
nodeSelfTime = nodeHitCount * sampleDuration

You can find it here:https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/devtools/front_end/sdk/CPUProfileDataModel.js&sq=package:chromium&type=cs&l=31

这篇关于如何自我&amp;使用Google Chrome的devtools配置文件报告(cpuprofile文件)计算总时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 17:41