Changeset 1866


Ignore:
Timestamp:
Aug 24, 2010, 6:57:49 PM (11 years ago)
Author:
kopal
Message:

Schedulers amount is now configurable by Settings

Location:
trunk/CrypPlugins/WorkspaceManager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/Execution/ExecutionEngine.cs

    r1846 r1866  
    7272        /// </summary>
    7373        /// <param name="workspaceModel"></param>
    74         public void Execute(WorkspaceModel workspaceModel)
     74        public void Execute(WorkspaceModel workspaceModel, int amountSchedulers)
    7575        {
    7676            if (!IsRunning)
     
    7878                IsRunning = true;
    7979                this.workspaceModel = workspaceModel;
    80                 int amountSchedulers = System.Environment.ProcessorCount * 2;
     80
     81                if (amountSchedulers <= 0)
     82                {
     83                    amountSchedulers = 1;
     84                }
    8185
    8286                //Here we create n = "ProcessorsCount * 2" Gears4Net schedulers
  • trunk/CrypPlugins/WorkspaceManager/WorkspaceManager.cs

    r1847 r1866  
    410410                }
    411411
     412                int schedulers=0;
     413                try
     414                {
     415                   schedulers = int.Parse(((WorkspaceManagerSettings)this.Settings).Schedulers);
     416                    if (ExecutionEngine.SleepTime < 0)
     417                    {
     418                        GuiLogMessage("Schedulers can not be <=0; Use Schedulers = 1", NotificationLevel.Warning);
     419                        schedulers = 1;
     420                    }
     421                }
     422                catch (Exception ex)
     423                {
     424                    GuiLogMessage("Could not set Schedulers: " + ex.Message, NotificationLevel.Warning);
     425                    schedulers = 1;
     426                }
     427
    412428                ExecutionEngine.BenchmarkPlugins = ((WorkspaceManagerSettings)this.Settings).BenchmarkPlugins;
    413429
    414                 ExecutionEngine.Execute(WorkspaceModel);               
     430                ExecutionEngine.Execute(WorkspaceModel, schedulers);               
    415431            }
    416432            catch (Exception ex)
  • trunk/CrypPlugins/WorkspaceManager/WorkspaceManagerSettings.cs

    r1836 r1866  
    1212        #region ISettings Members
    1313        private bool hasChanges = false;
     14
     15        public WorkspaceManagerSettings()
     16        {
     17            this.Schedulers = "" + System.Environment.ProcessorCount * 2;
     18        }
    1419
    1520        public bool HasChanges
     
    5358                OnPropertyChanged("SleepTime");
    5459            }
     60        }
     61
     62        private String schedulers = "0";
     63        [TaskPane("Schedulers", "The amount of parallel gears4net schedulers.", null, 1, false, DisplayLevel.Beginner, ControlType.TextBox)]
     64        public String Schedulers
     65        {
     66            get
     67            {
     68                return schedulers;
     69            }
     70            set
     71            {
     72                schedulers = value;
     73                OnPropertyChanged("Schedulers");
     74            }
    5575        }     
    56 
    5776
    5877        private bool benchmarkPlugins = false;
Note: See TracChangeset for help on using the changeset viewer.