Esempio n. 1
0
        public void CalculateDisplayedValues(int fromIdx, int toIdx, IEnumerable <string> restrictToViewPaths)
        {
            int       numTasks    = 32;
            int       numFrames   = toIdx - fromIdx + 1;
            int       segmentSize = (numFrames / numTasks) + 1;
            MTCounter counter     = new MTCounter(numFrames);

            ProfilerRDI.ValueList vl = m_logControl.m_prdiTree.BuildValueList(m_dataPaths, m_viewPaths, restrictToViewPaths);

            for (int i = 0; i < numTasks; ++i)
            {
                int start = fromIdx + (i * segmentSize);
                int end   = Math.Min(start + segmentSize, toIdx + 1);

                if (start >= end)
                {
                    break;
                }

                ThreadPool.QueueUserWorkItem((o) =>
                {
                    for (int j = start; j < end; ++j)
                    {
                        IReadOnlyFRVs dataValues     = m_baseLogData.FrameRecords[j].Values;
                        FrameRecordValues viewValues = m_baseViewFRs[j].Values;
                        CalcViewValues(dataValues, viewValues, vl);
                    }

                    counter.Increment(end - start);
                }
                                             );
            }

            counter.WaitUntilMax();
        }
Esempio n. 2
0
        void CalculateValueStats(int fromIdx, int toIdx, IEnumerable <string> restrictToViewPaths)
        {
            int                numTasks      = 32;
            int                numValueStats = m_valueStats.Count;
            int                segmentSize   = (numValueStats / numTasks) + 1;
            MTCounter          counter       = new MTCounter(numValueStats);
            GetValuesFromIndex perViewVFI    = i => m_baseViewFRs[i].Values;
            GetValuesFromIndex perLogVFI     = i => m_baseLogData.FrameRecords[i].Values;

            for (int i = 0; i < numTasks; ++i)
            {
                int start = i * segmentSize;
                int end   = Math.Min(start + segmentSize, numValueStats);

                if (start >= end)
                {
                    break;
                }

                ThreadPool.QueueUserWorkItem((o) =>
                {
                    for (int j = start; j < end; ++j)
                    {
                        string path = m_valueStats.Keys[j];

                        if (restrictToViewPaths != null && !restrictToViewPaths.Contains(path))
                        {
                            continue;
                        }

                        ValueStats valueStats            = m_valueStats.Values[j];
                        IReadOnlyFRPC paths              = valueStats.m_bValueIsPerLogView ? m_viewPaths : m_dataPaths;
                        GetValuesFromIndex valuesFromIdx = valueStats.m_bValueIsPerLogView ? perViewVFI : perLogVFI;
                        CalcSingleValueStat(valueStats, paths.GetIndexFromPath(path), fromIdx, toIdx, valuesFromIdx);
                    }

                    counter.Increment(end - start);
                }
                                             );
            }

            counter.WaitUntilMax();
        }