public void Waking(Timestamp timestamp, ThreadInfo readyingThread)
 {
     this.stateTransition(timestamp, ThreadState.TASK_WAKING);
     if (readyingThread != null)
     {
         this.readyingPid = readyingThread.PidAsString();
         this.readyingTid = readyingThread.Tid.ToString();
     }
 }
        public ThreadInfo(int tid, Timestamp firstEventTime, ThreadState startingState, ThreadInfo parentThread = null, bool inheritPid = false)
        {
            this.Tid = tid;
            if (startingState == ThreadState.TASK_NEW)
            {
                this.previousState = SchedulingState.NewlyCreated;
                if (inheritPid && parentThread != null)
                {
                    this.Pid = parentThread.Pid;
                }
                else
                {
                    this.Pid = tid;
                }

                if (parentThread != null)
                {
                    if (inheritPid)
                    {
                        this.Pid = parentThread.Pid;
                    }
                    else
                    {
                        this.Pid = tid;
                    }
                    this.Command = parentThread.Command;
                }
                else
                {
                    this.Command = String.Empty;
                    this.Pid     = tid;
                }
                this.StartTime = firstEventTime;
            }
            else
            {
                this.Pid           = tid * (-1);
                this.previousState = SchedulingState.Unknown;
                this.Command       = String.Empty;
                this.StartTime     = Timestamp.Zero;
            }


            this.lastEventTimestamp = firstEventTime;
            this.currentState       = ThreadStateToSchedulingState(startingState);

            if (startingState == ThreadState.TASK_WAKING && parentThread != null)
            {
                this.readyingPid = parentThread.PidAsString();
                this.readyingTid = parentThread.Tid.ToString();
            }
            else
            {
                this.readyingPid = String.Empty;
                this.readyingTid = String.Empty;
            }
        }
예제 #3
0
 public Thread(ThreadInfo threadInfo)
 {
     this.tid           = threadInfo.Tid;
     this.pidAsInt      = threadInfo.Pid;
     this.pidAsString   = threadInfo.PidAsString();
     this.command       = threadInfo.Command;
     this.startTime     = threadInfo.StartTime;
     this.exitTime      = threadInfo.ExitTime;
     this.execTime      = threadInfo.ExecTimeNs;
     this.readyTime     = threadInfo.ReadyTimeNs;
     this.sleepTime     = threadInfo.SleepTimeNs;
     this.diskSleepTime = threadInfo.DiskSleepTimeNs;
     this.stoppedTime   = threadInfo.StoppedTimeNs;
     this.parkedTime    = threadInfo.ParkedTimeNs;
     this.idleTime      = threadInfo.IdleTimeNs;
 }
 public ContextSwitch(LTTngEvent data, ThreadInfo nextThread, ThreadInfo previousThread, uint cpu)
 {
     this.cpu         = cpu;
     this.nextPid     = nextThread.PidAsString();
     this.nextTid     = nextThread.Tid;
     this.previousPid = previousThread.PidAsString();
     this.previousTid = previousThread.Tid;
     this.priority    = data.Payload.ReadFieldAsInt32("_next_prio");
     if (nextThread.currentState == ThreadInfo.SchedulingState.Running)
     {
         this.readyingPid   = nextThread.readyingPid;
         this.readyingTid   = nextThread.readyingTid;
         this.readyTime     = data.Timestamp - nextThread.lastEventTimestamp;
         this.previousState = ThreadInfo.SchedulingStateToString(nextThread.previousState);
         if (nextThread.previousState == ThreadInfo.SchedulingState.Running ||
             nextThread.previousState == ThreadInfo.SchedulingState.NewlyCreated ||
             nextThread.previousState == ThreadInfo.SchedulingState.Unknown)
         {
             this.waitTime = new TimestampDelta(0);
         }
         else
         {
             this.waitTime = nextThread.previousWaitTime;
         }
     }
     else
     {
         this.readyingPid   = string.Empty;
         this.readyingTid   = string.Empty;
         this.readyTime     = new TimestampDelta(0);
         this.waitTime      = data.Timestamp - nextThread.lastEventTimestamp;
         this.previousState = ThreadInfo.SchedulingStateToString(nextThread.currentState);
     }
     this.nextCommand     = data.Payload.ReadFieldAsArray("_next_comm").GetValueAsString();
     this.previousCommand = data.Payload.ReadFieldAsArray("_prev_comm").GetValueAsString();
     this.switchInTime    = data.Timestamp;
     this.nextThreadPreviousSwitchOutTime = nextThread.previousSwitchOutTime;
 }