obmon  1.3.1
 All Classes Functions Variables Typedefs Enumerations Groups Pages
ObSensorGpu Class Reference

GPU Obmon sensor class. More...

#include <ObSensorGpu.h>

Inheritance diagram for ObSensorGpu:
ObSensor

Classes

struct  devStat_t
 Structure for device stat simplification. More...
 

Public Types

enum  SensorType { NONE, VALUE, SPEED, IGNORE }
 Enums for sensor type.
 

Public Member Functions

 ObSensorGpu (std::string _name={"gpu"})
 
virtual ~ObSensorGpu () override
 
bool init () override
 
void process () override
 Process function. More...
 
void speed (ObSensor *s1, ObSensor *s2, unsigned int timeout=1000) override
 Calculate time change (speed) More...
 
std::string json (const std::string name={"static"}) const override
 
virtual void update (unsigned int timeout) final
 
std::string name () const
 Returns name of sensor.
 
void type (SensorType t)
 Sets sensor type.
 
SensorType type () const
 Returns sensor type.
 
void enabled (bool e)
 Sets flag if sensor is enabled.
 
bool enabled () const
 Returns flag if sensor is enabled.
 
std::vector< ObSensor * > & sensors ()
 Return list of sensors.
 

Protected Attributes

std::shared_ptr< spdlog::logger > _logger
 Pointer to spd logger.
 
std::string _name
 Sensor name.
 
SensorType _type = SensorType::NONE
 Sensor type.
 
bool _enabled
 Is enabled.
 
ObSensor_first {}
 Pointer to first sensor.
 
ObSensor_second {}
 Pointer to second sensor.
 
ObSensor_change {}
 Pointer to change sensor.
 
std::vector< ObSensor * > _sensors {}
 List of subsensors.
 

Private Types

typedef struct
ObSensorGpu::devStat_t 
devStat_t
 Structure for device stat simplification.
 

Private Member Functions

std::string getProcUser (unsigned int) const
 

Private Attributes

unsigned int _count = 0
 Count of NVIDIA devices.
 
std::vector< nvmlDevice_t > fDevices
 NVML device handles.
 
std::vector< devStat_tfStatus
 Device statistics.
 
std::vector< std::vector
< nvmlProcessInfo_t > > 
fComputeProc
 Compute processes (ex. CUDA Applications)
 
std::vector< std::vector
< nvmlProcessInfo_t > > 
fGraphicsProc
 Graphics processes (ex. desktop env)
 

Detailed Description

GPU Obmon sensor class.

Author
Martin Vala mvala.nosp@m.@cer.nosp@m.n.ch
Branislav Beke beke..nosp@m.priv.nosp@m.ate@y.nosp@m.ande.nosp@m.x.com

Definition at line 23 of file ObSensorGpu.h.

Constructor & Destructor Documentation

ObSensorGpu::ObSensorGpu ( std::string  _name = {"gpu"})

Constructor

Definition at line 3 of file ObSensorGpu.cpp.

Referenced by init().

ObSensorGpu::~ObSensorGpu ( )
overridevirtual

Destructor

Definition at line 8 of file ObSensorGpu.cpp.

Member Function Documentation

std::string ObSensorGpu::getProcUser ( unsigned int  pid) const
private

Get username of user, who started process

Definition at line 195 of file ObSensorGpu.cpp.

Referenced by json().

bool ObSensorGpu::init ( )
overridevirtual
std::string ObSensorGpu::json ( const std::string  name = {"static"}) const
overridevirtual

Returns current sensor representation in json format

Reimplemented from ObSensor.

Definition at line 99 of file ObSensorGpu.cpp.

References _count, ObSensor::_logger, fComputeProc, fGraphicsProc, fStatus, getProcUser(), and ObSensor::type().

void ObSensorGpu::process ( )
overridevirtual

Process function.

Process sensor function

Reimplemented from ObSensor.

Definition at line 64 of file ObSensorGpu.cpp.

References _count, ObSensor::_logger, ObSensor::_name, fComputeProc, fDevices, fGraphicsProc, and fStatus.

void ObSensorGpu::speed ( ObSensor ,
ObSensor ,
unsigned int  = 1000 
)
overridevirtual

Calculate time change (speed)

Calculate change over time (speed)

Reimplemented from ObSensor.

Definition at line 90 of file ObSensorGpu.cpp.

void ObSensor::update ( unsigned int  timeout)
finalvirtualinherited

Update sensor function

Definition at line 33 of file ObSensor.cpp.

References ObSensor::_first, ObSensor::_second, ObSensor::_sensors, ObSensor::enabled(), and ObSensor::type().


The documentation for this class was generated from the following files: