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:
parent
ae54ac290d
commit
68922c1eeb
3 changed files with 16 additions and 11 deletions
|
|
@ -31,14 +31,17 @@ namespace Server
|
||||||
{
|
{
|
||||||
int processorCount = Core.ProcessorCount;
|
int processorCount = Core.ProcessorCount;
|
||||||
|
|
||||||
|
#if Framework_4_0
|
||||||
|
if (processorCount > 2)
|
||||||
|
{
|
||||||
|
return new DynamicSaveStrategy();
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (processorCount > 16)
|
if (processorCount > 16)
|
||||||
{
|
{
|
||||||
#if Framework_4_0
|
|
||||||
return new DynamicSaveStrategy();
|
|
||||||
#else
|
|
||||||
return new ParallelSaveStrategy(processorCount);
|
return new ParallelSaveStrategy(processorCount);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new DualSaveStrategy();
|
return new DualSaveStrategy();
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,14 @@ using Server.Guilds;
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
public class StandardSaveStrategy : SaveStrategy {
|
public class StandardSaveStrategy : SaveStrategy {
|
||||||
|
public enum SaveOption
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Threaded
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SaveOption SaveType = SaveOption.Normal;
|
||||||
|
|
||||||
public override string Name {
|
public override string Name {
|
||||||
get { return "Standard"; }
|
get { return "Standard"; }
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +51,7 @@ namespace Server {
|
||||||
|
|
||||||
protected bool PermitBackgroundWrite { get { return _permitBackgroundWrite; } set { _permitBackgroundWrite = value; } }
|
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)
|
public override void Save(SaveMetrics metrics, bool permitBackgroundWrite)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,6 @@ using Server.Guilds;
|
||||||
|
|
||||||
namespace Server {
|
namespace Server {
|
||||||
public static class World {
|
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, Mobile> m_Mobiles;
|
||||||
private static Dictionary<Serial, Item> m_Items;
|
private static Dictionary<Serial, Item> m_Items;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue