Don't include the ':' in smaps keys.

Regenerate the hashtable.
This commit is contained in:
Benoit Dejean
2015-07-20 23:42:23 +02:00
committed by Benoît Dejean
parent 45c8452140
commit d3a247a60f
3 changed files with 60 additions and 62 deletions

View File

@@ -98,7 +98,7 @@ parse_smaps(glibtop_map_entry *entry, const char* line)
if ((colon = is_smap_value(line)) == NULL) if ((colon = is_smap_value(line)) == NULL)
return FALSE; return FALSE;
len = colon - line + 1; len = colon - line;
smap = _glibtop_find_smap(line, len); smap = _glibtop_find_smap(line, len);
// g_debug("smap %s -> %p", line, smap); // g_debug("smap %s -> %p", line, smap);

View File

@@ -1,7 +1,3 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* ANSI-C code produced by gperf version 3.0.3 */ /* ANSI-C code produced by gperf version 3.0.3 */
/* Command-line: gperf sysdeps/linux/procmap_smaps.gperf */ /* Command-line: gperf sysdeps/linux/procmap_smaps.gperf */
/* Computed positions: -k'9' */ /* Computed positions: -k'9' */
@@ -42,12 +38,13 @@
#line 14 "sysdeps/linux/procmap_smaps.gperf" #line 14 "sysdeps/linux/procmap_smaps.gperf"
struct smap_value { int name; ptrdiff_t offset; }; struct smap_value { int name; ptrdiff_t offset; };
#include <string.h> #include <string.h>
#include <stddef.h>
#define TOTAL_KEYWORDS 6 #define TOTAL_KEYWORDS 6
#define MIN_WORD_LENGTH 4 #define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 14 #define MAX_WORD_LENGTH 13
#define MIN_HASH_VALUE 4 #define MIN_HASH_VALUE 3
#define MAX_HASH_VALUE 19 #define MAX_HASH_VALUE 18
/* maximum key range = 16, duplicates = 0 */ /* maximum key range = 16, duplicates = 0 */
#ifdef __GNUC__ #ifdef __GNUC__
@@ -62,32 +59,32 @@ hash (register const char *str, register unsigned int len)
{ {
static const unsigned char asso_values[] = static const unsigned char asso_values[] =
{ {
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 5, 0, 20, 19, 19, 19, 19, 19, 19, 19, 5, 0, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 5, 20, 20, 0, 20, 19, 19, 19, 19, 19, 5, 19, 19, 0, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
20, 20, 20, 20, 20, 20 19, 19, 19, 19, 19, 19
}; };
register int hval = len; register int hval = len;
@@ -101,6 +98,7 @@ hash (register const char *str, register unsigned int len)
case 6: case 6:
case 5: case 5:
case 4: case 4:
case 3:
break; break;
} }
return hval; return hval;
@@ -108,21 +106,21 @@ hash (register const char *str, register unsigned int len)
struct stringpool_t struct stringpool_t
{ {
char stringpool_str4[sizeof("Rss:")]; char stringpool_str3[sizeof("Rss")];
char stringpool_str5[sizeof("Size:")]; char stringpool_str4[sizeof("Size")];
char stringpool_str13[sizeof("Shared_Clean:")]; char stringpool_str12[sizeof("Shared_Clean")];
char stringpool_str14[sizeof("Private_Dirty:")]; char stringpool_str13[sizeof("Private_Dirty")];
char stringpool_str18[sizeof("Shared_Dirty:")]; char stringpool_str17[sizeof("Shared_Dirty")];
char stringpool_str19[sizeof("Private_Clean:")]; char stringpool_str18[sizeof("Private_Clean")];
}; };
static const struct stringpool_t stringpool_contents = static const struct stringpool_t stringpool_contents =
{ {
"Rss:", "Rss",
"Size:", "Size",
"Shared_Clean:", "Shared_Clean",
"Private_Dirty:", "Private_Dirty",
"Shared_Dirty:", "Shared_Dirty",
"Private_Clean:" "Private_Clean"
}; };
#define stringpool ((const char *) &stringpool_contents) #define stringpool ((const char *) &stringpool_contents)
#ifdef __GNUC__ #ifdef __GNUC__
@@ -137,26 +135,26 @@ _glibtop_find_smap (register const char *str, register unsigned int len)
{ {
static const unsigned char lengthtable[] = static const unsigned char lengthtable[] =
{ {
0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 12, 13,
14, 0, 0, 0, 13, 14 0, 0, 0, 12, 13
}; };
static const struct smap_value wordlist[] = static const struct smap_value wordlist[] =
{ {
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#line 18 "sysdeps/linux/procmap_smaps.gperf" #line 18 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str4, SMAP_OFFSET(rss)}, {offsetof(struct stringpool_t, stringpool_str3), SMAP_OFFSET(rss)},
#line 21 "sysdeps/linux/procmap_smaps.gperf" #line 21 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str5, SMAP_OFFSET(size)}, {offsetof(struct stringpool_t, stringpool_str4), SMAP_OFFSET(size)},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#line 19 "sysdeps/linux/procmap_smaps.gperf" #line 19 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str13, SMAP_OFFSET(shared_clean)}, {offsetof(struct stringpool_t, stringpool_str12), SMAP_OFFSET(shared_clean)},
#line 17 "sysdeps/linux/procmap_smaps.gperf" #line 17 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str14, SMAP_OFFSET(private_dirty)}, {offsetof(struct stringpool_t, stringpool_str13), SMAP_OFFSET(private_dirty)},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#line 20 "sysdeps/linux/procmap_smaps.gperf" #line 20 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str18, SMAP_OFFSET(shared_dirty)}, {offsetof(struct stringpool_t, stringpool_str17), SMAP_OFFSET(shared_dirty)},
#line 16 "sysdeps/linux/procmap_smaps.gperf" #line 16 "sysdeps/linux/procmap_smaps.gperf"
{(int)(long)&((struct stringpool_t *)0)->stringpool_str19, SMAP_OFFSET(private_clean)} {offsetof(struct stringpool_t, stringpool_str18), SMAP_OFFSET(private_clean)}
}; };
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)

View File

@@ -13,9 +13,9 @@
%} %}
struct smap_value { int name; ptrdiff_t offset; }; struct smap_value { int name; ptrdiff_t offset; };
%% %%
Private_Clean:, SMAP_OFFSET(private_clean) Private_Clean, SMAP_OFFSET(private_clean)
Private_Dirty:, SMAP_OFFSET(private_dirty) Private_Dirty, SMAP_OFFSET(private_dirty)
Rss:, SMAP_OFFSET(rss) Rss, SMAP_OFFSET(rss)
Shared_Clean:, SMAP_OFFSET(shared_clean) Shared_Clean, SMAP_OFFSET(shared_clean)
Shared_Dirty:, SMAP_OFFSET(shared_dirty) Shared_Dirty, SMAP_OFFSET(shared_dirty)
Size:, SMAP_OFFSET(size) Size, SMAP_OFFSET(size)