Ejemplo n.º 1
0
        internal void set_attribute(EventAttributeEnum attr, String val)
        {
            System.Diagnostics.Debug.Assert(val != null);
            switch (attr)
            {
            case EventAttributeEnum.VAR_OP:
                mop = val;
                if (val == "DATA_READ" || val == "DATA_WRITE")
                {
                    isData = true;
                }
                break;

            case EventAttributeEnum.VAR_ID:
                int varid = Int32.Parse(val);
                vars[varid] = varid;
                break;

            case EventAttributeEnum.INSTR_METHOD:
                name = val;
                break;

            case EventAttributeEnum.STACKTRACE:
                parseStacktrace(val);
                break;

            case EventAttributeEnum.DISPLAY_BOXED:
                boxColor = val;
                break;

            case EventAttributeEnum.HBSTAMP:
                parseTimestamp(val);
                break;

            case EventAttributeEnum.EVT_SID:
                sid = Int32.Parse(val);
                break;

            case EventAttributeEnum.ENABLE:
                if (enables == null)
                {
                    enables = new List <int>();
                }
                enables.Add(Int32.Parse(val));
                break;

            case EventAttributeEnum.DISABLE:
                if (disables == null)
                {
                    disables = new List <int>();
                }
                disables.Add(Int32.Parse(val));
                break;

            default:
                break;
            }

            // suppress stack trace for TASK_START events
            if (mop == "TASK_BEGIN" && stack != null && stack.Count != 0)
            {
                stack = new List <StackFrame>();
            }
        }
Ejemplo n.º 2
0
 private void DumpTuple(int tid, int newnr, EventAttributeEnum attr, string val)
 {
     System.Console.WriteLine(tid.ToString() + " " + newnr.ToString() + " " + (int)attr + " " + val.Length + " " + val);
 }
Ejemplo n.º 3
0
        // create entry, or create or modify EventRecord
        public void ProcessTuple(int tid, int nr, int attr, String value)
        {
            // make sure thread is known
            ThreadData t;

            if (!cur_execdata.threads.ContainsKey(tid))
            {
                t = cur_execdata.threads[tid] = new ThreadData(tid);
            }
            else
            {
                t = cur_execdata.threads[tid];
            }

            // update max nr
            if (nr > t.max_nr)
            {
                t.max_nr = nr;
            }

            // find or create event record
            EventRecordImpl rec;

            if (t.events.ContainsKey(nr))
            {
                rec = t.events[nr];
            }
            else
            {
                rec          = new EventRecordImpl(this, cur_exec, tid, nr);
                t.events[nr] = rec;
            }

            // update the attribute
            EventAttributeEnum attribute = (EventAttributeEnum)attr;

            rec.set_attribute(attribute, value);

            if (attribute == EventAttributeEnum.STATUS)
            {
                int   seqno = entries.Count + 1;
                Entry entry = new Entry(rec, value, seqno);
                entries[seqno] = entry;
                cur_execdata.sequence.Add(entry);
                rec.entries.Add(entry);
                // default timestamp to last timestamp
                if (rec.hbStamp == null)
                {
                    rec.hbStamp = t.last_stamp;
                }
                // update first/last in block
                if (cur_execdata.last_thread != rec.tid)
                {
                    entry.first_in_block = true;
                    if (cur_execdata.last_entry != null)
                    {
                        cur_execdata.last_entry.last_in_block = true;
                    }
                }
                cur_execdata.last_thread = rec.tid;
                cur_execdata.last_entry  = entry;
                // notify observers
                if (NewEntry != null)
                {
                    NewEntry(entry);
                }
                // set selection to first entry if not set yet
                if (seqno == 1 && selection == -1)
                {
                    SetSelection(1);
                }
            }
            else if (attribute == EventAttributeEnum.THREADNAME)
            {
                if (t.name != value)
                {
                    t.name = value;
                    // notify observers
                    if (ThreadnameUpdate != null)
                    {
                        ThreadnameUpdate(cur_exec, tid, value);
                    }
                }
            }
            else
            {
                if (attribute == EventAttributeEnum.DISPLAY_BOXED)
                {
                    cur_execdata.racing.Add(rec);
                }
                if (attribute == EventAttributeEnum.HBSTAMP)
                {
                    t.last_stamp = rec.hbStamp;
                }
                // notify observers
                if (EntryUpdate != null)
                {
                    foreach (Entry entry in rec.entries)
                    {
                        EntryUpdate(entry);
                    }
                }
            }
        }