public void Stop() { if (!mRunning) { return; } mRunning = false; TimerThread.RemoveTimer(this); TimerProfile prof = GetProfile(); if (prof != null) { prof.Stopped++; } }
public TimerProfile GetProfile() { if (!Core.Profiling) { return(null); } string name = ToString(); if (name == null) { name = "null"; } return(TimerProfile.Acquire(name)); }
public TimerProfile method_0() { string key = this.ToString(); if (key == null) { key = "null"; } TimerProfile profile = null; dictionary_0.TryGetValue(key, out profile); if (profile == null) { dictionary_0[key] = profile = new TimerProfile(); } return(profile); }
public void Start() { if (mRunning) { return; } mRunning = true; TimerThread.AddTimer(this); TimerProfile prof = GetProfile(); if (prof != null) { prof.Started++; } }
public bool StartTimer(TimerProfile profile) { lock (this.timerLock) { this.CancelTimer(); if (!this.ChooseProfile(profile)) { return(false); } this.timer.Active = true; this.timer.Notifications = 0L; this.timer.CurrentInterval = this.timer.Policy.InitialDelay; this.timer.NextNotification = this.state.ElapsedTime + this.timer.CurrentInterval; this.state.TimerManager.Add(this, this.timer.Instance); } return(true); }
public static void Slice() { Queue <TimerClass> queue = queue_0; lock (queue) { int_3 = queue_0.Count; int num = 0; Stopwatch stopwatch = null; while (num < int_2) { if (queue_0.Count == 0) { break; } if (World.jlMsg == 1) { Form1.WriteLine(0, "Slice"); } TimerClass local1 = queue_0.Dequeue(); TimerProfile profile = local1.method_0(); if (profile != null) { if (stopwatch == null) { stopwatch = Stopwatch.StartNew(); } else { stopwatch.Start(); } } local1.vmethod_1(); local1.bool_1 = false; num++; if (profile != null) { profile.method_3(stopwatch.Elapsed); stopwatch.Reset(); } } } }
private bool ChooseProfile(TimerProfile profile) { bool flag = true; switch (profile) { case TimerProfile.Preparing: { ParticipantEnlistment enlistment = (ParticipantEnlistment)this.enlistment; TimeSpan span = enlistment.TimeoutEstimate - this.state.ElapsedTime; if (span >= this.state.Config.PreparePolicy.InitialDelay) { this.timer.Instance = TimerInstance.Preparing; this.timer.Policy = this.state.Config.PreparePolicy; return(flag); } return(false); } case TimerProfile.Prepared: this.timer.Instance = TimerInstance.Prepared; this.timer.Policy = this.state.Config.PreparedPolicy; return(flag); case TimerProfile.Replaying: this.timer.Instance = TimerInstance.Replaying; this.timer.Policy = this.state.Config.ReplayPolicy; return(flag); case TimerProfile.Committing: this.timer.Instance = TimerInstance.Committing; this.timer.Policy = this.state.Config.CommitPolicy; return(flag); case TimerProfile.VolatileOutcomeAssurance: this.timer.Instance = TimerInstance.VolatileOutcomeAssurance; this.timer.Policy = this.state.Config.VolatileOutcomePolicy; return(flag); } DiagnosticUtility.FailFast("Invalid TimerProfile"); return(flag); }
private bool ChooseProfile(TimerProfile profile) { bool flag = true; switch (profile) { case TimerProfile.Preparing: { ParticipantEnlistment enlistment = (ParticipantEnlistment) this.enlistment; TimeSpan span = enlistment.TimeoutEstimate - this.state.ElapsedTime; if (span >= this.state.Config.PreparePolicy.InitialDelay) { this.timer.Instance = TimerInstance.Preparing; this.timer.Policy = this.state.Config.PreparePolicy; return flag; } return false; } case TimerProfile.Prepared: this.timer.Instance = TimerInstance.Prepared; this.timer.Policy = this.state.Config.PreparedPolicy; return flag; case TimerProfile.Replaying: this.timer.Instance = TimerInstance.Replaying; this.timer.Policy = this.state.Config.ReplayPolicy; return flag; case TimerProfile.Committing: this.timer.Instance = TimerInstance.Committing; this.timer.Policy = this.state.Config.CommitPolicy; return flag; case TimerProfile.VolatileOutcomeAssurance: this.timer.Instance = TimerInstance.VolatileOutcomeAssurance; this.timer.Policy = this.state.Config.VolatileOutcomePolicy; return flag; } DiagnosticUtility.FailFast("Invalid TimerProfile"); return flag; }
public TimerParticipantEvent(ParticipantEnlistment participant, TimerProfile profile) : base(participant) { this.profile = profile; }
public TimerCoordinatorEvent(CoordinatorEnlistment coordinator, TimerProfile profile) : base(coordinator) { this.profile = profile; }
public void TimerProfileConstructorTest() { TimerProfile target = new TimerProfile(); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
protected override void OnTimer(TimerProfile profile) { base.OnTimer(profile); base.synchronization.Enqueue(new TimerCoordinatorEvent(this.coordinator, profile)); }
public TimerInstance(TimerProfile profile) { this.profile = profile; }
public TimerParticipantEvent(ParticipantEnlistment participant, TimerProfile profile) : base(participant) { this.profile = profile; }
public bool StartTimer(TimerProfile profile) { lock (this.timerLock) { this.CancelTimer(); if (!this.ChooseProfile(profile)) { return false; } this.timer.Active = true; this.timer.Notifications = 0L; this.timer.CurrentInterval = this.timer.Policy.InitialDelay; this.timer.NextNotification = this.state.ElapsedTime + this.timer.CurrentInterval; this.state.TimerManager.Add(this, this.timer.Instance); } return true; }
protected virtual void OnTimer(TimerProfile profile) { }
protected override void OnTimer(TimerProfile profile) { base.OnTimer(profile); base.synchronization.Enqueue(new TimerCoordinatorEvent(this.coordinator, profile)); }
public TimerInstance(TimerProfile profile) { this.profile = profile; }
protected override void OnTimer(TimerProfile profile) { base.OnTimer(profile); base.synchronization.Enqueue(new TimerParticipantEvent(this.participant, profile)); }
protected virtual void OnTimer(TimerProfile profile) { }