summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorDr. James Dominic P. Guana <jdpguana@histark.com>2021-08-20 02:34:48 +0800
committerRobert Roth <robert.roth.off@gmail.com>2022-03-28 12:32:26 +0000
commit1e3547406a48a5a92c7040610680cc61184767c2 (patch)
treec051690819a3ee8d654bd43e562f834a0cde8ce3 /sysdeps
parent3f4dac881b14eae0575bf821939ba51e9fdb6ebf (diff)
downloadlibgtop-1e3547406a48a5a92c7040610680cc61184767c2.tar.gz
Add processor model
Add processor model Signed off: Dr. James Dominic P. Guana <jdpguana@histark.com>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/linux/sysinfo.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/linux/sysinfo.c b/sysdeps/linux/sysinfo.c
index 7dbd5eeb..c9a66653 100644
--- a/sysdeps/linux/sysinfo.c
+++ b/sysdeps/linux/sysinfo.c
@@ -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;