From 655ee2825121e149a9976e562946892efb20aea1 Mon Sep 17 00:00:00 2001 From: hunt Date: Thu, 7 Apr 2005 21:48:47 +0000 Subject: *** empty log message *** --- runtime/docs/html/group__maps.html | 342 ++++++++++++++++++++----------------- 1 file changed, 188 insertions(+), 154 deletions(-) (limited to 'runtime/docs/html/group__maps.html') diff --git a/runtime/docs/html/group__maps.html b/runtime/docs/html/group__maps.html index 1da96a51..1b6e170e 100644 --- a/runtime/docs/html/group__maps.html +++ b/runtime/docs/html/group__maps.html @@ -4,74 +4,67 @@ -
Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages
+
Main Page | Modules | Directories | File List | Globals | Related Pages

Maps

Implements maps (associative arrays) and lists. More... - + - - + - - + - - + - - + - - + - - + - - + - + - + - + - + - - + + - - + + - - + + - + +typedef map_root *  - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - + + + + +enum keytype 

Data Structures

struct  stat
struct  stat
 Statistics are stored in this struct. More...
union  key_data
union  key_data
 Keys are either longs or char *. More...
struct  map_node
struct  map_node
 basic map element More...
struct  map_node_int64
struct  map_node_int64
 map element containing int64 More...
struct  map_node_str
struct  map_node_str
 map element containing string More...
struct  map_node_stat
struct  map_node_stat
 map element containing stats More...
struct  map_root
struct  map_root
 This structure contains all information about a map. More...

Defines

-#define key1str(ptr)   (ptr->n.key1.str)
+#define key1str(ptr)   (ptr->n.key1.str)
 Extracts string from key1 union.
-#define key2str(ptr)   (ptr->n.key2.str)
+#define key2str(ptr)   (ptr->n.key2.str)
 Extracts string from key2 union.
-#define key1int(ptr)   (ptr->n.key1.val)
+#define key1int(ptr)   (ptr->n.key1.val)
 Extracts int from key1 union.
-#define key2int(ptr)   (ptr->n.key2.val)
+#define key2int(ptr)   (ptr->n.key2.val)
 Extracts int from key2 union.
#define _stp_map_key2(map, key1, key2)
#define _stp_map_key2(map, key1, key2)
 Macro to call the proper _stp_map_key functions based on the types of the arguments.
#define _stp_map_key(map, key)
 Macro to call the proper _stp_map_key functions based on the types of the arguments.
#define _stp_map_key(map, key)
 Macro to call the proper _stp_map_key function based on the type of the argument.
#define _stp_map_set(map, val)
 Macro to call the proper _stp_map_key function based on the type of the argument.
#define _stp_map_set(map, val)
 Macro to call the proper _stp_map_set function based on the type of the argument.
#define foreach(map, ptr)
 Macro to call the proper _stp_map_set function based on the type of the argument.
#define foreach(map, ptr)
 Loop through all elements of a map or list.
 Loop through all elements of a map or list.

Typedefs

-typedef map_rootMAP
MAP
 All maps are of this type.

Enumerations

enum  keytype { NONE, +
enum  keytype { NONE, LONG, STR }
 keys can be longs or strings
enum  valtype { INT64, +
enum  valtype { INT64, STAT, STRING, END @@ -79,74 +72,78 @@ typedef map_root values can be either int64, stats or strings

Functions

MAP _stp_map_new (unsigned max_entries, enum valtype type)
MAP _stp_map_new (unsigned max_entries, enum valtype type)
 Create a new map.
void _stp_map_key_del (MAP map)
void _stp_map_key_del (MAP map)
 Deletes the current element.
map_node_stp_map_start (MAP map)
map_node * _stp_map_start (MAP map)
 Get the first element in a map.
map_node_stp_map_iter (MAP map, struct map_node *m)
map_node * _stp_map_iter (MAP map, struct map_node *m)
 Get the next element in a map.
void _stp_map_del (MAP map)
void _stp_map_del (MAP map)
 Deletes a map.
void _stp_map_key_long_long (MAP map, long key1, long key2)
void _stp_map_key_long_long (MAP map, long key1, long key2)
 Set the map's key to two longs.
void _stp_map_key_str_str (MAP map, char *key1, char *key2)
void _stp_map_key_str_str (MAP map, char *key1, char *key2)
 Set the map's key to two strings.
void _stp_map_key_str_long (MAP map, char *key1, long key2)
void _stp_map_key_str_long (MAP map, char *key1, long key2)
 Set the map's key to a string and a long.
void _stp_map_key_long_str (MAP map, long key1, char *key2)
void _stp_map_key_long_str (MAP map, long key1, char *key2)
 Set the map's key to a long and a string.
void _stp_map_key_str (MAP map, char *key)
void _stp_map_key_str (MAP map, char *key)
 Set the map's key to a string.
void _stp_map_key_long (MAP map, long key)
void _stp_map_key_long (MAP map, long key)
 Set the map's key to a long.
void _stp_map_set_int64 (MAP map, int64_t val)
void _stp_map_set_int64 (MAP map, int64_t val)
 Set the current element's value to an int64.
void _stp_map_add_int64 (MAP map, int64_t val)
void _stp_map_add_int64 (MAP map, int64_t val)
 Adds an int64 to the current element's value.
int64_t _stp_map_get_int64 (MAP map)
int64_t _stp_map_get_int64 (MAP map)
 Gets the current element's value.
void _stp_map_set_str (MAP map, char *val)
void _stp_map_set_str (MAP map, char *val)
 Set the current element's value to a string.
char * _stp_map_get_str (MAP map)
 Set the current element's value to a C string.
void _stp_map_set_string (MAP map, String str)
 Gets the current element's value.
void _stp_map_set_stat (MAP map, stat *stats)
 Set the current element's value to String.
char * _stp_map_get_str (MAP map)
 Set the current element's value to a stat.
stat_stp_map_get_stat (MAP map)
 Gets the current element's value.
void _stp_map_set_stat (MAP map, stat *stats)
 Gets the current element's value.
void _stp_map_stat_add (MAP map, int64_t val)
 Set the current element's value to a stat.
stat * _stp_map_get_stat (MAP map)
 Add to the current element's statistics.
 Gets the current element's value.
void _stp_map_stat_add (MAP map, int64_t val)
 Add to the current element's statistics.

Variables

-enum keytype packed
packed
 keys can be longs or strings

Detailed Description

Implements maps (associative arrays) and lists.

+

Todo:
Needs to be made SMP-safe for when the big lock is removed from kprobes.

Define Documentation

-

+

@@ -188,7 +185,7 @@ Implements maps (associative arrays) and lists. Definition at line 141 of file map.h.
-

+

@@ -239,7 +236,7 @@ Definition at line 141 of fil Definition at line 123 of file map.h.
-

+

@@ -268,10 +265,12 @@ Definition at line 123 of fil

Value:

({                                                              \
-    if (__builtin_types_compatible_p (typeof (val), char[]))    \
+    if (__builtin_types_compatible_p (typeof (val), char[]))            \
       _stp_map_set_str (map, (char *)(val));                            \
-    else                                                        \
-      _stp_map_set_int64 (map, (int64_t)(val));                 \
+    else  if (__builtin_types_compatible_p (typeof (val), String))      \
+      _stp_map_set_string (map, (String)(val));                         \
+    else                                                                \
+      _stp_map_set_int64 (map, (int64_t)(val));                         \
   })
 
Macro to call the proper _stp_map_set function based on the type of the argument.

@@ -281,7 +280,7 @@ Definition at line 123 of fil Definition at line 153 of file map.h.

-

+

+Definition at line 171 of file map.h.
@@ -310,27 +309,27 @@ Definition at line 153 of fil

Value:

for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \
-       ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
+       ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
 
Loop through all elements of a map or list.

Parameters:
- +
map 
ptr pointer to a map_node_stat, map_node_int64 or map_node_str
ptr pointer to a map_node_stat, map_node_int64 or map_node_str
Example:
/* example showing how to print all the stats in a map using foreach() */
 
-struct map_node_stat *ptr;
+struct map_node_stat *ptr;
 
-foreach (map, 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);
 
 

-Definition at line 169 of file map.h.


Function Documentation

@@ -342,7 +341,7 @@ Definition at line 169 of fil void _stp_map_add_int64 (  - MAP  + MAP  map, @@ -380,7 +379,7 @@ If the element doesn't exist, it is created. If no current element (key) is set
See also:
_stp_map_set_int64

-Definition at line 558 of file map.c. +Definition at line 559 of file map.c.

@@ -391,7 +390,7 @@ Definition at line 558 of fil void _stp_map_del (  - MAP  + MAP  map  )  @@ -419,7 +418,7 @@ Deletes a map, freeing all memory in all elements. Normally done only when the m

Definition at line 205 of file map.c.

-References _stp_vfree(), map_root::head, map_node::lnode, and map_root::membuf. +References _stp_vfree().

@@ -430,7 +429,7 @@ References _stp_vfree(), int64_t _stp_map_get_int64 (  - MAP  + MAP  map  )  @@ -457,20 +456,18 @@ Gets the current element's value.

Returns:
The value. If the current element is not set or doesn't exist, returns 0.

-Definition at line 568 of file map.c. -

-References map_root::create, map_root::key, and map_node_int64::val. +Definition at line 569 of file map.c. -

+

+Definition at line 186 of file map.c.
- + - + @@ -497,12 +494,10 @@ Gets the current element's value.
Returns:
A pointer to the stats struct. If the current element is not set or doesn't exist, returns NULL.

-Definition at line 732 of file map.c. -

-References map_root::create, map_root::key, and map_node_stat::stats. +Definition at line 750 of file map.c.

stat* _stp_map_get_stat stat* _stp_map_get_stat MAP MAP  map  ) 
-

+

- + @@ -537,9 +532,7 @@ Gets the current element's value.
Returns:
A string pointer. If the current element is not set or doesn't exist, returns NULL.

-Definition at line 649 of file map.c. -

-References map_root::create, map_root::key, and map_node_str::str. +Definition at line 667 of file map.c.

@@ -510,7 +505,7 @@ References map_root::create,
char* _stp_map_get_str MAP MAP  map  ) 

@@ -548,15 +541,15 @@ References map_root::create,

- + - + - + @@ -584,13 +577,11 @@ Get the next element in a map.
struct map_node* _stp_map_iter struct map_node* _stp_map_iter MAP MAP  map,
struct map_nodestruct map_node *  m
m a pointer to the current element, returned from _stp_map_start() or _stp_map_iter().
-
Returns:
a pointer to the next element. This is typically used with _stp_map_start(). See the foreach() macro for typical usage. It probably does what you want anyway.
-
See also:
foreach
+
Returns:
a pointer to the next element. This is typically used with _stp_map_start(). See the foreach() macro for typical usage. It probably does what you want anyway.
+
See also:
foreach

-Definition at line 186 of file map.c. -

-References map_root::head, and map_node::lnode.

@@ -601,7 +592,7 @@ References map_root::head, an void _stp_map_key_del (  - MAP  + MAP  map  )  @@ -629,9 +620,9 @@ If no current element (key) for this map is set, this function does nothing.

Definition at line 118 of file map.c.

-References _stp_free(), map_node::hnode, and map_node::lnode. +References _stp_free().

-Referenced by _stp_map_set_stat(), and _stp_map_set_str(). +Referenced by _stp_map_set_stat(), and _stp_map_set_str().

@@ -642,7 +633,7 @@ Referenced by _stp_map_set_stat() void _stp_map_key_long (  - MAP  + MAP  map, @@ -680,9 +671,9 @@ This sets the current element based on a long key. If the key is not found, a ne

Definition at line 430 of file map.c.

-References _stp_map_key_long_long(), and map_root::c_key2type. +References _stp_map_key_long_long().

-Referenced by _stp_list_add_int64(), and _stp_list_add_str(). +Referenced by _stp_list_add_int64(), _stp_list_add_str(), and _stp_list_add_string().

@@ -693,7 +684,7 @@ Referenced by _stp_list_add_int64 void _stp_map_key_long_long (  - MAP  + MAP  map, @@ -738,8 +729,6 @@ This sets the current element based on a key of two strings. If the keys are not

Definition at line 233 of file map.c.

-References map_root::c_key1, map_root::c_key1type, map_root::c_key2, map_root::c_key2type, map_root::c_keyhead, map_root::create, map_root::hashes, map_root::key, map_node::key1, and key_data::val. -

Referenced by _stp_map_key_long(). @@ -751,7 +740,7 @@ Referenced by _stp_map_key_long() void _stp_map_key_long_str (  - MAP  + MAP  map, @@ -794,9 +783,7 @@ This sets the current element based on a key of a long and a string. If the keys

-Definition at line 373 of file map.c. -

-References map_root::c_key1, map_root::c_key1type, map_root::c_key2, map_root::c_key2type, map_root::c_keyhead, map_root::create, map_root::hashes, map_root::key, map_node::key1, map_node::key2, key_data::str, and key_data::val. +Definition at line 373 of file map.c.

@@ -807,7 +794,7 @@ References map_root::c_key1, void _stp_map_key_str (  - MAP  + MAP  map, @@ -845,7 +832,7 @@ This sets the current element based on a string key. If the key is not found, a

Definition at line 414 of file map.c.

-References _stp_map_key_str_str(), and map_root::c_key2type. +References _stp_map_key_str_str().

@@ -856,7 +843,7 @@ References _stp_map_key_str_str() void _stp_map_key_str_long (  - MAP  + MAP  map, @@ -899,9 +886,7 @@ This sets the current element based on a key of a string and a long. If the keys

-Definition at line 325 of file map.c. -

-References map_root::c_key1, map_root::c_key1type, map_root::c_key2, map_root::c_key2type, map_root::c_keyhead, map_root::create, map_root::hashes, map_root::key, map_node::key1, map_node::key2, key_data::str, and key_data::val. +Definition at line 325 of file map.c.

@@ -912,7 +897,7 @@ References map_root::c_key1, void _stp_map_key_str_str (  - MAP  + MAP  map, @@ -957,8 +942,6 @@ This sets the current element based on a key of two strings. If the keys are not

Definition at line 276 of file map.c.

-References map_root::c_key1, map_root::c_key1type, map_root::c_key2, map_root::c_key2type, map_root::c_keyhead, map_root::create, map_root::hashes, map_root::key, map_node::key1, map_node::key2, and key_data::str. -

Referenced by _stp_map_key_str(). @@ -968,7 +951,7 @@ Referenced by _stp_map_key_str()< - + @@ -976,7 +959,7 @@ Referenced by _stp_map_key_str()< - + @@ -1009,9 +992,9 @@ Maps must be created at module initialization time.
Parameter

Definition at line 57 of file map.c.

-References _stp_valloc(), map_root::head, map_root::maxnum, map_root::membuf, map_root::pool, and map_root::type. +References _stp_valloc().

-Referenced by _stp_list_new(). +Referenced by _stp_list_new().

MAP _stp_map_new MAP _stp_map_new unsigned  max_entries,
enum valtype enum valtype  type

@@ -1022,7 +1005,7 @@ Referenced by _stp_list_new() void _stp_map_set_int64 (  - MAP  + MAP  map, @@ -1057,15 +1040,16 @@ If the element doesn't exist, it is created. If no current element (key) is set val new value -

See also:
_stp_map_add_int64
+
See also:
_stp_map_add_int64

+_stp_map_set()

-Definition at line 541 of file map.c. +Definition at line 542 of file map.c.

-Referenced by _stp_list_add_int64(). +Referenced by _stp_list_add_int64(). -

+

- + - + @@ -1101,21 +1085,21 @@ Referenced by _stp_list_add_int64

Set the current element's value to a stat.

-This sets the current element's value to an stat struct. The map must have been created to hold stats using _stp_map_new(xxx, STAT). This function would only be used if we wanted to set stats to something other than the normal initial values (count = 0, sum = 0, etc). It may be deleted if it doesn't turn out to be useful.

See also:
_stp_map_stat_add
+This sets the current element's value to an stat struct. The map must have been created to hold stats using _stp_map_new(xxx, STAT). This function would only be used if we wanted to set stats to something other than the normal initial values (count = 0, sum = 0, etc). It may be deleted if it doesn't turn out to be useful.
See also:
_stp_map_stat_add
If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.
Parameters:
@@ -1073,13 +1057,13 @@ Referenced by _stp_list_add_int64
void _stp_map_set_stat MAP MAP  map,
statstat *  stats
map 
stats pointer to stats struct.
-

Todo:
Histograms don't work yet.
+
Todo:
Histograms don't work yet.

-Definition at line 673 of file map.c. +Definition at line 691 of file map.c.

-References _stp_calloc(), _stp_map_key_del(), map_root::create, map_root::head, map_node::hnode, map_root::key, map_node::lnode, map_root::maxnum, map_node_stat::n, map_root::no_wrap, map_root::pool, and map_node_stat::stats. +References _stp_calloc(), and _stp_map_key_del().

-Referenced by _stp_map_stat_add(). +Referenced by _stp_map_stat_add().

@@ -1126,7 +1110,7 @@ Referenced by _stp_map_stat_add() void _stp_map_set_str (  - MAP  + MAP  map, @@ -1152,22 +1136,74 @@ Referenced by _stp_map_stat_add()

-Set the current element's value to a string. +Set the current element's value to a C string.

-This sets the current element's value to an string. The map must have been created to hold int64s using _stp_map_new(xxx, STRING)

+This sets the current element's value to an C string. The map must have been created to hold int64s using _stp_map_new(xxx, STRING)

If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
map 
val new string
+
See also:
_stp_map_set()

-Definition at line 588 of file map.c. +Definition at line 590 of file map.c.

-References _stp_alloc(), _stp_calloc(), _stp_free(), _stp_map_key_del(), map_root::create, map_root::head, map_node::hnode, map_root::key, map_node::lnode, map_root::maxnum, map_node_str::n, map_root::no_wrap, map_root::pool, and map_node_str::str. +References _stp_alloc(), _stp_calloc(), _stp_free(), and _stp_map_key_del().

-Referenced by _stp_list_add_str(). +Referenced by _stp_list_add_str(), _stp_list_add_string(), and _stp_map_set_string(). + + +

+ + + + +
+ + + + + + + + + + + + + + + + + + +
void _stp_map_set_string MAP  map,
String  str
+
+ + + +
+   + + +

+Set the current element's value to String. +

+This sets the current element's value to a String. The map must have been created to hold int64s using _stp_map_new(xxx, STRING)

+If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
+ + + +
map 
str String containing new value.
+
+
See also:
_stp_map_set()
+ +

+Definition at line 657 of file map.c. +

+References _stp_map_set_str().

@@ -1176,9 +1212,9 @@ Referenced by _stp_list_add_str() - + - + @@ -1202,16 +1238,14 @@ Get the first element in a map.
struct map_node* _stp_map_start struct map_node* _stp_map_start MAP MAP  map  ) 
map 
-

Returns:
a pointer to the first element. This is typically used with _stp_map_iter(). See the foreach() macro for typical usage. It probably does what you want anyway.
-
See also:
foreach
+
Returns:
a pointer to the first element. This is typically used with _stp_map_iter(). See the foreach() macro for typical usage. It probably does what you want anyway.
+
See also:
foreach

-Definition at line 163 of file map.c. -

-References map_root::head. +Definition at line 163 of file map.c. -

+

- + @@ -1254,12 +1288,12 @@ If the element doesn't exist, it is created. If no current element (key) is set
@@ -1219,7 +1253,7 @@ References map_root::head.
void _stp_map_stat_add MAP MAP  map,
val value to add to the statistics
-

Todo:
Histograms don't work yet.
+
Todo:
Histograms don't work yet.

-Definition at line 753 of file map.c. +Definition at line 771 of file map.c.

-References _stp_map_set_stat(), stat::count, map_root::create, map_root::key, stat::max, stat::min, map_node_stat::stats, and stat::sum. +References _stp_map_set_stat(). -- cgit