Ejemplo n.º 1
0
        private CTFFile Parse(TokParser tp)
        {
            for (;;)
            {
                switch (tp.Token.Id)
                {
                case Token.EnumId.CLOCK:
                    Clock = new CTFTClock(ParseAEList(tp));
                    break;

                case Token.EnumId.EVENT:
                    CTFTEvent ce = new CTFTEvent(scope, ParseAEList(tp));
                    Events.Add(ce.Id, ce);
                    break;

                case Token.EnumId.STREAM:
                    stream = new CTFTStream(scope, ParseAEList(tp));
                    break;

                case Token.EnumId.ENV:
                    env = new CTFTEnv(ParseAEList(tp));
                    break;

                case Token.EnumId.TRACE:
                    trace = new CTFTTrace(scope, ParseAEList(tp));
                    break;

                case Token.EnumId.TYPEALIAS:
                    tp.Next();
                    List <CTFTypeSpecifier> cds = CTFITypeSpecifier.ParseList(scope, tp);
                    if (cds == null)
                    {
                        throw new CTFException();
                    }

                    tp.MustBe(Token.EnumId.TYPE_ASSIGNMENT);
                    List <CTFTypeSpecifier> cds2 = CTFITypeSpecifier.ParseList(scope, tp);
                    CTFDeclarator           cd   = CTFDeclarator.Parse(tp);
                    CTFType.AddType(scope, cds, cds2, cd);
                    break;

                case Token.EnumId.STRUCT:
                    CTFITypeSpecifier.ParseTypeSpecifier(scope, tp);
                    break;

                case Token.EnumId.EOF:
                    return(this);

                case Token.EnumId.TERM:
                    tp.Next();     // Skip it
                    break;

                default:
                    throw new CTFException();
                }
            }
        }
Ejemplo n.º 2
0
 public CTFERecord(CTFTEvent e, ulong time, CTFRecord ec, CTFRecord er)
 {
     this.e    = e;
     this.Time = time;
     this.Er   = er;
     Vpid      = (int)ec.GetValue("_vpid");
     Vtid      = (int)ec.GetValue("_vtid");
     //Console.WriteLine("Event " + e.name);
 }
Ejemplo n.º 3
0
        public CTFERecord GetEvent(MemoryBitReader r)
        {
            r.Align(streamEventHeader.Align());
            if (r.IsEmpty())
            {
                return(null);
            }

            CTFRecord eh   = streamEventHeader.Read(r);
            CTFRecord ec   = streamEventContext.Read(r);
            uint      id   = (uint)eh.GetValue("id");
            object    o    = eh.GetValue("timestamp");
            ulong     time = 0;

            if (o is uint)
            {
                ulong value = (uint)o;
                ulong mask  = (1L << 27) - 1;

                if (value < (r.prev & mask))
                {
                    value = value + (1L << 27);
                }

                r.prev = r.prev & ~mask;

                r.prev = r.prev + value;
                time   = r.prev;
            }
            else
            {
                time = (ulong)o;
            }

            r.prev = time;
            CTFTEvent e      = events[id];
            CTFRecord er     = e.Fields.Read(r);
            ulong     evLost = r.GetEvsLost();
            ulong     TSs    = 0;
            ulong     TSe    = 0;

            if (r.evDisc != evLost)
            {
                IsEvDiscarded = true;
                r.evDisc      = evLost;
                TSs           = r.GetTSs();
                TSe           = r.GetTSe();
                EvDiscarded   = new CTFELostRecord(evLost, r.GetTSs(), r.GetTSe(), ec);
            }

            return(new CTFERecord(e, time, ec, er));
        }