This reverts commit 179cb50557.
This commit is contained in:
parent
179cb50557
commit
c2ecc76457
588 changed files with 16260 additions and 10926 deletions
|
|
@ -87,7 +87,8 @@ namespace Server
|
|||
get => m_Priority;
|
||||
set
|
||||
{
|
||||
m_PrioritySet |= !m_PrioritySet;
|
||||
if (!m_PrioritySet)
|
||||
m_PrioritySet = true;
|
||||
|
||||
if (m_Priority != value)
|
||||
{
|
||||
|
|
@ -195,13 +196,17 @@ namespace Server
|
|||
if (ts >= TimeSpan.FromSeconds(5.0))
|
||||
return TimerPriority.TwoFiftyMS;
|
||||
|
||||
public static TimerPriority ComputePriority(TimeSpan ts) =>
|
||||
ts >= TimeSpan.FromMinutes(1.0) ? TimerPriority.FiveSeconds :
|
||||
ts >= TimeSpan.FromSeconds(10.0) ? TimerPriority.OneSecond :
|
||||
ts >= TimeSpan.FromSeconds(5.0) ? TimerPriority.TwoFiftyMS :
|
||||
ts >= TimeSpan.FromSeconds(2.5) ? TimerPriority.FiftyMS :
|
||||
ts >= TimeSpan.FromSeconds(1.0) ? TimerPriority.TwentyFiveMS :
|
||||
ts >= TimeSpan.FromSeconds(0.5) ? TimerPriority.TenMS : TimerPriority.EveryTick;
|
||||
if (ts >= TimeSpan.FromSeconds(2.5))
|
||||
return TimerPriority.FiftyMS;
|
||||
|
||||
if (ts >= TimeSpan.FromSeconds(1.0))
|
||||
return TimerPriority.TwentyFiveMS;
|
||||
|
||||
if (ts >= TimeSpan.FromSeconds(0.5))
|
||||
return TimerPriority.TenMS;
|
||||
|
||||
return TimerPriority.EveryTick;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
|
@ -235,11 +240,11 @@ namespace Server
|
|||
|
||||
public class TimerThread
|
||||
{
|
||||
private static readonly Dictionary<Timer, TimerChangeEntry> m_Changed = new Dictionary<Timer, TimerChangeEntry>();
|
||||
private static Dictionary<Timer, TimerChangeEntry> m_Changed = new Dictionary<Timer, TimerChangeEntry>();
|
||||
|
||||
private static readonly long[] m_NextPriorities = new long[8];
|
||||
private static long[] m_NextPriorities = new long[8];
|
||||
|
||||
private static readonly long[] m_PriorityDelays = {
|
||||
private static long[] m_PriorityDelays = {
|
||||
0,
|
||||
10,
|
||||
25,
|
||||
|
|
@ -261,7 +266,7 @@ namespace Server
|
|||
new List<Timer>()
|
||||
};
|
||||
|
||||
private static readonly AutoResetEvent m_Signal = new AutoResetEvent(false);
|
||||
private static AutoResetEvent m_Signal = new AutoResetEvent(false);
|
||||
|
||||
public static void DumpInfo(TextWriter tw)
|
||||
{
|
||||
|
|
@ -284,9 +289,14 @@ namespace Server
|
|||
list.Add(t);
|
||||
}
|
||||
|
||||
foreach (var (key, list) in hash)
|
||||
foreach (KeyValuePair<string, List<Timer>> kv in hash)
|
||||
{
|
||||
string key = kv.Key;
|
||||
List<Timer> list = kv.Value;
|
||||
|
||||
tw.WriteLine("Type: {0}; Count: {1}; Percent: {2}%", key, list.Count,
|
||||
(int)(100 * (list.Count / (double)m_Timers[i].Count)));
|
||||
}
|
||||
|
||||
tw.WriteLine();
|
||||
tw.WriteLine();
|
||||
|
|
@ -296,7 +306,9 @@ namespace Server
|
|||
public static void Change(Timer t, int newIndex, bool isAdd)
|
||||
{
|
||||
lock (m_Changed)
|
||||
{
|
||||
m_Changed[t] = TimerChangeEntry.GetInstance(t, newIndex, isAdd);
|
||||
}
|
||||
|
||||
m_Signal.Set();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue