From e32551b18f4560056d2d482f5e1505b1b98fa82a Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 29 Mar 2005 18:07:58 +0000 Subject: *** empty log message *** --- runtime/docs/html/map_8h-source.html | 350 ++++++++++++++++++----------------- 1 file changed, 179 insertions(+), 171 deletions(-) (limited to 'runtime/docs/html/map_8h-source.html') diff --git a/runtime/docs/html/map_8h-source.html b/runtime/docs/html/map_8h-source.html index 26b210d2..94c29074 100644 --- a/runtime/docs/html/map_8h-source.html +++ b/runtime/docs/html/map_8h-source.html @@ -4,186 +4,194 @@ -
Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages
-

map.h

Go to the documentation of this file.
00001 /* -*- linux-c -*- */
-00002 /** @file map.h
-00003  *  @brief Header file for maps and lists
-00004  */
-00005 
-00006 #include <linux/types.h>
-00007 
-00008 /** Statistics are stored in this struct */
-00009 typedef struct {
-00010         int64_t count;
-00011         int64_t sum;
-00012         int64_t min, max;
-00013         int64_t histogram[BUCKETS];
-00014 } stat;
-00015 
-00016 /** Keys are either longs or char * */
-00017 union key_data {
-00018         long val;
-00019         char *str;
-00020 };
+
+

map.h

Go to the documentation of this file.
00001 #ifndef _MAP_H_
+00002 #define _MAP_H_
+00003 /* -*- linux-c -*- */
+00004 
+00005 /** @file map.h
+00006  * @brief Header file for maps and lists 
+00007  */
+00008 /** @addtogroup maps 
+00009  * @{ 
+00010  */
+00011 
+00012 #include <linux/types.h>
+00013 
+00014 /** Statistics are stored in this struct */
+00015 typedef struct {
+00016         int64_t count;
+00017         int64_t sum;
+00018         int64_t min, max;
+00019         int64_t histogram[BUCKETS];
+00020 } stat;
 00021 
-00022 /** keys can be longs or strings */
-00023 enum keytype { NONE, LONG, STR } __attribute__ ((packed));
-00024 /** values can be either int64, stats or strings */
-00025 enum valtype { INT64, STAT, STRING, END };
-00026 
+00022 /** Keys are either longs or char * */
+00023 union key_data {
+00024         long val;
+00025         char *str;
+00026 };
 00027 
-00028 /** basic map element */
-00029 struct map_node {
-00030         /** list of other nodes in the map */
-00031         struct list_head lnode;
-00032         /** list of nodes with the same hash value */
-00033         struct hlist_node hnode; 
-00034         union key_data key1;
-00035         union key_data key2;
-00036         enum keytype key1type;
-00037         enum keytype key2type;
-00038 };
-00039 
-00040 /** map element containing int64 */
-00041 struct map_node_int64 {
-00042         struct map_node n;
-00043         int64_t val;
+00028 /** keys can be longs or strings */
+00029 enum keytype { NONE, LONG, STR } __attribute__ ((packed));
+00030 /** values can be either int64, stats or strings */
+00031 enum valtype { INT64, STAT, STRING, END };
+00032 
+00033 
+00034 /** basic map element */
+00035 struct map_node {
+00036         /** list of other nodes in the map */
+00037         struct list_head lnode;
+00038         /** list of nodes with the same hash value */
+00039         struct hlist_node hnode; 
+00040         union key_data key1;
+00041         union key_data key2;
+00042         enum keytype key1type;
+00043         enum keytype key2type;
 00044 };
 00045 
-00046 /** map element containing string */
-00047 struct map_node_str {
+00046 /** map element containing int64 */
+00047 struct map_node_int64 {
 00048         struct map_node n;
-00049         char *str;
+00049         int64_t val;
 00050 };
 00051 
-00052 /** map element containing stats */
-00053 struct map_node_stat {
+00052 /** map element containing string */
+00053 struct map_node_str {
 00054         struct map_node n;
-00055         stat stats;
+00055         char *str;
 00056 };
 00057 
-00058 /** This structure contains all information about a map.
-00059  * It is allocated once when _stp_map_new() is called. 
-00060  */
-00061 struct map_root {
-00062         /** type of the values stored in the array */
-00063         enum valtype type;
-00064         
-00065         /** maximum number of elements allowed in the array. */
-00066         int maxnum;
-00067 
-00068         /** current number of used elements */
-00069         int num;
-00070 
-00071         /** when more than maxnum elements, wrap or discard? */
-00072         int no_wrap;
+00058 /** map element containing stats */
+00059 struct map_node_stat {
+00060         struct map_node n;
+00061         stat stats;
+00062 };
+00063 
+00064 /** This structure contains all information about a map.
+00065  * It is allocated once when _stp_map_new() is called. 
+00066  */
+00067 struct map_root {
+00068         /** type of the values stored in the array */
+00069         enum valtype type;
+00070         
+00071         /** maximum number of elements allowed in the array. */
+00072         int maxnum;
 00073 
-00074         /** linked list of current entries */
-00075         struct list_head head;
+00074         /** current number of used elements */
+00075         int num;
 00076 
-00077         /** pool of unused entries.  Used only when entries are statically allocated
-00078             at startup. */
-00079         struct list_head pool;
-00080 
-00081         /** saved key entry for lookups */
-00082         struct map_node *key;
-00083 
-00084         /** this is the creation data saved between the key functions and the
-00085             set/get functions 
-00086             @todo Needs to be per-cpu data for SMP support */
-00087         u_int8_t create;
-00088         enum keytype c_key1type;
-00089         enum keytype c_key2type;
-00090         struct hlist_head *c_keyhead;
-00091         union key_data c_key1;
-00092         union key_data c_key2;
-00093 
-00094         /** the hash table for this array */
-00095         struct hlist_head hashes[HASH_TABLE_SIZE];
-00096 
-00097         /** pointer to allocated memory space. Used for freeing memory. */
-00098         void *membuf;
-00099 };
-00100 
-00101 /** All maps are of this type. */
-00102 typedef struct map_root *MAP;
-00103 
-00104 /** Extracts string from key1 union */
-00105 #define key1str(ptr) (ptr->n.key1.str)
-00106 /** Extracts string from key2 union */
-00107 #define key2str(ptr) (ptr->n.key2.str)
-00108 /** Extracts int from key1 union */
-00109 #define key1int(ptr) (ptr->n.key1.val)
-00110 /** Extracts int from key2 union */
-00111 #define key2int(ptr) (ptr->n.key2.val)
-00112 
-00113 /** Macro to call the proper _stp_map_key functions based on the
-00114  * types of the arguments. 
-00115  * @note May cause compiler warning on some GCCs 
-00116  */
-00117 #define _stp_map_key2(map, key1, key2)                          \
-00118   ({                                                            \
-00119     if (__builtin_types_compatible_p (typeof (key1), char[]))   \
-00120       if (__builtin_types_compatible_p (typeof (key2), char[])) \
-00121         _stp_map_key_str_str (map, (char *)(key1), (char *)(key2));     \
-00122       else                                                      \
-00123         _stp_map_key_str_long (map, (char *)(key1), (long)(key2));      \
-00124     else                                                        \
-00125       if (__builtin_types_compatible_p (typeof (key2), char[])) \
-00126         _stp_map_key_long_str (map, (long)(key1), (char *)(key2));      \
-00127       else                                                      \
-00128         _stp_map_key_long_long (map, (long)(key1), (long)(key2));       \
-00129   })
-00130 
-00131 /** Macro to call the proper _stp_map_key function based on the
-00132  * type of the argument. 
-00133  * @note May cause compiler warning on some GCCs 
-00134  */
-00135 #define _stp_map_key(map, key)                          \
-00136   ({                                                            \
-00137     if (__builtin_types_compatible_p (typeof (key), char[]))    \
-00138       _stp_map_key_str (map, (char *)(key));                            \
-00139     else                                                        \
-00140       _stp_map_key_long (map, (long)(key));                             \
-00141   })
-00142 
-00143 /** Macro to call the proper _stp_map_set function based on the
-00144  * type of the argument. 
-00145  * @note May cause compiler warning on some GCCs 
-00146  */
-00147 #define _stp_map_set(map, val)                          \
-00148   ({                                                            \
-00149     if (__builtin_types_compatible_p (typeof (val), char[]))    \
-00150       _stp_map_set_str (map, (char *)(val));                            \
-00151     else                                                        \
-00152       _stp_map_set_int64 (map, (int64_t)(val));                 \
-00153   })
-00154 
-00155 /** Macro to call the proper _stp_list_add function based on the
-00156  * types of the argument. 
-00157  * @note May cause compiler warning on some GCCs 
-00158  */
-00159 #define _stp_list_add(map, val)                         \
-00160   ({                                                            \
-00161     if (__builtin_types_compatible_p (typeof (val), char[]))    \
-00162       _stp_list_add_str (map, (char *)(val));                           \
-00163     else                                                        \
-00164       _stp_list_add_int64 (map, (int64_t)(val));                        \
-00165   })
-00166 
-00167 
-00168 /** Loop through all elements of a map.
-00169  * @param map 
-00170  * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str
-00171  *
-00172  * @b Example:
-00173  * @include foreach.c
-00174  */
-00175 
-00176 #define foreach(map, ptr)                               \
-00177   for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \
-00178        ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
-00179 
-

-Generated on Tue Mar 22 10:27:36 2005 for SystemTap. - +00077 /** when more than maxnum elements, wrap or discard? */ +00078 int no_wrap; +00079 +00080 /** linked list of current entries */ +00081 struct list_head head; +00082 +00083 /** pool of unused entries. Used only when entries are statically allocated +00084 at startup. */ +00085 struct list_head pool; +00086 +00087 /** saved key entry for lookups */ +00088 struct map_node *key; +00089 +00090 /** this is the creation data saved between the key functions and the +00091 set/get functions +00092 @todo Needs to be per-cpu data for SMP support */ +00093 u_int8_t create; +00094 enum keytype c_key1type; +00095 enum keytype c_key2type; +00096 struct hlist_head *c_keyhead; +00097 union key_data c_key1; +00098 union key_data c_key2; +00099 +00100 /** the hash table for this array */ +00101 struct hlist_head hashes[HASH_TABLE_SIZE]; +00102 +00103 /** pointer to allocated memory space. Used for freeing memory. */ +00104 void *membuf; +00105 }; +00106 +00107 /** All maps are of this type. */ +00108 typedef struct map_root *MAP; +00109 +00110 /** Extracts string from key1 union */ +00111 #define key1str(ptr) (ptr->n.key1.str) +00112 /** Extracts string from key2 union */ +00113 #define key2str(ptr) (ptr->n.key2.str) +00114 /** Extracts int from key1 union */ +00115 #define key1int(ptr) (ptr->n.key1.val) +00116 /** Extracts int from key2 union */ +00117 #define key2int(ptr) (ptr->n.key2.val) +00118 +00119 /** Macro to call the proper _stp_map_key functions based on the +00120 * types of the arguments. +00121 * @note May cause compiler warning on some GCCs +00122 */ +00123 #define _stp_map_key2(map, key1, key2) \ +00124 ({ \ +00125 if (__builtin_types_compatible_p (typeof (key1), char[])) \ +00126 if (__builtin_types_compatible_p (typeof (key2), char[])) \ +00127 _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \ +00128 else \ +00129 _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \ +00130 else \ +00131 if (__builtin_types_compatible_p (typeof (key2), char[])) \ +00132 _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \ +00133 else \ +00134 _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \ +00135 }) +00136 +00137 /** Macro to call the proper _stp_map_key function based on the +00138 * type of the argument. +00139 * @note May cause compiler warning on some GCCs +00140 */ +00141 #define _stp_map_key(map, key) \ +00142 ({ \ +00143 if (__builtin_types_compatible_p (typeof (key), char[])) \ +00144 _stp_map_key_str (map, (char *)(key)); \ +00145 else \ +00146 _stp_map_key_long (map, (long)(key)); \ +00147 }) +00148 +00149 /** Macro to call the proper _stp_map_set function based on the +00150 * type of the argument. +00151 * @note May cause compiler warning on some GCCs +00152 */ +00153 #define _stp_map_set(map, val) \ +00154 ({ \ +00155 if (__builtin_types_compatible_p (typeof (val), char[])) \ +00156 _stp_map_set_str (map, (char *)(val)); \ +00157 else \ +00158 _stp_map_set_int64 (map, (int64_t)(val)); \ +00159 }) +00160 +00161 /** Loop through all elements of a map or list. +00162 * @param map +00163 * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str +00164 * +00165 * @b Example: +00166 * @include foreach.c +00167 */ +00168 +00169 #define foreach(map, ptr) \ +00170 for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \ +00171 ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr)) +00172 +00173 /** @} */ +00174 +00175 /** @ingroup lists +00176 * @brief Macro to call the proper _stp_list_add function based on the +00177 * types of the argument. +00178 * +00179 * @note May cause compiler warning on some GCCs +00180 */ +00181 #define _stp_list_add(map, val) \ +00182 ({ \ +00183 if (__builtin_types_compatible_p (typeof (val), char[])) \ +00184 _stp_list_add_str (map, (char *)(val)); \ +00185 else \ +00186 _stp_list_add_int64 (map, (int64_t)(val)); \ +00187 }) +00188 +00189 #endif /* _MAP_H_ */ +
-- cgit