Update of /cvsroot/playerstage/code/player/server/drivers/health/statgrab
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6470/server/drivers/health/statgrab

Modified Files:
        statgrab_health.cpp 
Log Message:
Removed deprecated energy, sound and truth interfaces.



Index: statgrab_health.cpp
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/health/statgrab/statgrab_health.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** statgrab_health.cpp 21 May 2007 14:24:57 -0000      1.3
--- statgrab_health.cpp 4 Aug 2007 03:12:07 -0000       1.4
***************
*** 15,19 ****
   *
   */
!  
  /** Player driver for the health of a robot.
    *
--- 15,19 ----
   *
   */
! 
  /** Player driver for the health of a robot.
    *
***************
*** 24,31 ****
  /** @{ */
  /**
!   * @defgroup driver_statgrab statgrab 
!  
  The @p health driver allows for a user to get general systems data concerning 
a specific robot.
! Allows a user to look at cpu and memory usage of the robot. 
  
  @par Provides
--- 24,31 ----
  /** @{ */
  /**
!   * @defgroup driver_statgrab statgrab
! 
  The @p health driver allows for a user to get general systems data concerning 
a specific robot.
! Allows a user to look at cpu and memory usage of the robot.
  
  @par Provides
***************
*** 36,55 ****
  - frequency (int)
    - Default: 100
!    
  @par Notes
  
  @par libstatgrab:
! The driver uses the library libstatgrab in order to fetch data concerning the 
cpu and the 
! memory usage. Documentation on this library can be found at: 
http://www.i-scream.org/libstatgrab/. 
!  
  @par Example: The following configuration file should demonstrate the use of 
this
! driver. 
!  
  @include health.cfg
!  
  @todo
  - Test this code more!
  - Allow for the driver to return the temperature of the system in multiple 
location of the robot.
! - Also allow for the battery voltage to be monitored. 
  */
  
--- 36,55 ----
  - frequency (int)
    - Default: 100
! 
  @par Notes
  
  @par libstatgrab:
! The driver uses the library libstatgrab in order to fetch data concerning the 
cpu and the
! memory usage. Documentation on this library can be found at: 
http://www.i-scream.org/libstatgrab/.
! 
  @par Example: The following configuration file should demonstrate the use of 
this
! driver.
! 
  @include health.cfg
! 
  @todo
  - Test this code more!
  - Allow for the driver to return the temperature of the system in multiple 
location of the robot.
! - Also allow for the battery voltage to be monitored.
  */
  
***************
*** 84,88 ****
    // Create and return a new instance of this driver
    return((Driver*)(new StatGrabDriver(cf, section)));
!   
  }
  
--- 84,88 ----
    // Create and return a new instance of this driver
    return((Driver*)(new StatGrabDriver(cf, section)));
! 
  }
  
***************
*** 104,122 ****
  
    // For Health Interface
!   if(cf->ReadDeviceAddr(&mHealthId, section, "provides", 
                          PLAYER_HEALTH_CODE, -1, NULL) == 0)
    {
      if(this->AddInterface(mHealthId))
      {
!       this->SetError(-1);    
        return;
      }
    }
  
!   
!   // Allow to just have to change the config file if you want to adjust the 
sleep 
    // duration.
!   mSleep = static_cast<int32_t>((1e6/cf->ReadInt(section, "frequency", 
100)));    
!   
    return;
  }
--- 104,122 ----
  
    // For Health Interface
!   if(cf->ReadDeviceAddr(&mHealthId, section, "provides",
                          PLAYER_HEALTH_CODE, -1, NULL) == 0)
    {
      if(this->AddInterface(mHealthId))
      {
!       this->SetError(-1);
        return;
      }
    }
  
! 
!   // Allow to just have to change the config file if you want to adjust the 
sleep
    // duration.
!   mSleep = static_cast<int32_t>((1e6/cf->ReadInt(section, "frequency", 100)));
! 
    return;
  }
***************
*** 129,133 ****
    sg_init();
    /* Drop setuid/setgid privileges. */
!   if (sg_drop_privileges() != 0) 
    {
      perror("Error. Failed to drop privileges");
--- 129,133 ----
    sg_init();
    /* Drop setuid/setgid privileges. */
!   if (sg_drop_privileges() != 0)
    {
      perror("Error. Failed to drop privileges");
***************
*** 136,140 ****
  
    puts("Health driver ready");
!   
    StartThread();
  
--- 136,140 ----
  
    puts("Health driver ready");
! 
    StartThread();
  
***************
*** 149,158 ****
    puts("Shutting health driver down");
  
-   sg_shutdown();
    // Stop and join the driver thread
    StopThread();
  
    puts("Health driver has been shutdown");
!   
    return(0);
  }
--- 149,157 ----
    puts("Shutting health driver down");
  
    // Stop and join the driver thread
    StopThread();
  
    puts("Health driver has been shutdown");
! 
    return(0);
  }
***************
*** 162,166 ****
  void StatGrabDriver::Main()
  {
!  
    // The main loop; interact with the device here
    for(;;)
--- 161,165 ----
  void StatGrabDriver::Main()
  {
! 
    // The main loop; interact with the device here
    for(;;)
***************
*** 168,180 ****
      // test if we are supposed to cancel
      pthread_testcancel();
!     
      usleep(mSleep);
!     
      ProcessMessages();
!     
      // Write outgoing data
      RefreshData();
  
!     
    }
    return;
--- 167,179 ----
      // test if we are supposed to cancel
      pthread_testcancel();
! 
      usleep(mSleep);
! 
      ProcessMessages();
! 
      // Write outgoing data
      RefreshData();
  
! 
    }
    return;
***************
*** 190,213 ****
  
        cpuIdle =  cpu_percent->idle;
!       mHealth.cpu_usage.idle = cpuIdle; 
        cpuServer = cpu_percent->kernel + cpu_percent->iowait + 
cpu_percent->swap;
!       mHealth.cpu_usage.system = cpuServer; 
        cpuUser = cpu_percent->nice+ cpu_percent->user;
        mHealth.cpu_usage.user = cpuUser;
  
!       
!       
        //Virtual Memory
!       mem_data     = sg_get_mem_stats();    
!       swap_stats   = sg_get_swap_stats();    
!       
        mHealth.mem.total = mem_data->total;
        mHealth.mem.used =  mem_data->used;
!       mHealth.mem.free = mem_data->free;    
!       
        mHealth.swap.total = swap_stats->total;
        mHealth.swap.used = swap_stats->used;
        mHealth.swap.free = swap_stats->free;
!     
     // Other data which should be retrieved here!
  
--- 189,212 ----
  
        cpuIdle =  cpu_percent->idle;
!       mHealth.cpu_usage.idle = cpuIdle;
        cpuServer = cpu_percent->kernel + cpu_percent->iowait + 
cpu_percent->swap;
!       mHealth.cpu_usage.system = cpuServer;
        cpuUser = cpu_percent->nice+ cpu_percent->user;
        mHealth.cpu_usage.user = cpuUser;
  
! 
! 
        //Virtual Memory
!       mem_data     = sg_get_mem_stats();
!       swap_stats   = sg_get_swap_stats();
! 
        mHealth.mem.total = mem_data->total;
        mHealth.mem.used =  mem_data->used;
!       mHealth.mem.free = mem_data->free;
! 
        mHealth.swap.total = swap_stats->total;
        mHealth.swap.used = swap_stats->used;
        mHealth.swap.free = swap_stats->free;
! 
     // Other data which should be retrieved here!
  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to