Exemplo n.º 1
0
        public static TrackersReport GenerateTrackerReport(TrackerReportOptions options)
        {
            if (string.IsNullOrEmpty(options.trackerFilter))
            {
                options.trackerFilter = ".+";
            }
            var trackerRx        = new Regex(options.trackerFilter, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            var trackers         = PtModel.BuildTrackerList(new PtInfo[] { }, options.sortBy, options.sortAsc, options.sort);
            var filteredTrackers = trackers.Where(tracker => trackerRx.IsMatch(tracker.name)).ToList();
            var report           = new TrackersReport()
            {
                trackers = new List <TrackerInfo>()
            };

            foreach (var tracker in filteredTrackers)
            {
                TrackerInfo info = new TrackerInfo
                {
                    avgTime     = (float)tracker.avgTime,
                    totalTime   = (float)tracker.totalTime,
                    samples     = tracker.sampleCount,
                    peakTime    = (float)tracker.peakTime,
                    trackerName = tracker.name
                };
                report.trackers.Add(info);
            }

            return(report);
        }
Exemplo n.º 2
0
        public static string GetTrackersReport(TrackerReportOptions options)
        {
            var trackerRx        = new Regex(options.trackerFilter, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            var trackers         = PtModel.BuildTrackerList(new PtInfo[] { }, options.sortBy, options.sortAsc, options.sort);
            var filteredTrackers = trackers.Where(tracker => trackerRx.IsMatch(tracker.name)).ToList();

            return(GetTrackersReport(filteredTrackers, options));
        }
        static void SpamPerformanceActionEvents()
        {
            var trackers = PtModel.BuildTrackerList(new PtInfo[] { }, ColumnId.AvgTime, true, true);

            for (var i = 0; i < 25; ++i)
            {
                var evt = new PerformanceActionEvent(
                    RandomEnum <ActionType>(),
                    RandomValue(trackers).name,
                    RandomEnum <ActionSource>()
                    );

                SendPerformanceActionEvent(evt);
                Debug.Log($"Send action event: {i}");
                Thread.Sleep(500);
            }
        }
Exemplo n.º 4
0
 private void BuildTrackers(out bool numberTrackersChanged)
 {
     using (new PerformanceTracker("PerformanceTrackerWindow.BuildTrackers"))
     {
         var oldTrackerCount = m_AllTrackers.Length;
         m_AllTrackers = PtModel.BuildTrackerList(m_AllTrackers, m_SortBy, m_SortAsc);
         var pinnedSortedTrackers   = new List <PtInfo>();
         var unpinnedSortedTrackers = new List <PtInfo>();
         foreach (var tracker in m_AllTrackers)
         {
             if (IsPinnedTracker(tracker))
             {
                 pinnedSortedTrackers.Add(tracker);
             }
             else
             {
                 unpinnedSortedTrackers.Add(tracker);
             }
         }
         numberTrackersChanged = oldTrackerCount != m_AllTrackers.Length;
         var oldCount = m_FilteredTrackers.Count;
         m_PinnedTrackers.Clear();
         m_PinnedTrackers.AddRange(pinnedSortedTrackers);
         m_PinnedTrackersView.style.height = Math.Min(10.0f, pinnedSortedTrackers.Count) * PtStyles.itemHeight;
         m_FilteredTrackers.Clear();
         if (!string.IsNullOrEmpty(m_FilterText))
         {
             var filterTokens = m_FilterText.Split(',').Select(f => f.Trim()).Where(f => f.Length > 0).ToArray();
             if (filterTokens.Length == 1)
             {
                 m_FilteredTrackers.AddRange(unpinnedSortedTrackers.Where(t => t.name.IndexOf(filterTokens[0], StringComparison.OrdinalIgnoreCase) != -1));
             }
             else
             {
                 m_FilteredTrackers.AddRange(unpinnedSortedTrackers.Where(t => filterTokens.Any(f => t.name.IndexOf(f, StringComparison.OrdinalIgnoreCase) != -1)));
             }
         }
         else
         {
             m_FilteredTrackers.AddRange(unpinnedSortedTrackers);
         }
         numberTrackersChanged = numberTrackersChanged || m_FilteredTrackers.Count != oldCount;
         titleContent          = new GUIContent($"Performance Trackers ({m_FilteredTrackers.Count})");
     }
 }
        static void SpamPerformanceWindowUsageEvents()
        {
            var trackers = PtModel.BuildTrackerList(new PtInfo[] { }, ColumnId.AvgTime, true, true);

            for (var i = 0; i < 25; ++i)
            {
                var evt = new PerformanceWindowUsageEvent()
                {
                    columns     = RandomValue(kShowColumns),
                    sortBy      = RandomEnum <ColumnId>(),
                    sortAsc     = RandomBool(),
                    filter      = RandomValue(kSearchFields),
                    pinMarkers  = RandomValue(kPins),
                    updateSpeed = (float)RandomValue(PtModel.RefreshRates).rate,
                    usageType   = RandomEnum <WindowUsageType>(),
                    markerName  = RandomValue(trackers).name
                };

                SendPerformanceWindowUsageEvent(evt);
                Debug.Log($"Send windowUsage event: {i}");
                Thread.Sleep(500);
            }
        }