Ejemplo n.º 1
0
        public static void Initialize(string traceFilePath)
        {
            if (session != null)
            {
                throw new InvalidOperationException("Already initialized");
            }

            FileStream stream = new FileStream(traceFilePath, FileMode.Create, FileAccess.ReadWrite);

            session = new SystraceSession(stream);
        }
            internal BeginEventScope(SystraceSession session, string name, string categories)
            {
                this.systraceEvent = new SystraceEvent(
                    session,
                    name,
                    categories,
                    SystraceEventTypes.DurationBegin,
                    session.GetCurrentTimestampMicroseconds(),
                    session.processID,
                    Thread.CurrentThread.ManagedThreadId);

                this.systraceEvent.Session.writer.WriteEvent(this.systraceEvent);
                this.systraceEvent.Session.stream.Flush(false);
            }
        // TODO: Arguments
        // TODO: cname (color name)

        public SystraceEvent(
            SystraceSession session,
            string name,
            string categories,
            char eventType,
            long timestampMicroseconds,
            int processID,
            int threadID)
        {
            this.Session               = Validate.IsNotNull(session, nameof(session));
            this.Name                  = Validate.IsNotNull(name, nameof(name));
            this.Categories            = Validate.IsNotNull(categories, nameof(categories));
            this.EventType             = eventType;
            this.TimestampMicroseconds = timestampMicroseconds;
            this.ProcessID             = processID;
            this.ThreadID              = threadID;
        }