public ConcurrencyExplorer(TextReader stream, bool racedisplay)
        {
            // make model
            IModel model = new EventDB();

            // get first line to determine type of trace file
            bool   recordAndReplay = false;
            string marker          = stream.ReadLine();

            if (marker == "m")
            {
                recordAndReplay = false;
            }
            else if (marker == "s")
            {
                recordAndReplay = true;
            }
            else
            {
                System.Console.WriteLine("the specified file is not a valid trace file.");
                System.Environment.Exit(0);
            }

            // make GUI controller
            controllers.Add(guicontroller = new GuiController(!recordAndReplay, racedisplay, model));

            // make stream or event controller
            if (stream != null)
            {
                controllers.Add(new StreamController(stream, model));
            }
            else
            {
                controllers.Add(eventcontroller = new EventController(model));
            }
        }
Exemple #2
0
        volatile int curex  = -1; // currently selected execution, or -1 if none

        private void UpdateText()
        {
            string str_ex       = "Execution: ";
            string str_tr       = "Thread: ";
            string str_en       = "Entry: ";
            string str_vc       = "VC: ";
            string str_sid      = "sid: ";
            string str_enables  = "enables: ";
            string str_disables = "disables: ";
            bool   has_race;

            // get the data we need (note that we are holding model lock already)
            cursel = model.GetSelection();
            if (cursel != -1)
            {
                Entry e = model.GetEntry(cursel);
                curex   = e.record.exec;
                str_ex += e.record.exec + "/" + model.GetNumberExecutions();
                str_tr += e.record.tid + "/" + model.GetThreads(e.record.exec).Count();
                //+ "(" + model.getThreadName(e.record.exec, e.record.tid) + ")";
                str_en += (e.seqno - model.GetFirstEntry(e.record.exec) + 1)
                          + "/" + model.GetNumberEntries(e.record.exec);
                if (e.status == "c" && e.record.hbStamp != null)
                {
                    str_vc = "VC: " + e.record.hbStamp.format(model.GetThreads(e.record.exec).Count());
                }
                has_race = model.HasRace(e.record.exec);
                if (e.status == "c" && e.record.sid >= 0)
                {
                    str_sid += (e.record.sid);
                }
                int[] enables, disables;
                EventDB.GetEnableChange(e, out enables, out disables);
                if (enables != null)
                {
                    foreach (int t in enables)
                    {
                        str_enables += t + " ";
                    }
                }
                if (disables != null)
                {
                    foreach (int t in disables)
                    {
                        str_disables += t + " ";
                    }
                }
            }
            else
            {
                curex    = -1;
                has_race = false;
            }

            BeginInvoke(new Thunk(delegate()
            {
                label1.Text     = str_ex;
                label2.Text     = str_tr;
                label3.Text     = str_en;
                label4.Text     = str_vc;
                label5.Text     = str_sid;
                label6.Text     = str_enables;
                label7.Text     = str_disables;
                button2.Enabled = (cursel != -1);
                button3.Enabled = has_race;
            }));
        }
Exemple #3
0
 internal EventRecordImpl(EventDB ownerDB, int exec, int tid, int nr)
     : base(exec, tid, nr)
 {
     _ownerDB = ownerDB;
     entries  = new List <Entry>();
 }