Esempio n. 1
0
        internal Format GetFormat(Entry entry, bool focus, bool selected)
        {
            Format f = new Format();

            Color       bgcolor = Color.Gray;
            bool        blocked = (entry.status == "b");
            EventRecord rec     = entry.record;

            lock (rec)
            {
                f.threadColor = Palette.getTaskColor(rec.tid);
                f.lineColor   = (rec.boxColor != null) ? Color.FromName(rec.boxColor) : line;
                f.fatBorder   = (rec.boxColor != null);
                f.fillBrushes = AssembleFillBrushes(rec, focus, selected, ref bgcolor);

                if (focus)
                {
                    f.objs      = AssembleObjList(rec);
                    f.text      = AssembleText(rec, blocked, f.objs);
                    f.textColor = AssembleTextColor(blocked, bgcolor);
                    f.font      = textfont;
                }
                else
                {
                    f.cross = blocked;
                }
            }

            return(f);
        }
Esempio n. 2
0
        private Brush[] AssembleFillBrushes(EventRecord rec, bool focus, bool selected, ref Color color)
        {
            if (selected)
            {
                return new Brush[1] {
                           new SolidBrush(color = Palette.getSelectionColor())
                }
            }
            ;
            else if (!focus && useOldStyle)
            {
                return new Brush[1] {
                           new SolidBrush(color = Palette.getTaskColor(rec.tid))
                }
            }
            ;
            else if (rec.mop == "TASK_FENCE" || rec.mop == "TRACED_EVENT")
            {
                return new Brush[1] {
                           new SolidBrush(color = Color.Black)
                }
            }
            ;
            else if (rec.vars.Count > 0 && useOldStyle)
            {
                Brush[] brushes = new Brush[rec.vars.Count];

                int pos = 0;
                IEnumerator <KeyValuePair <int, int> > en = rec.vars.GetEnumerator();
                while (en.MoveNext())
                {
                    int var = en.Current.Key;
                    brushes[pos++] = new SolidBrush(color =
                                                        rec.isData ? Palette.getDataVarColor(var) :
                                                        (var < 256) ? Palette.getTaskColor(var) :
                                                        Palette.getSyncVarColor(var)
                                                    );
                }
                return(brushes);
            }
            else
            {
                return(new Brush[1] {
                    new SolidBrush(color = useOldStyle ? Palette.getTaskColor(rec.tid) : Color.Gray)
                });
            }
        }
Esempio n. 3
0
        public void Initialize()
        {
            OneThreadView otv;
            var           threads_panel = this.splitContainer2.Panel2;

            threads_panel.Controls.Clear();
            var threadlist = this.listView1;

            threadlist.Items.Clear();

            if (num_threads == 0)
            {
                return;
            }

            SplitContainer splitcontainer = new SplitContainer();

            if (num_threads != 1)
            {
                threads_panel.Controls.Add(splitcontainer);
                splitcontainer.Orientation = Orientation.Vertical;
                splitcontainer.Dock        = System.Windows.Forms.DockStyle.Fill;
                splitcontainer.Location    = new System.Drawing.Point(0, 0);
            }

            for (int i = 0; i < num_threads; i++)
            {
                otv = new OneThreadView();
                threads.Add(otv);

                if (num_threads == 1)
                {
                    threads_panel.Controls.Add(otv);
                    otv.Dock         = DockStyle.Fill;
                    otv.AutoSize     = true;
                    otv.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                }

                otv.SetTitle(column_to_name[index_to_column[i]]);

                otv.BackColor = Palette.getTaskColor(index_to_tid[i]);
                otv.ForeColor = Color.White;

                var row = new ListViewItem(column_to_name[index_to_column[i]]);
                row.Checked   = true;
                row.ForeColor = Color.White;
                row.BackColor = Palette.getTaskColor(index_to_tid[i]);
                row.SubItems.Add(index_to_tid[i].ToString());
                row.SubItems.Add("file: none");
                row.SubItems.Add("proc: none");
                row.SubItems.Add("op: none");
                listView1.Items.Add(row);

                otv.Dock         = DockStyle.Fill;
                otv.AutoSize     = true;
                otv.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                if (num_threads != 1)
                {
                    if (i == num_threads - 1)
                    {
                        splitcontainer.Panel2.Controls.Add(otv);
                    }
                    else
                    {
                        splitcontainer.Panel1.Controls.Add(otv);
                        if (i < num_threads - 2)
                        {
                            // create new split container
                            var newsplitcontainer = new SplitContainer();
                            newsplitcontainer.Orientation = Orientation.Vertical;
                            newsplitcontainer.Dock        = System.Windows.Forms.DockStyle.Fill;
                            newsplitcontainer.Location    = new System.Drawing.Point(0, 0);
                            splitcontainer.Panel2.Controls.Add(newsplitcontainer);
                            splitcontainer = newsplitcontainer;
                        }
                    }
                }
            }

            pc_list = new int[tvo_list.Count][];
            var curr = new int[num_threads];

            for (int i = 0; i < num_threads; i++)
            {
                curr[i] = -1;
            }
            for (int i = tvo_list.Count - 1; i >= 0; i--)
            {
                // track the index in tvo_list of the tid at i
                curr[this.tid_to_index[tvo_list[i].entry.record.tid]] = i;
                pc_list[i] = new int[num_threads];
                curr.CopyTo(pc_list[i], 0);
            }

            row_to_item = new int[tvo_list.Count];
            item_to_row = new int[tvo_list.Count];
            for (int i = 0; i < tvo_list.Count; i++)
            {
                row_to_item[i] = i;
                item_to_row[i] = i;
            }
            orig_items = new ListViewItem[listView2.Items.Count];
            listView2.Items.CopyTo(orig_items, 0);

            initialized = true;

            show_all_pcs(0);

            // TODO: this is fragile. If we do this too early then toggles are sent to the model from listView2
            listView2.ItemChecked += new ItemCheckedEventHandler(listView2_ItemChecked);
            listView1.ItemChecked += new ItemCheckedEventHandler(listView1_ItemChecked);
        }