Sfoglia il codice sorgente

ref: rename performanceStats to LongTasksStats

master
Jaya Allamsetty 5 anni fa
parent
commit
eaa2fd37a7

+ 5
- 5
JitsiConference.js Vedi File

@@ -377,8 +377,8 @@ JitsiConference.prototype._init = function(options = {}) {
377 377
         });
378 378
 
379 379
         // Start performance observer for monitoring long tasks
380
-        if (config.performanceStatsInterval) {
381
-            this.statistics.attachPerformanceStats(this);
380
+        if (config.longTasksStatsInterval) {
381
+            this.statistics.attachLongTasksStats(this);
382 382
         }
383 383
     }
384 384
 
@@ -729,9 +729,9 @@ JitsiConference.prototype.getLocalVideoTrack = function() {
729 729
  * @returns {Object|null}
730 730
  */
731 731
 JitsiConference.prototype.getPerformanceStats = function() {
732
-    return browser.supportsPerformanceObserver()
733
-        ? this.statistics.performanceObserverStats.getPerformanceStats()
734
-        : null;
732
+    return {
733
+        longTasksStats: this.statistics.getLongTasksStats()
734
+    };
735 735
 };
736 736
 
737 737
 /**

+ 2
- 2
modules/statistics/PerformanceObserverStats.spec.js Vedi File

@@ -27,7 +27,7 @@ describe('PerformanceObserverStats', () => {
27 27
         const mockConference = new MockConference();
28 28
         const statistics = new Statistics();
29 29
 
30
-        statistics.attachPerformanceStats(mockConference);
30
+        statistics.attachLongTasksStats(mockConference);
31 31
 
32 32
         const startObserverSpy = spyOn(statistics.performanceObserverStats, 'startObserver');
33 33
         const stopObserverSpy = spyOn(statistics.performanceObserverStats, 'stopObserver');
@@ -35,7 +35,7 @@ describe('PerformanceObserverStats', () => {
35 35
 
36 36
         mockConference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
37 37
         expect(startObserverSpy).toHaveBeenCalled();
38
-        expect(statistics.performanceObserverStats.getPerformanceStats()).toBeTruthy();
38
+        expect(statistics.performanceObserverStats.getLongTasksStats()).toBeTruthy();
39 39
 
40 40
         setTimeout(() => {
41 41
             expect(addNextSpy).toHaveBeenCalled();

+ 9
- 10
modules/statistics/statistics.js Vedi File

@@ -121,8 +121,8 @@ Statistics.init = function(options) {
121 121
         Statistics.audioLevelsInterval = options.audioLevelsInterval;
122 122
     }
123 123
 
124
-    if (typeof options.performanceStatsInterval === 'number') {
125
-        Statistics.performanceStatsInterval = options.performanceStatsInterval;
124
+    if (typeof options.longTasksStatsInterval === 'number') {
125
+        Statistics.longTasksStatsInterval = options.longTasksStatsInterval;
126 126
     }
127 127
 
128 128
     Statistics.disableThirdPartyRequests = options.disableThirdPartyRequests;
@@ -193,7 +193,6 @@ export default function Statistics(xmpp, options) {
193 193
 Statistics.audioLevelsEnabled = false;
194 194
 Statistics.audioLevelsInterval = 200;
195 195
 Statistics.pcStatsInterval = 10000;
196
-Statistics.performanceStatsInterval = 10000;
197 196
 Statistics.disableThirdPartyRequests = false;
198 197
 Statistics.analytics = analytics;
199 198
 
@@ -295,7 +294,7 @@ Statistics.prototype.removeByteSentStatsListener = function(listener) {
295 294
  * @param {Function} listener a function that would be called when notified.
296 295
  * @returns {void}
297 296
  */
298
-Statistics.prototype.addPerformanceStatsListener = function(listener) {
297
+Statistics.prototype.addLongTasksStatsListener = function(listener) {
299 298
     this.eventEmitter.on(StatisticsEvents.LONG_TASKS_STATS, listener);
300 299
 };
301 300
 
@@ -305,7 +304,7 @@ Statistics.prototype.addPerformanceStatsListener = function(listener) {
305 304
  *
306 305
  * @returns {void}
307 306
  */
308
-Statistics.prototype.attachPerformanceStats = function(conference) {
307
+Statistics.prototype.attachLongTasksStats = function(conference) {
309 308
     if (!browser.supportsPerformanceObserver()) {
310 309
         logger.warn('Performance observer for long tasks not supported by browser!');
311 310
 
@@ -314,7 +313,7 @@ Statistics.prototype.attachPerformanceStats = function(conference) {
314 313
 
315 314
     this.performanceObserverStats = new PerformanceObserverStats(
316 315
         this.eventEmitter,
317
-        Statistics.performanceStatsInterval);
316
+        Statistics.longTasksStatsInterval);
318 317
 
319 318
     conference.on(
320 319
         JitsiConferenceEvents.CONFERENCE_JOINED,
@@ -325,14 +324,14 @@ Statistics.prototype.attachPerformanceStats = function(conference) {
325 324
 };
326 325
 
327 326
 /**
328
- * Obtains the current value of the performance statistics.
327
+ * Obtains the current value of the LongTasks event statistics.
329 328
  *
330 329
  * @returns {Object|null} stats object if the observer has been
331 330
  * created, null otherwise.
332 331
  */
333
-Statistics.prototype.getPerformanceStats = function() {
332
+Statistics.prototype.getLongTasksStats = function() {
334 333
     return this.performanceObserverStats
335
-        ? this.performanceObserverStats.getPerformanceStats()
334
+        ? this.performanceObserverStats.getLongTasksStats()
336 335
         : null;
337 336
 };
338 337
 
@@ -342,7 +341,7 @@ Statistics.prototype.getPerformanceStats = function() {
342 341
  * @param {Function} listener the listener we want to remove.
343 342
  * @returns {void}
344 343
  */
345
-Statistics.prototype.removePerformanceStatsListener = function(listener) {
344
+Statistics.prototype.removeLongTasksStatsListener = function(listener) {
346 345
     this.eventEmitter.removeListener(StatisticsEvents.LONG_TASKS_STATS, listener);
347 346
 };
348 347
 

Loading…
Annulla
Salva