Exemple #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();
        }
Exemple #2
0
        static void CalcViewValues(IReadOnlyFRVs dataValues, FrameRecordValues viewValues, ProfilerRDI.ValueList vl)
        {
            foreach (ProfilerRDI.ValueListCmd cmd in vl.Cmds)
            {
                float value = 0.0f;

                for (int i = 0, c = cmd.Count; i != c; ++i)
                {
                    ProfilerRDI.ListItem di     = vl.Items[cmd.StartIndex + i];
                    IReadOnlyFRVs        values = di.ValueIsPerLogView ? viewValues : dataValues;
                    value += values[di.ValuePathIdx] * di.Scale;
                }

                if (value != 0.0f)
                {
                    viewValues[cmd.ViewPathIdx] = value;
                }
                else
                {
                    viewValues.Remove(cmd.ViewPathIdx);
                }
            }
        }