19#define PROCSTATFILE "/proc/stat"
22#ifndef PROCMEMINFOFILE
23#define PROCMEMINFOFILE "/proc/meminfo"
26#ifndef PROCNETSTATFILE
27#define PROCNETSTATFILE "/proc/net/dev"
30#define String_startsWith(s, match) (strstr((s), (match)) == (s))
53#include <sensors/sensors.h>
97#define EVID_MONITOR 63
103 {
"${HOSTNAME}_msysmon", {
227std::vector<GPU*>
GPUs;
236 return "The operation was successful";
238 return "was not first initialized with nvmlInit()";
240 return "A supplied argument is invalid";
242 return "The requested operation is not available on target device";
244 return "The current user does not have permission for operation";
246 return"Deprecated: Multiple initializations are now allowed through ref counting";
248 return "A query to find an object was unsuccessful";
250 return "An input argument is not large enough";
252 return "A device’s external power cables are not properly attached";
254 return "NVIDIA driver is not loaded";
256 return "User provided timeout passed";
258 return "NVIDIA Kernel detected an interrupt issue with a GPU";
260 return "NVML Shared Library couldn’t be found or loaded";
262 return"Local version of NVML doesn’t implement this function";
264 return "infoROM is corrupted";
266 return "The GPU has fallen off the bus or has otherwise become inaccessible.";
268 return "The GPU requires a reset before it can be used again";
270 return "The GPU control device has been blocked by the operating system/cgroups.";
272 return "RM detects a driver/library version mismatch.";
274 return "An operation cannot be performed because the GPU is currently in use.";
276 return "Insufficient memory.";
280 return "The requested vgpu operation is not available on target device, becasue ECC is enabled.";
282 return "An internal driver error occurred";
285 return "Unknown error";
306#define NVML_TRY(code) nvml_try(code, #code)
312 "#00AAFF",
"#FF9000",
"#FF00A0",
"#00C030",
313 "#A0C0D0",
"#D0A060",
"#C04010",
"#807060",
314 "#F0C000",
"#2090A0",
"#D040D0",
"#90B000",
315 "#B0B040",
"#B0B0FF",
"#FFA0A0",
"#A0FFA0"};
318#ifdef HAVE_LM_SENSORS
350 std::vector<MySensor*>
Fans;
359 printf(
"Issue with sensors\n");
409 sprintf(path,
"/History/Display/msysmon/%s-Temperature/Variables",
equipment[0].
info.frontend_host);
411 char vars[size*
NVARS];
427 char vars[size*
NVARS];
441 char vars[size*
NVARS];
452 sprintf(path,
"/History/Display/msysmon/%s-Temperature/Timescale",
equipment[0].
info.frontend_host);
456 sprintf(path,
"/History/Display/msysmon/%s-Temperature/Minimum",
equipment[0].
info.frontend_host);
459 sprintf(path,
"/History/Display/msysmon/%s-Temperature/Maximum",
equipment[0].
info.frontend_host);
577 char vars[size*
NVARS];
594 char vars[size*
NVARS];
596 sprintf(vars+size*0,
"NICE CPU Load (%%)");
597 sprintf(vars+size*1,
"USER CPU Load (%%)");
598 sprintf(vars+size*2,
"SYSTEM CPU Load (%%)");
599 sprintf(vars+size*3,
"Memory Usage (%%)");
600 sprintf(vars+size*4,
"Swap Usage (%%)");
611 char vars[size*
NVARS];
646 char vars[size*
NVARS];
648#ifdef CLASSIC_CPU_VARS
653 int t=
'0'+(
icpu%100)/10;
683 char vars[size*
NVARS];
686 sprintf(vars+size*
i,
"CPU%d Load (%%)",
i+1);
697 char vars[size*
NVARS];
731 char vars[size*
NVARS];
747 char vars[size*
NVARS];
763 char vars[size*
NVARS];
803 char vars[size*
NVARS];
823 char vars[size*
NVARS];
827 sprintf(vars+size*0+
i*size*5,
"GPU %d Temperature (C)",
i);
828 sprintf(vars+size*1+
i*size*5,
"GPU %d FAN (%%)",
i);
829 sprintf(vars+size*2+
i*size*5,
"GPU %d Power (W)",
i);
830 sprintf(vars+size*3+
i*size*5,
"GPU %d Utilisation (%%)",
i);
831 sprintf(vars+size*4+
i*size*5,
"GPU %d Memory Usage (%%)",
i);
843 char vars[size*
NVARS];
871 printf(
"frontend_init!\n");
901 for (
int i=0;
i<255;
i++)
903 if (!buffer[
i])
break;
907 r->
face=std::string(buffer,&buffer[
i]);
911 t->
face=std::string(buffer,&buffer[
i]);
932#ifdef HAVE_LM_SENSORS
935 sensors->BuildHostTemperaturePlot();
1015 printf(
"interrupt_configure!\n");
1047 const char*s =
fgets(buffer, 255,
file);
1051 sscanf(buffer,
"cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &
usertime, &
nicetime, &
systemtime, &
idletime, &
ioWait, &
irq, &
softIrq, &
steal, &
guest, &
guestnice);
1053 sscanf(buffer,
"cpu%4d %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &
cpuid, &
usertime, &
nicetime, &
systemtime, &
idletime, &
ioWait, &
irq, &
softIrq, &
steal, &
guest, &
guestnice);
1094#include <sys/time.h>
1114 const char*s =
fgets(buffer, 255,
file);
1120 sscanf(buffer,
"%[^:]: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
InterfaceName, &
rbytes, &
rpackets, &
rerrs, &
rdrop, &
rfifo, &
rframe, &
rcompressed, &
rmulticast,&
sbytes, &
spackets, &
serrs, &
sdrop, &
sfifo, &
sframe, &
scompressed, &
smulticast);
1123 printf(
"Intput: %s\n",buffer);
1124 printf(
"Output: %s: %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu %16lu\n\n",
InterfaceName,
rbytes,
rpackets,
rerrs,
rdrop,
rfifo,
rframe,
rcompressed,
rmulticast,
sbytes,
spackets,
serrs,
sdrop,
sfifo,
sframe,
scompressed,
smulticast);
1125 printf(
"-------------------------------------------------------------------------------\n");
1200 printf(
"Initialising NVIDIA monitoring\n");
1206 for(
unsigned i = 0;
i <
nGPUs; ++
i) {
1248 &
dev->temperature));
1285#ifdef CLASSIC_CPU_VARS
1287 for (
int j=0;
j<4;
j++)
1299 for (
int j=0;
j<4;
j++)
1307 char name[5]=
"LOAD";
1312 int t=
'0'+(
i%100)/10;
1325 for (
int k=0;
k<4;
k++)
1387 for (
int k=0;
k<4;
k++)
1397#ifdef HAVE_LM_SENSORS
1398 pevent =
sensors->ReadAndLogSensors(pevent);
1405 char name[5]=
"NETR";
1432 unsigned long long int usedMem;
1433 unsigned long long int freeMem;
1446 switch (buffer[0]) {
1481 printf(
"-----------------------------\n");
1484 printf(
"-----------------------------\n");
1506 *t=
GPUs[
i]->temperature;
1524 *t=
GPUs[
i]->power_usage/1000;
1533 *t=
GPUs[
i]->util.gpu;
INT bk_close(void *event, void *pdata)
void bk_init32(void *event)
void bk_create(void *event, const char *name, WORD type, void **pdata)
INT bk_size(const void *event)
INT cm_register_function(INT id, INT(*func)(INT, void **))
#define CMD_INTERRUPT_ATTACH
#define CMD_INTERRUPT_DISABLE
#define CMD_INTERRUPT_ENABLE
#define CMD_INTERRUPT_DETACH
INT ss_sleep(INT millisec)
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
#define equipment(name, id, type, source, readon, period, readout, cd, driver)
int gettimeofday(struct timeval *tp, void *tzp)
INT rpc_callback(INT index, void *prpc_param[])
const char * frontend_file_name
INT frontend_exit()
Frontend exit.
INT frontend_init()
Frontend initialization.
std::vector< CPUData * > cpus
int read_system_load(char *pevent, int off)
INT interrupt_configure(INT cmd, INT source, PTYPE adr)
std::vector< NetStat * > NetReceive
unsigned long long int nicetime
BOOL equipment_common_overwrite
INT poll_event(INT source, INT count, BOOL test)
unsigned long long int idletime
#define String_startsWith(s, match)
const char * frontend_name
int networkInterfaceCount
void BuildHostHistoryPlot()
INT begin_of_run(INT run_number, char *error)
Begin of Run.
INT frontend_loop()
Frontend loop.
std::vector< NetStat * > NetTransmit
INT end_of_run(INT run_number, char *error)
End of Run.
unsigned long long int systemtime
unsigned long long int usertime
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
unsigned long long int ioWaitPeriod
unsigned long long int ioWaitTime
unsigned long long int softIrqTime
unsigned long long int userPeriod
unsigned long long int totalPeriod
unsigned long long int stealPeriod
unsigned long long int guestPeriod
unsigned long long int systemAllTime
unsigned long long int irqPeriod
unsigned long long int systemPeriod
unsigned long long int nicePeriod
unsigned long long int irqTime
unsigned long long int systemAllPeriod
unsigned long long int idleAllPeriod
unsigned long long int stealTime
unsigned long long int niceTime
unsigned long long int idleTime
unsigned long long int userTime
unsigned long long int guestTime
unsigned long long int systemTime
unsigned long long int totalTime
unsigned long long int idlePeriod
unsigned long long int softIrqPeriod
unsigned long long int idleAllTime
unsigned long int multicast
unsigned long int framePeriod
unsigned long int compressed
unsigned long int packetsPeriod
unsigned long int dropPeriod
unsigned long int errsPeriod
unsigned long int multicastPeriod
unsigned long int packets
unsigned long int compressedPeriod
unsigned long int fifoPeriod
unsigned long int bytesPeriod