1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "SALOME_LoadRateManager.hxx"
28 string LoadRateManagerFirst::Find(const vector<string>& hosts,
29 MapOfParserResourcesType& resList)
31 if (hosts.size() == 0)
34 return string(hosts[0]);
37 string LoadRateManagerCycl::Find(const vector<string>& hosts,
38 MapOfParserResourcesType& resList)
40 static int imachine = 0;
43 // if empty list return empty string
44 if (hosts.size() == 0)
47 ParserResourcesType resource = resList[string(hosts[imachine])];
48 int nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes;
49 if( nbproc <= 0) nbproc = 1;
52 return string(hosts[imachine]);
57 if(imachine >= hosts.size())
59 return string(hosts[imachine]);
64 string LoadRateManagerAltCycl::Find(const vector<string>& hosts,
65 MapOfParserResourcesType& resList)
67 if (hosts.size() == 0)
70 std::string selected=hosts[0];
72 if(_numberOfUses.count(selected) != 0)
73 uses=_numberOfUses[selected];
77 for (std::vector<std::string>::const_iterator iter = hosts.begin(); iter != hosts.end(); iter++)
79 std::string machine=*iter;
80 if(_numberOfUses.count(machine) == 0)
81 _numberOfUses[machine]=0;
82 if(_numberOfUses[machine] < uses)
85 uses=_numberOfUses[machine];
89 _numberOfUses[selected]=_numberOfUses[selected]+1;
90 std::cerr << "selected: " << selected << " " << _numberOfUses[selected] << std::endl;