Moving World.SaveOption to StandardSaveStrategy.SaveOption, as it's only used and applicable there. Setting Dynamic Save Strategy to run whenever there are more than two cores.

This commit is contained in:
asayre 2012-02-11 04:36:54 +00:00
parent ae54ac290d
commit 68922c1eeb
3 changed files with 16 additions and 11 deletions

View file

@ -31,14 +31,17 @@ namespace Server
{
int processorCount = Core.ProcessorCount;
#if Framework_4_0
if (processorCount > 2)
{
return new DynamicSaveStrategy();
}
#else
if (processorCount > 16)
{
#if Framework_4_0
return new DynamicSaveStrategy();
#else
return new ParallelSaveStrategy(processorCount);
#endif
}
#endif
else
{
return new DualSaveStrategy();

View file

@ -30,6 +30,14 @@ using Server.Guilds;
namespace Server {
public class StandardSaveStrategy : SaveStrategy {
public enum SaveOption
{
Normal,
Threaded
}
public static SaveOption SaveType = SaveOption.Normal;
public override string Name {
get { return "Standard"; }
}
@ -43,7 +51,7 @@ namespace Server {
protected bool PermitBackgroundWrite { get { return _permitBackgroundWrite; } set { _permitBackgroundWrite = value; } }
protected bool UseSequentialWriters { get { return (World.SaveType == World.SaveOption.Normal || !_permitBackgroundWrite); } }
protected bool UseSequentialWriters { get { return (StandardSaveStrategy.SaveType == SaveOption.Normal || !_permitBackgroundWrite); } }
public override void Save(SaveMetrics metrics, bool permitBackgroundWrite)
{

View file

@ -33,12 +33,6 @@ using Server.Guilds;
namespace Server {
public static class World {
public enum SaveOption {
Normal,
Threaded
}
public static SaveOption SaveType = SaveOption.Normal;
private static Dictionary<Serial, Mobile> m_Mobiles;
private static Dictionary<Serial, Item> m_Items;