Add processor model

Add processor model

Signed off: Dr. James Dominic P. Guana <jdpguana@histark.com>
This commit is contained in:
Dr. James Dominic P. Guana
2021-08-20 02:34:48 +08:00
committed by Robert Roth
parent 3f4dac881b
commit 1e3547406a
6 changed files with 750 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ static void
init_sysinfo (glibtop *server)
{
char* buffer;
gchar *buf, *line;
gchar ** processors;
if(G_LIKELY(sysinfo.flags)) return;
@@ -48,6 +49,24 @@ init_sysinfo (glibtop *server)
/* cpuinfo records are seperated by a blank line */
processors = g_strsplit(buffer, "\n\n", 0);
line = strtok(processors[0], "\n");
while(line != NULL)
{
if (strstr(line, "model name") != NULL)
{
buf = strchr(line, ':');
if (buf != NULL)
{
buf+=2; // we want to look at what's _after_ the ':'
sysinfo.model = buf;
}
break;
}
line = strtok(NULL, "\n");
}
g_free(buffer);
sysinfo.ncpu = 0;