Home Reference Source

cables_dev/cables/src/core/cgl/cgl_profiledata.js

  1. class ProfileData
  2. {
  3. constructor(cgl)
  4. {
  5. this._cgl = cgl;
  6. this._lastTime = 0;
  7. this.pause = false;
  8. this.profileUniformCount = 0;
  9. this.profileShaderBinds = 0;
  10. this.profileUniformCount = 0;
  11. this.profileShaderCompiles = 0;
  12. this.profileVideosPlaying = 0;
  13. this.profileMVPMatrixCount = 0;
  14. this.profileEffectBuffercreate = 0;
  15. this.profileShaderGetUniform = 0;
  16. this.profileFrameBuffercreate = 0;
  17. this.profileMeshSetGeom = 0;
  18. this.profileTextureNew = 0;
  19. this.profileGenMipMap = 0;
  20. this.profileOnAnimFrameOps = 0;
  21.  
  22. this.profileFencedPixelRead = 0;
  23. this.profileMainloopMs = 0;
  24. this.profileMeshDraw = 0;
  25. this.profileTextureEffect = 0;
  26. this.profileTexPreviews = 0;
  27. this.shaderCompileTime = 0;
  28. this.profileMeshNumElements = 0;
  29. this.profileMeshAttributes = 0;
  30. this.profileSingleMeshAttribute = [];
  31. this.heavyEvents = [];
  32.  
  33. this.doProfileGlQuery = false;
  34. this.glQueryData = {};
  35. }
  36.  
  37. clear()
  38. {
  39. this.profileSingleMeshAttribute = {};
  40. this.profileMeshAttributes = 0;
  41. this.profileUniformCount = 0;
  42. this.profileShaderGetUniform = 0;
  43. this.profileShaderCompiles = 0;
  44. this.profileShaderBinds = 0;
  45. this.profileTextureResize = 0;
  46. this.profileFrameBuffercreate = 0;
  47. this.profileEffectBuffercreate = 0;
  48. this.profileTextureDelete = 0;
  49. this.profileMeshSetGeom = 0;
  50. this.profileVideosPlaying = 0;
  51. this.profileMVPMatrixCount = 0;
  52. this.profileNonTypedAttrib = 0;
  53. this.profileNonTypedAttribNames = "";
  54. this.profileTextureNew = 0;
  55. this.profileGenMipMap = 0;
  56. this.profileFramebuffer = 0;
  57. this.profileMeshDraw = 0;
  58. this.profileTextureEffect = 0;
  59. this.profileTexPreviews = 0;
  60. this.profileMeshNumElements = 0;
  61. this.profileFencedPixelRead = 0;
  62. }
  63.  
  64. clearGlQuery()
  65. {
  66. for (let i in this.glQueryData)
  67. {
  68. if (!this.glQueryData[i].lastClear || performance.now() - this.glQueryData[i].lastClear > 1000)
  69. {
  70. this.glQueryData[i].time = this.glQueryData[i]._times / this.glQueryData[i]._numcount;
  71. this.glQueryData[i].num = this.glQueryData[i]._numcount;
  72.  
  73. this.glQueryData[i]._times = 0;
  74. this.glQueryData[i]._numcount = 0;
  75. this.glQueryData[i].lastClear = performance.now();
  76. }
  77. }
  78. }
  79.  
  80. addHeavyEvent(event, name, info)
  81. {
  82. const e = { "event": event, "name": name, "info": info, "date": performance.now() };
  83. this.heavyEvents.push(e);
  84. this._cgl.emitEvent("heavyEvent", e);
  85. }
  86. }
  87.  
  88.  
  89. export { ProfileData };