Exemple #1
0
 public CTFELostRecord(ulong evDiscarded, ulong TSs, ulong TSe, CTFRecord ec)
 {
     this.EvDiscarded = evDiscarded;
     this.TSs         = TSs;
     this.TSe         = TSe;
     Vpid             = (int)ec.GetValue("_vpid");
     Vtid             = (int)ec.GetValue("_vtid");
 }
Exemple #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);
 }
        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));
        }
Exemple #4
0
        public override CTFRecord Read(BitReader r)
        {
            r.Align(Align());
            uint        id = (uint)Elems[0].Read(this, null, r); // must be int
            CTFEnumType ct = (CTFEnumType)Elems[0].CtfType;      // must be enum

            // Select correct range
            string        name = ct.GetName((int)id);
            CTFStructType cst  = subtypes[name];

            if (cst.Changed)
            {
                return(cst.Read(r));
            }
            else
            {
                CTFRecord cr = cst.Read(r, 1);
                cr.array[0] = id;
                return(cr);
            }
        }
Exemple #5
0
        internal bool Update(FileBitReader r, out int csize, out int npos, out byte[] bytes)
        {
            bytes = null;
            csize = 0; npos = 0;
            while (csize <= npos)
            {
                if (r.IsEmpty())
                {
                    return(false);
                }

                int       spos = r.GetPos();
                CTFRecord cr   = tracePacketHeader.Read(r);
                CTFRecord pc   = packetContext.Read(r);
                int       epos = r.GetPos();
                npos  = epos - spos;
                csize = (int)(ulong)pc.GetValue("content_size");
                int    psize = (int)(ulong)pc.GetValue("packet_size");
                object o     = pc.GetValue("events_discarded");
                if (o is uint)
                {
                    EvsLost = (ulong)(uint)o;
                }
                else
                {
                    EvsLost = (ulong)o;
                }

                TSs    = (ulong)pc.GetValue("timestamp_begin");
                TSe    = (ulong)pc.GetValue("timestamp_end");
                psize /= 8;
                bytes  = new byte[psize];
                r.Read(bytes, npos, psize - npos);
                csize /= 8;
            }

            return(true);
        }