cables_dev/cables/src/core/cgl/cgl_profiledata.js
class ProfileData
{
constructor(cgl)
{
this._cgl = cgl;
this._lastTime = 0;
this.pause = false;
this.profileUniformCount = 0;
this.profileShaderBinds = 0;
this.profileUniformCount = 0;
this.profileShaderCompiles = 0;
this.profileVideosPlaying = 0;
this.profileMVPMatrixCount = 0;
this.profileEffectBuffercreate = 0;
this.profileShaderGetUniform = 0;
this.profileFrameBuffercreate = 0;
this.profileMeshSetGeom = 0;
this.profileTextureNew = 0;
this.profileGenMipMap = 0;
this.profileOnAnimFrameOps = 0;
this.profileFencedPixelRead = 0;
this.profileMainloopMs = 0;
this.profileMeshDraw = 0;
this.profileTextureEffect = 0;
this.profileTexPreviews = 0;
this.shaderCompileTime = 0;
this.profileMeshNumElements = 0;
this.profileMeshAttributes = 0;
this.profileSingleMeshAttribute = [];
this.heavyEvents = [];
this.doProfileGlQuery = false;
this.glQueryData = {};
}
clear()
{
this.profileSingleMeshAttribute = {};
this.profileMeshAttributes = 0;
this.profileUniformCount = 0;
this.profileShaderGetUniform = 0;
this.profileShaderCompiles = 0;
this.profileShaderBinds = 0;
this.profileTextureResize = 0;
this.profileFrameBuffercreate = 0;
this.profileEffectBuffercreate = 0;
this.profileTextureDelete = 0;
this.profileMeshSetGeom = 0;
this.profileVideosPlaying = 0;
this.profileMVPMatrixCount = 0;
this.profileNonTypedAttrib = 0;
this.profileNonTypedAttribNames = "";
this.profileTextureNew = 0;
this.profileGenMipMap = 0;
this.profileFramebuffer = 0;
this.profileMeshDraw = 0;
this.profileTextureEffect = 0;
this.profileTexPreviews = 0;
this.profileMeshNumElements = 0;
this.profileFencedPixelRead = 0;
}
clearGlQuery()
{
for (let i in this.glQueryData)
{
if (!this.glQueryData[i].lastClear || performance.now() - this.glQueryData[i].lastClear > 1000)
{
this.glQueryData[i].time = this.glQueryData[i]._times / this.glQueryData[i]._numcount;
this.glQueryData[i].num = this.glQueryData[i]._numcount;
this.glQueryData[i]._times = 0;
this.glQueryData[i]._numcount = 0;
this.glQueryData[i].lastClear = performance.now();
}
}
}
addHeavyEvent(event, name, info)
{
const e = { "event": event, "name": name, "info": info, "date": performance.now() };
this.heavyEvents.push(e);
this._cgl.emitEvent("heavyEvent", e);
}
}
export { ProfileData };