1 /* 2 * Copyright (c) <2008>, Sun Microsystems, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * * Neither the name of the nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 provider memcached { 28 /** 29 * Fired when a connection object is allocated from the connection pool. 30 * @param connid the connection id 31 */ 32 probe conn__allocate(int connid); 33 34 /** 35 * Fired when a connection object is released back to the connection pool. 36 * @param connid the connection id 37 */ 38 probe conn__release(int connid); 39 40 /** 41 * Fired when a new connection object is created (there are no more 42 * connection objects in the connection pool). 43 * @param ptr pointer to the connection object 44 */ 45 probe conn__create(void *ptr); 46 47 /** 48 * Fired when a connection object is destroyed ("released back to 49 * the memory subsystem"). 50 * @param ptr pointer to the connection object 51 */ 52 probe conn__destroy(void *ptr); 53 54 /** 55 * Fired when a connection is dispatched from the "main thread" to a 56 * worker thread. 57 * @param connid the connection id 58 * @param threadid the thread id 59 */ 60 probe conn__dispatch(int connid, int64_t threadid); 61 62 /** 63 * Allocate memory from the slab allocator. 64 * @param size the requested size 65 * @param slabclass the allocation will be fulfilled in this class 66 * @param slabsize the size of each item in this class 67 * @param ptr pointer to allocated memory 68 */ 69 probe slabs__allocate(int size, int slabclass, int slabsize, void* ptr); 70 71 /** 72 * Failed to allocate memory (out of memory). 73 * @param size the requested size 74 * @param slabclass the class that failed to fulfill the request 75 */ 76 probe slabs__allocate__failed(int size, int slabclass); 77 78 /** 79 * Fired when a slab class attempts to allocate more space. 80 * @param slabclass class that needs more memory 81 */ 82 probe slabs__slabclass__allocate(int slabclass); 83 84 /** 85 * Failed to allocate memory (out of memory). 86 * @param slabclass the class that failed grab more memory 87 */ 88 probe slabs__slabclass__allocate__failed(int slabclass); 89 90 /** 91 * Release memory. 92 * @param size the size of the memory 93 * @param slabclass the class the memory belongs to 94 * @param ptr pointer to the memory to release 95 */ 96 probe slabs__free(int size, int slabclass, void* ptr); 97 98 /** 99 * Fired when the when we have searched the hash table for a named key. 100 * These two elements provide an insight in how well the hash function 101 * functions. Long traversals are a sign of a less optimal function, 102 * wasting cpu capacity. 103 * 104 * @param key the key searched for 105 * @param keylen length of the key 106 * @param depth the depth in the list of hash table 107 */ 108 probe assoc__find(const char *key, int keylen, int depth); 109 110 /** 111 * Fired when a new item has been inserted. 112 * @param key the key just inserted 113 * @param keylen length of the key 114 */ 115 probe assoc__insert(const char *key, int keylen); 116 117 /** 118 * Fired when a new item has been removed. 119 * @param key the key just deleted 120 * @param keylen length of the key 121 */ 122 probe assoc__delete(const char *key, int keylen); 123 124 /** 125 * Fired when an item is linked into the cache. 126 * @param key the items key 127 * @param keylen length of the key 128 * @param size the size of the data 129 */ 130 probe item__link(const char *key, int keylen, int size); 131 132 /** 133 * Fired when an item is deleted. 134 * @param key the items key 135 * @param keylen length of the key 136 * @param size the size of the data 137 */ 138 probe item__unlink(const char *key, int keylen, int size); 139 140 /** 141 * Fired when the refcount for an item is reduced. 142 * @param key the items key 143 * @param keylen length of the key 144 * @param size the size of the data 145 */ 146 probe item__remove(const char *key, int keylen, int size); 147 148 /** 149 * Fired when the "last refenced" time is updated. 150 * @param key the items key 151 * @param keylen length of the key 152 * @param size the size of the data 153 */ 154 probe item__update(const char *key, int keylen, int size); 155 156 /** 157 * Fired when an item is replaced with another item. 158 * @param oldkey the key of the item to replace 159 * @param oldkeylen the length of the old key 160 * @param oldsize the size of the old item 161 * @param newkey the key of the new item 162 * @param newkeylen the length of the new key 163 * @param newsize the size of the new item 164 */ 165 probe item__replace(const char *oldkey, int oldkeylen, int oldsize, 166 const char *newkey, int newkeylen, int newsize); 167 168 /** 169 * Fired when the processing of a command starts. 170 * @param connid the connection id 171 * @param request the incoming request 172 * @param size the size of the request 173 */ 174 probe process__command__start(int connid, const void *request, int size); 175 176 /** 177 * Fired when the processing of a command is done. 178 * @param connid the connection id 179 * @param response the response to send back to the client 180 * @param size the size of the response 181 */ 182 probe process__command__end(int connid, const void *response, int size); 183 184 /** 185 * Fired for a get-command 186 * @param connid connection id 187 * @param key requested key 188 * @param keylen length of the key 189 * @param size size of the key's data (or signed int -1 if not found) 190 * @param casid the casid for the item 191 */ 192 probe command__get(int connid, const char *key, int keylen, int size, int64_t casid); 193 194 /** 195 * Fired for an add-command. 196 * @param connid connection id 197 * @param key requested key 198 * @param keylen length of the key 199 * @param size the new size of the key's data (or signed int -1 if 200 * not found) 201 * @param casid the casid for the item 202 */ 203 probe command__add(int connid, const char *key, int keylen, int size, int64_t casid); 204 205 /** 206 * Fired for a set-command. 207 * @param connid connection id 208 * @param key requested key 209 * @param keylen length of the key 210 * @param size the new size of the key's data (or signed int -1 if 211 * not found) 212 * @param casid the casid for the item 213 */ 214 probe command__set(int connid, const char *key, int keylen, int size, int64_t casid); 215 216 /** 217 * Fired for a replace-command. 218 * @param connid connection id 219 * @param key requested key 220 * @param keylen length of the key 221 * @param size the new size of the key's data (or signed int -1 if 222 * not found) 223 * @param casid the casid for the item 224 */ 225 probe command__replace(int connid, const char *key, int keylen, int size, int64_t casid); 226 227 /** 228 * Fired for a prepend-command. 229 * @param connid connection id 230 * @param key requested key 231 * @param keylen length of the key 232 * @param size the new size of the key's data (or signed int -1 if 233 * not found) 234 * @param casid the casid for the item 235 */ 236 probe command__prepend(int connid, const char *key, int keylen, int size, int64_t casid); 237 238 /** 239 * Fired for an append-command. 240 * @param connid connection id 241 * @param key requested key 242 * @param keylen length of the key 243 * @param size the new size of the key's data (or signed int -1 if 244 * not found) 245 * @param casid the casid for the item 246 */ 247 probe command__append(int connid, const char *key, int keylen, int size, int64_t casid); 248 249 /** 250 * Fired for an touch-command. 251 * @param connid connection id 252 * @param key requested key 253 * @param keylen length of the key 254 * @param size the new size of the key's data (or signed int -1 if 255 * not found) 256 * @param casid the casid for the item 257 */ 258 probe command__touch(int connid, const char *key, int keylen, int size, int64_t casid); 259 260 /** 261 * Fired for a cas-command. 262 * @param connid connection id 263 * @param key requested key 264 * @param keylen length of the key 265 * @param size size of the key's data (or signed int -1 if not found) 266 * @param casid the cas id requested 267 */ 268 probe command__cas(int connid, const char *key, int keylen, int size, int64_t casid); 269 270 /** 271 * Fired for an incr command. 272 * @param connid connection id 273 * @param key the requested key 274 * @param keylen length of the key 275 * @param val the new value 276 */ 277 probe command__incr(int connid, const char *key, int keylen, int64_t val); 278 279 /** 280 * Fired for a decr command. 281 * @param connid connection id 282 * @param key the requested key 283 * @param keylen length of the key 284 * @param val the new value 285 */ 286 probe command__decr(int connid, const char *key, int keylen, int64_t val); 287 288 /** 289 * Fired for a delete command. 290 * @param connid connection id 291 * @param key the requested key 292 * @param keylen length of the key 293 */ 294 probe command__delete(int connid, const char *key, int keylen); 295 296 }; 297 298 #pragma D attributes Unstable/Unstable/Common provider memcached provider 299 #pragma D attributes Private/Private/Common provider memcached module 300 #pragma D attributes Private/Private/Common provider memcached function 301 #pragma D attributes Unstable/Unstable/Common provider memcached name 302 #pragma D attributes Unstable/Unstable/Common provider memcached args 303