public System.Drawing.Color GetIntervalColor(Interval iv)
        {
            StreamingInterval siv = (StreamingInterval)iv;

            switch (siv.Stage)
            {
            case StreamingStage.Waiting:
            {
                float greyScale = 0.75f - (siv.PerceptualImportance / MaxPriority) * 0.75f;
                return(new RGB(greyScale, greyScale, greyScale).ConvertToSysDrawCol());
            }

            case StreamingStage.IO:
            case StreamingStage.Inflate:
            case StreamingStage.Async:
            case StreamingStage.IO_Inflate:
                return(m_stageColours[(int)siv.Stage - 1]);

            case StreamingStage.Preempted:
                return(Color.Orange);

            case StreamingStage.Preempted_Inflate:
                return(Color.DarkKhaki);

            default:
                return(Color.Black);
            }
        }
        public System.Drawing.Color GetIntervalColor(Interval iv)
        {
            StreamingInterval siv = (StreamingInterval)iv;
            //float hue = 0.75f - (siv.PerceptualImportance / MaxPriority) * 0.75f;
            float hue = 0.75f - ((float)siv.Source / (float)StreamTaskType.Count) * 0.75f;

            return(new RGB(new HSV(hue, 1.0f, 1.0f)).ConvertToSysDrawCol());
        }
示例#3
0
        public void AddInterval(StreamingInterval iv)
        {
            ++m_total;

            int bucketIdx = m_typeToBucket[iv.Source];
            StreamingTypeBucket bucket = m_buckets[bucketIdx] as StreamingTypeBucket;

            ++bucket.Num;

            UpdatePc();
        }
示例#4
0
 public StreamingInterval(StreamingInterval clone)
     : base(clone)
 {
     this.filename             = clone.filename;
     this.stage                = clone.stage;
     this.priority             = clone.priority;
     this.source               = clone.source;
     this.perceptualImportance = clone.perceptualImportance;
     this.sortKey              = clone.sortKey;
     this.compressedSize       = clone.compressedSize;
     this.mediaType            = clone.mediaType;
     this.threadId             = clone.threadId;
 }
        public int[] ReorderRails(IntervalTree tree, int[] rails, double selectionStart, double selectionEnd)
        {
            List <KeyValuePair <int, double> > railTimes = new List <KeyValuePair <int, double> >(rails.Length);

            long selectionStartUs = (long)(selectionStart * 1000000.0);
            long selectionEndUs   = (long)(selectionEnd * 1000000.0);

            foreach (int railId in rails)
            {
                double t = double.MaxValue;

                bool railIntersectsSelection = false;

                foreach (var iv in tree.RangeEnum(railId, selectionStartUs, selectionEndUs))
                {
                    railIntersectsSelection = true;
                    break;
                }

                if (railIntersectsSelection)
                {
                    foreach (var iv in tree.RangeEnum(railId, selectionStartUs, tree.MaxTimeUs))
                    {
                        StreamingInterval siv = iv as StreamingInterval;
                        if ((siv.Stage & StreamingStage.IO) != 0)
                        {
                            t = Math.Min(t, iv.Start);
                            break;
                        }
                    }
                }

                railTimes.Add(new KeyValuePair <int, double>(railId, t));
            }

            railTimes.Sort(new KeyValuePair_SecondComparer <int, double>());
            return(railTimes.Select((x) => x.Key).ToArray <int>());
        }
示例#6
0
        public void OnFinalisedInterval(UInt64 ctxId, Interval iv, bool isModification)
        {
            StreamingInterval siv = (StreamingInterval)iv;

            RailCtx ctx;

            lock (m_log.IntervalTree)
            {
                ctx = GetRailIdForPath_Locked(siv.Source.ToString() + "/" + siv.Filename);

                if (ctx.StartTime == 0.0f)
                {
                    ctx.StartTime = iv.Start;
                }

                if ((siv.Stage & StreamingStage.IO) != 0)
                {
                    if (siv.MediaType == StreamSourceMediaType.Unknown)
                    {
                        // Find an io rail by thread id
                        int railIdx;
                        if (!m_ioRailDict.TryGetValue(siv.ThreadId, out railIdx))
                        {
                            m_ioRail.Add(m_log.IntervalTree.AddRail(string.Format("IO Thread {0:x}", siv.ThreadId)));
                            m_ioRailDict.Add(siv.ThreadId, m_ioRail.Count - 1);
                            railIdx = m_ioRail.Count - 1;
                            m_log.IntervalTree.AddRailToGroup(m_ioRail[railIdx], m_threadsGroup);
                        }
                        m_log.IntervalTree.AddInterval(m_ioRail[railIdx], iv);
                    }
                    else
                    {
                        m_log.IntervalTree.AddInterval(m_ioRail[(int)siv.MediaType], iv);
                    }
                }

                if ((siv.Stage & StreamingStage.Inflate) != 0)
                {
                    m_log.IntervalTree.AddInterval(m_inflateRail, iv);
                }

                if ((siv.Stage & StreamingStage.Async) != 0)
                {
                    m_log.IntervalTree.AddInterval(m_asyncRail, iv);
                }

                m_log.IntervalTree.AddInterval(ctx.RailId, iv);
            }

            if ((siv.Stage & StreamingStage.IO) != 0)
            {
                ctx.IOTime += siv.Length;
            }

            if ((siv.Stage & StreamingStage.Inflate) != 0)
            {
                ctx.InflateTime += siv.Length;
            }

            lock (m_log.m_bucketSets)
            {
                if (siv.Stage == StreamingStage.Waiting)
                {
                    m_waitTimes.AddInterval(siv.Length);
                }

                if ((siv.Stage & StreamingStage.IO) != 0)
                {
                    m_ioTypes.AddInterval(siv);
                }

                if (!isModification)
                {
                    StreamingTimeBucketSet buckets;
                    if (m_requestBucketsByType.TryGetValue(siv.Source, out buckets))
                    {
                        buckets.AddInterval(iv.End - ctx.StartTime);
                    }

                    m_ioTimes.AddInterval(ctx.IOTime);
                    m_inflateTimes.AddInterval(ctx.InflateTime);
                    m_inflateRates.AddInterval(siv.CompressedSize / (1024.0 * ctx.InflateTime * 1000.0));
                }
            }

            if (!isModification)
            {
                ctx.StartTime   = 0.0;
                ctx.InflateTime = 0.0;
                ctx.IOTime      = 0.0;
            }
        }