| | 1 | | using System.Collections.Generic; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace MainScripts.DCL.Analytics.PerformanceAnalytics |
| | 5 | | { |
| | 6 | | public class SimpleTracker |
| | 7 | | { |
| | 8 | | private int count; |
| | 9 | |
|
| | 10 | | public int Get() => count; |
| | 11 | |
|
| | 12 | | public void Track() |
| | 13 | | { |
| | 14 | | count++; |
| | 15 | | } |
| | 16 | |
|
| | 17 | | public void Reset() |
| | 18 | | { |
| | 19 | | count = 0; |
| | 20 | | } |
| | 21 | | } |
| | 22 | | public class LoadingTracker |
| | 23 | | { |
| | 24 | | private int loading; |
| | 25 | | private int failed; |
| | 26 | | private int cancelled; |
| | 27 | | private int loaded; |
| | 28 | |
|
| | 29 | | public void TrackLoading() |
| | 30 | | { |
| 0 | 31 | | loading++; |
| 0 | 32 | | } |
| | 33 | |
|
| | 34 | | public void TrackFailed() |
| | 35 | | { |
| 5 | 36 | | loading--; |
| 5 | 37 | | failed++; |
| 5 | 38 | | } |
| | 39 | |
|
| | 40 | | public void TrackCancelled() |
| | 41 | | { |
| 21 | 42 | | loading--; |
| 21 | 43 | | cancelled++; |
| 21 | 44 | | } |
| | 45 | |
|
| | 46 | | public void TrackLoaded() |
| | 47 | | { |
| 119 | 48 | | loading--; |
| 119 | 49 | | loaded++; |
| 119 | 50 | | } |
| | 51 | |
|
| | 52 | | public void Reset() |
| | 53 | | { |
| 81 | 54 | | failed = 0; |
| 81 | 55 | | cancelled = 0; |
| 81 | 56 | | loaded = 0; |
| 81 | 57 | | loading = 0; |
| 81 | 58 | | } |
| 5 | 59 | | public (int loading, int failed, int cancelled, int loaded) GetData() { return (loading, failed, cancelled, load |
| | 60 | | } |
| | 61 | |
|
| | 62 | | public static class PerformanceAnalytics |
| | 63 | | { |
| | 64 | | public static readonly LoadingTracker GLTFTracker = new LoadingTracker(); |
| | 65 | | public static readonly LoadingTracker ABTracker = new LoadingTracker(); |
| | 66 | |
|
| | 67 | | public static readonly SimpleTracker GLTFTextureTracker = new SimpleTracker(); |
| | 68 | | public static readonly SimpleTracker ABTextureTracker = new SimpleTracker(); |
| | 69 | | public static readonly SimpleTracker PromiseTextureTracker = new SimpleTracker(); |
| | 70 | |
|
| | 71 | | public static readonly SimpleTracker MessagesEnqueuedTracker = new SimpleTracker(); |
| | 72 | | public static readonly SimpleTracker MessagesProcessedTracker = new SimpleTracker(); |
| | 73 | |
|
| | 74 | | public static void ResetAll() |
| | 75 | | { |
| | 76 | | GLTFTracker.Reset(); |
| | 77 | | ABTracker.Reset(); |
| | 78 | | GLTFTextureTracker.Reset(); |
| | 79 | | ABTextureTracker.Reset(); |
| | 80 | | PromiseTextureTracker.Reset(); |
| | 81 | | MessagesEnqueuedTracker.Reset(); |
| | 82 | | MessagesProcessedTracker.Reset(); |
| | 83 | | } |
| | 84 | | } |
| | 85 | | } |