LCOV - code coverage report
Current view: top level - eq/fabric - gpuInfo.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 5 5 100.0 %
Date: 2017-12-16 05:07:20 Functions: 2 2 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011, Stefan Eilemann <eile@eyescale.ch>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #ifndef EQFABRIC_GPUINFO_H
      19             : #define EQFABRIC_GPUINFO_H
      20             : 
      21             : #include <eq/fabric/pixelViewport.h>
      22             : #include <eq/fabric/types.h>
      23             : #include <iostream>
      24             : 
      25             : namespace eq
      26             : {
      27             : namespace fabric
      28             : {
      29             : /** A structure containing GPU-specific information. */
      30           4 : struct GPUInfo
      31             : {
      32             :     /** Default constructor pointing to default display. */
      33           4 :     GPUInfo()
      34           4 :         : port(LB_UNDEFINED_UINT32)
      35           4 :         , device(LB_UNDEFINED_UINT32)
      36             :     {
      37           4 :     }
      38             : 
      39             :     /** @return true if both infos are identical. @version 1.0 */
      40             :     bool operator==(const GPUInfo& rhs) const
      41             :     {
      42             :         return port == rhs.port && device == rhs.device && pvp == rhs.pvp;
      43             :     }
      44             : 
      45             :     /** @return true if both infos are not identical. @version 1.0 */
      46             :     bool operator!=(const GPUInfo& rhs) const
      47             :     {
      48             :         return port != rhs.port || device != rhs.device || pvp != rhs.pvp;
      49             :     }
      50             : 
      51             :     /** The display (GLX) or ignored (Win32, AGL). */
      52             :     uint32_t port;
      53             : 
      54             :     /** The screen (GLX), GPU (Win32) or virtual screen (AGL). */
      55             :     uint32_t device;
      56             : 
      57             :     /** The size and location of the GPU. */
      58             :     PixelViewport pvp;
      59             : 
      60             :     std::string hostname; //!< remote system  hostname, empty for local GPUs
      61             : };
      62             : 
      63             : inline std::ostream& operator<<(std::ostream& os, const GPUInfo& info)
      64             : {
      65             :     if (!info.hostname.empty())
      66             :         os << "hostname " << info.hostname << std::endl;
      67             :     if (info.port != LB_UNDEFINED_UINT32)
      68             :         os << "port     " << info.port << std::endl;
      69             :     if (info.device != LB_UNDEFINED_UINT32)
      70             :         os << "device   " << info.device << std::endl;
      71             :     if (info.pvp.isValid())
      72             :         os << "viewport " << info.pvp << std::endl;
      73             :     return os;
      74             : }
      75             : }
      76             : }
      77             : #endif // EQFABRIC_GPUINFO_H

Generated by: LCOV version 1.11