Add sysinfo example
Retrieve cpu model via hashtable & number of logical cpu via exposed variable Signed off: Dr. James Dominic P. Guana <jdpguana@histark.com>
This commit is contained in:
committed by
Robert Roth
parent
e89475c0b2
commit
f92f6ea029
@@ -32,13 +32,14 @@
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
char *model;
|
||||
const glibtop_sysinfo * sysinfo;
|
||||
|
||||
glibtop_init();
|
||||
|
||||
sysinfo = glibtop_get_sysinfo ();
|
||||
model = g_hash_table_lookup (sysinfo->cpuinfo [1].values, "model name");
|
||||
|
||||
printf ("\nProcessor Model: %s\n", sysinfo->model);
|
||||
printf ("\nProcessor Model: %s\n", g_strdup (model));
|
||||
printf ("Number of Cores: %d\n\n", sysinfo->ncpu);
|
||||
|
||||
glibtop_close ();
|
||||
|
Reference in New Issue
Block a user