コード例 #1
0
            public void AddHistogram(string path)
            {
                int barX        = 100;
                int barY        = 30;
                int textX       = barX - 60;
                int textY       = barY + 12;
                int maxWidth    = 200;
                int barHeight   = 12;
                int verticalGap = 4;

                BucketSet bucketSet = m_logData.m_bucketSets[path];

                if (bucketSet is TimeBucketSet)
                {
                    for (int i = 0; i < bucketSet.m_buckets.Count; i++)
                    {
                        TimeBucket bucket = bucketSet.m_buckets[i] as TimeBucket;
                        m_page.content += "context.fillStyle = \"rgb(255,0,0)\";\n";
                        m_page.content += string.Format("context.fillRect({0}, {1}, {2}, {3});\n", barX, barY, (bucket.m_timePercent / 100.0f) * maxWidth, barHeight);
                        m_page.content += "context.fillStyle = \"rgb(0,0,0)\";\n";
                        m_page.content += string.Format("context.fillText(\"{0}\", {1}, {2});\n", bucket.RangeDescription, textX, textY);
                        barY           += barHeight + verticalGap;
                        textY          += barHeight + verticalGap;
                    }
                }
            }
コード例 #2
0
ファイル: Buckets.cs プロジェクト: yongweisun/CRYENGINE
        void AddBucketListTabPage(string name, BucketSet bucketSet)
        {
            TabPage tabPage = new TabPage(name);

            tabPage.Name = name;
            tabPage.Controls.Add(new BucketListView(bucketSet));
            bucketsTabControl.TabPages.Add(tabPage);
        }
コード例 #3
0
 private void CreateHeaders(BucketSet bucketSet, int colHeaderWidth)
 {
     m_columnProperties = new List <PropertyInfo>();
     foreach (var pi in EnumColumns(bucketSet))
     {
         var    descAttr = GetFirstAttribute(pi, typeof(DescriptionAttribute), true);
         string desc     = descAttr != null ? ((DescriptionAttribute)descAttr).Description : pi.Name;
         Columns.Add(LogControl.CreateColumnHeader(desc, colHeaderWidth));
         m_columnProperties.Add(pi);
     }
 }
コード例 #4
0
        private int CountHeaders(BucketSet bucketSet)
        {
            int numHeaders = 0;

            foreach (var pi in EnumColumns(bucketSet))
            {
                ++numHeaders;
            }

            return(numHeaders);
        }
コード例 #5
0
            public void AddBucketsTable(string path)
            {
                BucketSet bucketSet = m_logData.m_bucketSets[path];

                if (bucketSet is TimeBucketSet)
                {
                    m_page.content += "|| Range || % of time || cumulative % ||\n";

                    for (int i = 0; i < bucketSet.m_buckets.Count; i++)
                    {
                        TimeBucket bucket = bucketSet.m_buckets[i] as TimeBucket;
                        m_page.content += string.Format("| {0} | {1:n2}% | {2:n2}% |\n", bucket.RangeDescription, bucket.m_timePercent, bucket.m_timePercentCumulative);
                    }
                }
            }
コード例 #6
0
        private IEnumerable <PropertyInfo> EnumColumns(BucketSet bset)
        {
            if (bset.m_buckets.Count > 0)
            {
                Type bucketType = bset.m_buckets[0].GetType();

                // Assuming that all buckets have the same type..

                foreach (PropertyInfo prop in bucketType.GetProperties())
                {
                    // Ensure it's browseable
                    var  ba           = GetFirstAttribute(prop, typeof(BrowsableAttribute), true);
                    bool isBrowseable = (ba != null) ? ((BrowsableAttribute)ba).Browsable : true;

                    if (isBrowseable)
                    {
                        yield return(prop);
                    }
                }
            }
        }
コード例 #7
0
        public BucketListView(BucketSet bucketSet)
        {
            InitializeComponent();

            View                 = View.Details;
            Dock                 = DockStyle.Fill;
            GridLines            = true;
            FullRowSelect        = true;
            VirtualMode          = true;
            VirtualListSize      = bucketSet.m_buckets.Count;
            RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(bucketsListView_RetrieveVirtualItem);
            CacheVirtualItems   += new CacheVirtualItemsEventHandler(bucketsListView_CacheVirtualItems);
            StatoscopeForm.SetDoubleBuffered(this);

            int numColHeaders  = CountHeaders(bucketSet);
            int colHeaderWidth = Math.Max(50, (Width) / numColHeaders);

            Columns.Add(LogControl.CreateColumnHeader("Bucket", colHeaderWidth));
            CreateHeaders(bucketSet, colHeaderWidth);

            m_bucketSet = bucketSet;
            m_lviCache  = new List <ListViewItem>(bucketSet.m_buckets.Count);
            UpdateLviCache();
        }