#include <linux/types.h>
Go to the source code of this file.
Defines | |
#define | key1str(ptr) (ptr->n.key1.str) |
#define | key2str(ptr) (ptr->n.key2.str) |
#define | key1int(ptr) (ptr->n.key1.val) |
#define | key2int(ptr) (ptr->n.key2.val) |
#define | _stp_map_key2(map, key1, key2) |
#define | _stp_map_key(map, key) |
#define | _stp_map_set(map, val) |
#define | _stp_list_add(map, val) |
#define | foreach(map, ptr) |
Loop through all elements of a map. | |
Typedefs | |
typedef map_root * | MAP |
All maps are of this type. | |
Enumerations | |
enum | keytype { NONE, LONG, STR } |
enum | valtype { INT64, STAT, STRING, END } |
Variables | |
enum keytype | packed |
Definition in file map.h.
|
Value: ({ \ if (__builtin_types_compatible_p (typeof (val), char[])) \ _stp_list_add_str (map, (char *)(val)); \ else \ _stp_list_add_int64 (map, (int64_t)(val)); \ }) |
|
Value: ({ \ if (__builtin_types_compatible_p (typeof (key), char[])) \ _stp_map_key_str (map, (char *)(key)); \ else \ _stp_map_key_long (map, (long)(key)); \ }) |
|
Value: ({ \ if (__builtin_types_compatible_p (typeof (key1), char[])) \ if (__builtin_types_compatible_p (typeof (key2), char[])) \ _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \ else \ _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \ else \ if (__builtin_types_compatible_p (typeof (key2), char[])) \ _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \ else \ _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \ }) |
|
Value: ({ \ if (__builtin_types_compatible_p (typeof (val), char[])) \ _stp_map_set_str (map, (char *)(val)); \ else \ _stp_map_set_int64 (map, (int64_t)(val)); \ }) |
|
Value: for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \ ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
/* example showing how to print all the stats in a map using foreach() */ struct map_node_stat *ptr; foreach (map, ptr) printf ("map[%s,%ld] = [c=%lld s=%lld min=%lld max=%lld]\n", key1str(ptr), key2int(ptr), ptr->stats.count, ptr->stats.sum, ptr->stats.min, ptr->stats.max); |