diff options
Diffstat (limited to 'hardinfo2/arch/linux')
| -rw-r--r-- | hardinfo2/arch/linux/common/devmemory.h | 35 | ||||
| -rw-r--r-- | hardinfo2/arch/linux/common/net.h | 5 | 
2 files changed, 37 insertions, 3 deletions
| diff --git a/hardinfo2/arch/linux/common/devmemory.h b/hardinfo2/arch/linux/common/devmemory.h index 0adea960..cc4b1582 100644 --- a/hardinfo2/arch/linux/common/devmemory.h +++ b/hardinfo2/arch/linux/common/devmemory.h @@ -16,6 +16,8 @@   *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA   */ +static GHashTable *memlabels; +  static void __scan_memory()  {      gchar **keys, *tmp; @@ -41,13 +43,18 @@ static void __scan_memory()          g_strstrip(newkeys[1]); +        if ((tmp = g_hash_table_lookup(memlabels, newkeys[0]))) { +            g_free(newkeys[0]); +            newkeys[0] = g_strdup(tmp); +        } +                  g_hash_table_replace(moreinfo, g_strdup(newkeys[0]), g_strdup(newkeys[1])); +          tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "\n", NULL);          g_free(meminfo);          meminfo = tmp;          tmp = g_strconcat(lginterval, -                          "LoadGraphInterval$", newkeys[0], "=500\n",                            "UpdateInterval$", newkeys[0], "=1000\n", NULL);          g_free(lginterval);          lginterval = tmp; @@ -56,3 +63,29 @@ static void __scan_memory()      }      g_strfreev(keys);  } + +static void __init_memory_labels(void) +{ +    static struct { +        char *proc_label; +        char *real_label; +    } proc2real[] = { +        { "MemTotal",	"Total Memory"        }, +        { "MemFree", 	"Free Memory"         }, +        { "SwapCached",	"Cached Swap"         }, +        { "HighTotal",	"High Memory"         }, +        { "HighFree",   "Free High Memory"    }, +        { "LowTotal",	"Low Memory"          }, +        { "LowFree",	"Free Low Memory"     }, +        { "SwapTotal",	"Virtual Memory"      }, +        { "SwapFree",   "Free Virtual Memory" }, +        { NULL }, +    }; +    gint i; + +    memlabels = g_hash_table_new(g_str_hash, g_str_equal); +     +    for (i = 0; proc2real[i].proc_label; i++) { +        g_hash_table_insert(memlabels, proc2real[i].proc_label, proc2real[i].real_label); +    } +} diff --git a/hardinfo2/arch/linux/common/net.h b/hardinfo2/arch/linux/common/net.h index 593baf8f..1d2e20ea 100644 --- a/hardinfo2/arch/linux/common/net.h +++ b/hardinfo2/arch/linux/common/net.h @@ -194,13 +194,14 @@ scan_net_interfaces_24(void)              get_net_info(ifacename, &ni);              devid = g_strdup_printf("NET%s", ifacename); -	    network_interfaces = g_strdup_printf("%s$%s$%s=Sent %.2fMiB, received %.2fMiB (%s)\n", +	    network_interfaces = g_strdup_printf("%s$%s$%s=Sent %.2fMiB, received %.2fMiB%s\n",                                                    network_interfaces,                                                    devid,                                                    ifacename,                                                    trans_mb,                                                    recv_mb, -						  ni.ip[0] ? ni.ip : "No IP address"); +						  ni.ip[0] ? +						  (gchar*)idle_free(g_strdup_printf(" (%s)", ni.ip)) : "");              detailed = g_strdup_printf("[Network Adapter Properties]\n"                                          "Interface Type=%s\n" | 
