mirror of https://github.com/hashcat/hashcat.git
parent
4d2be9073e
commit
2381af313d
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef EXT_SMI_H
|
||||
#define EXT_SMI_H
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#endif // HAVE_HWMON
|
||||
|
||||
#endif
|
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef EXT_SMI_H
|
||||
#define EXT_SMI_H
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#define SMI_OK 0
|
||||
#define SMI_NOBIN 1
|
||||
|
||||
int hc_nvidia_smi (int dev, int *temperature, int *gpu);
|
||||
|
||||
#endif // HAVE_HWMON
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
#include <ext_dummy.h>
|
@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#include <ext_smi.h>
|
||||
|
||||
int hc_nvidia_smi (int dev, int *temperature, int *gpu)
|
||||
{
|
||||
char cmd[256] = { 0 };
|
||||
|
||||
snprintf (cmd, sizeof (cmd) - 1, "nvidia-smi -q -g %d", dev);
|
||||
|
||||
FILE *fp = popen (cmd, "r");
|
||||
|
||||
if (fp == NULL)
|
||||
{
|
||||
log_info ("WARN: %s\n", "nvidia-smi is missing!");
|
||||
|
||||
return SMI_NOBIN;
|
||||
}
|
||||
|
||||
int temp_found = 0;
|
||||
int util_found = 0;
|
||||
|
||||
char token[32];
|
||||
|
||||
while (fscanf (fp, " %31s ", token) == 1)
|
||||
{
|
||||
if (strcmp (token, "Temperature") == 0)
|
||||
{
|
||||
if (fscanf (fp, " : %4s C", token) == 1) *temperature = atoi (token);
|
||||
|
||||
temp_found = 1;
|
||||
}
|
||||
|
||||
if (temp_found == 1)
|
||||
{
|
||||
if ((strcmp (token, "GPU") == 0) || (strcmp (token, "Gpu") == 0))
|
||||
{
|
||||
if (fscanf (fp, " : %4s C", token) == 1) *temperature = atoi (token);
|
||||
|
||||
temp_found = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (token, "Utilization") == 0)
|
||||
{
|
||||
util_found = 1;
|
||||
|
||||
temp_found = 0;
|
||||
}
|
||||
|
||||
if (util_found == 1)
|
||||
{
|
||||
if ((strcmp (token, "GPU") == 0) || (strcmp (token, "Gpu") == 0))
|
||||
{
|
||||
if (fscanf (fp, " : %2s%%", token) == 1) *gpu = atoi (token);
|
||||
|
||||
util_found = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pclose (fp);
|
||||
|
||||
return (SMI_OK);
|
||||
}
|
Loading…
Reference in new issue