Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1691 for code/branches/gui/src


Ignore:
Timestamp:
Aug 31, 2008, 9:10:28 PM (16 years ago)
Author:
rgrieder
Message:
  • Server GameState works. But the Client has problems that don't seem to be related to GameStates.
  • added command line argument: limitToCPU for windows at the moment. 0 disables limitations, 1 limits to core 1, 2 to core 2, etc. if possible.
Location:
code/branches/gui/src/orxonox/gamestates
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/gamestates/GSClient.cc

    r1674 r1691  
    3636namespace orxonox
    3737{
    38     SetCommandLineArgument(ip, "127.0.0.0").setInformation("#.#.#.#");
     38    SetCommandLineArgument(ip, "127.0.0.1").setInformation("#.#.#.#");
    3939
    4040    GSClient::GSClient()
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r1689 r1691  
    6565{
    6666    SetCommandLineArgument(dataPath, "").setInformation("PATH");
     67    SetCommandLineArgument(limitToCPU, 1).setInformation("0: off | #cpu");
    6768
    6869    GSRoot::GSRoot()
     
    130131        // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
    131132        // the timer though).
    132         setThreadAffinity();
     133        int limitToCPU;
     134        CommandLine::getValue("limitToCPU", &limitToCPU);
     135        if (limitToCPU > 0)
     136            setThreadAffinity((unsigned int)(limitToCPU - 1));
    133137
    134138        // add console commands
     
    170174    /**
    171175    @note
    172         The code of this function has been copied from OGRE, an open source graphics engine.
     176        The code of this function has been copied and adjusted from OGRE, an open source graphics engine.
    173177            (Object-oriented Graphics Rendering Engine)
    174178        For the latest info, see http://www.ogre3d.org/
     
    178182        OGRE is licensed under the LGPL. For more info, see ogre license info.
    179183    */
    180     void GSRoot::setThreadAffinity()
     184    void GSRoot::setThreadAffinity(unsigned int limitToCPU)
    181185    {
    182186#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     
    195199                    procMask = 1;
    196200
    197             // Find the lowest core that this process uses
     201        // if the core specified with limitToCPU is not available, take the lowest one
     202        if (!(procMask & (1 << limitToCPU)))
     203            limitToCPU = 0;
     204
     205            // Find the lowest core that this process uses and limitToCPU suggests
    198206        DWORD threadMask = 1;
    199             while ((threadMask & procMask) == 0)
     207            while ((threadMask & procMask) == 0 || (threadMask < (1u << limitToCPU)))
    200208                    threadMask <<= 1;
    201209
  • code/branches/gui/src/orxonox/gamestates/GSRoot.h

    r1689 r1691  
    5858        void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
    5959            bool maskDebug, const std::string& logName);
    60         void setThreadAffinity();
     60        void setThreadAffinity(unsigned int limitToCPU);
    6161        void setupOgre();
    6262
Note: See TracChangeset for help on using the changeset viewer.