Exposes the processor model
Accessing processor model becomes easier Signed off: Dr. James Dominic P. Guana <jdpguana@histark.com>
This commit is contained in:
committed by
Robert Roth
parent
04bf093412
commit
629097436a
@@ -72,4 +72,4 @@ diskio_SOURCES = diskio.c
|
|||||||
diskio_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
diskio_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
||||||
|
|
||||||
sysinfo_SOURCES = sysinfo.c
|
sysinfo_SOURCES = sysinfo.c
|
||||||
sysinfo_LDADD = $(top_builddir)/lib/libgtop-2.0.la -lm
|
sysinfo_LDADD = $(top_builddir)/lib/libgtop-2.0.la
|
||||||
|
@@ -32,10 +32,16 @@
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv [])
|
main (int argc, char *argv [])
|
||||||
{
|
{
|
||||||
const glibtop_sysinfo * sysinfo = glibtop_get_sysinfo ();
|
const glibtop_sysinfo * sysinfo;
|
||||||
|
|
||||||
|
glibtop_init();
|
||||||
|
|
||||||
|
sysinfo = glibtop_get_sysinfo ();
|
||||||
|
|
||||||
printf ("\nProcessor Model: %s\n", sysinfo->model);
|
printf ("\nProcessor Model: %s\n", sysinfo->model);
|
||||||
printf ("Number of Cores: %d\n\n", sysinfo->ncpu);
|
printf ("Number of Cores: %d\n\n", sysinfo->ncpu);
|
||||||
|
|
||||||
|
glibtop_close ();
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ struct _glibtop_sysinfo
|
|||||||
{
|
{
|
||||||
guint64 flags;
|
guint64 flags;
|
||||||
guint64 ncpu;
|
guint64 ncpu;
|
||||||
gchar *model;
|
gchar *model;
|
||||||
glibtop_entry cpuinfo [GLIBTOP_NCPU];
|
glibtop_entry cpuinfo [GLIBTOP_NCPU];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -59,8 +59,9 @@ init_sysinfo (glibtop *server)
|
|||||||
|
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
{
|
{
|
||||||
buf+=2; // we want to look at what's _after_ the ':'
|
/* we want to look at what's _after_ the ':' */
|
||||||
sysinfo.model = buf;
|
buf+=2;
|
||||||
|
sysinfo.model = g_strdup (buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user