| 1 | #ifndef _LTT_FACILITY_USER_GENERIC_H_ |
| 2 | #define _LTT_FACILITY_USER_GENERIC_H_ |
| 3 | |
| 4 | #include <sys/types.h> |
| 5 | #include <ltt/ltt-facility-id-user_generic.h> |
| 6 | #include <ltt/ltt-usertrace.h> |
| 7 | |
| 8 | #ifdef __cplusplus |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | /* Named types */ |
| 13 | |
| 14 | /* Event string structures */ |
| 15 | static inline void lttng_write_string_user_generic_string_data( |
| 16 | char *buffer, |
| 17 | size_t *to_base, |
| 18 | size_t *to, |
| 19 | const char **from, |
| 20 | size_t *len, |
| 21 | const char * obj) |
| 22 | { |
| 23 | size_t size; |
| 24 | size_t align; |
| 25 | |
| 26 | /* Flush pending memcpy */ |
| 27 | if (*len != 0) { |
| 28 | if (buffer != NULL) |
| 29 | memcpy(buffer+*to_base+*to, *from, *len); |
| 30 | } |
| 31 | *to += *len; |
| 32 | *len = 0; |
| 33 | |
| 34 | align = sizeof(char); |
| 35 | |
| 36 | if (*len == 0) { |
| 37 | *to += ltt_align(*to, align); /* align output */ |
| 38 | } else { |
| 39 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 40 | } |
| 41 | |
| 42 | /* Contains variable sized fields : must explode the structure */ |
| 43 | |
| 44 | size = strlen(obj) + 1; /* Include final NULL char. */ |
| 45 | if (buffer != NULL) |
| 46 | memcpy(buffer+*to_base+*to, obj, size); |
| 47 | *to += size; |
| 48 | |
| 49 | /* Realign the *to_base on arch size, set *to to 0 */ |
| 50 | *to += ltt_align(*to, sizeof(void *)); |
| 51 | *to_base = *to_base+*to; |
| 52 | *to = 0; |
| 53 | |
| 54 | /* Put source *from just after the C string */ |
| 55 | *from += size; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | /* Event string logging function */ |
| 60 | static inline int trace_user_generic_string( |
| 61 | const char * lttng_param_data); |
| 62 | |
| 63 | #ifndef LTT_TRACE_FAST |
| 64 | static inline int trace_user_generic_string( |
| 65 | const char * lttng_param_data) |
| 66 | #ifndef LTT_TRACE |
| 67 | { |
| 68 | } |
| 69 | #else |
| 70 | { |
| 71 | int ret = 0; |
| 72 | char *buffer = NULL; |
| 73 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 74 | size_t *to_base = &real_to_base; |
| 75 | size_t real_to = 0; |
| 76 | size_t *to = &real_to; |
| 77 | size_t real_len = 0; |
| 78 | size_t *len = &real_len; |
| 79 | size_t reserve_size; |
| 80 | size_t slot_size; |
| 81 | const char *real_from; |
| 82 | const char **from = &real_from; |
| 83 | /* For each field, calculate the field size. */ |
| 84 | /* size = *to_base + *to + *len */ |
| 85 | /* Assume that the padding for alignment starts at a |
| 86 | * sizeof(void *) address. */ |
| 87 | |
| 88 | *from = (const char*)lttng_param_data; |
| 89 | lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data); |
| 90 | |
| 91 | reserve_size = *to_base + *to + *len; |
| 92 | { |
| 93 | char stack_buffer[reserve_size]; |
| 94 | buffer = stack_buffer; |
| 95 | |
| 96 | *to_base = *to = *len = 0; |
| 97 | |
| 98 | *from = (const char*)lttng_param_data; |
| 99 | lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data); |
| 100 | |
| 101 | /* Flush pending memcpy */ |
| 102 | if (*len != 0) { |
| 103 | memcpy(buffer+*to_base+*to, *from, *len); |
| 104 | *to += *len; |
| 105 | *len = 0; |
| 106 | } |
| 107 | |
| 108 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING, 0); |
| 109 | } |
| 110 | |
| 111 | return ret; |
| 112 | |
| 113 | } |
| 114 | #endif //LTT_TRACE |
| 115 | #endif //!LTT_TRACE_FAST |
| 116 | |
| 117 | #ifdef LTT_TRACE_FAST |
| 118 | static inline int trace_user_generic_string( |
| 119 | const char * lttng_param_data) |
| 120 | #ifndef LTT_TRACE |
| 121 | { |
| 122 | } |
| 123 | #else |
| 124 | { |
| 125 | unsigned int index; |
| 126 | struct ltt_trace_info *trace = thread_trace_info; |
| 127 | struct ltt_buf *ltt_buf; |
| 128 | char *buffer = NULL; |
| 129 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 130 | size_t *to_base = &real_to_base; |
| 131 | size_t real_to = 0; |
| 132 | size_t *to = &real_to; |
| 133 | size_t real_len = 0; |
| 134 | size_t *len = &real_len; |
| 135 | size_t reserve_size; |
| 136 | size_t slot_size; |
| 137 | const char *real_from; |
| 138 | const char **from = &real_from; |
| 139 | uint64_t tsc; |
| 140 | if (!trace) { |
| 141 | ltt_thread_init(); |
| 142 | trace = thread_trace_info; |
| 143 | } |
| 144 | |
| 145 | |
| 146 | /* For each field, calculate the field size. */ |
| 147 | /* size = *to_base + *to + *len */ |
| 148 | /* Assume that the padding for alignment starts at a |
| 149 | * sizeof(void *) address. */ |
| 150 | |
| 151 | *from = (const char*)lttng_param_data; |
| 152 | lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data); |
| 153 | |
| 154 | reserve_size = *to_base + *to + *len; |
| 155 | trace->nesting++; |
| 156 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 157 | event_user_generic_string); |
| 158 | |
| 159 | { |
| 160 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 161 | slot_size = 0; |
| 162 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 163 | reserve_size, &slot_size, &tsc); |
| 164 | if (!buffer) |
| 165 | goto end; /* buffer full */ |
| 166 | |
| 167 | *to_base = *to = *len = 0; |
| 168 | |
| 169 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 170 | ltt_facility_user_generic_B1865E44, event_user_generic_string, |
| 171 | reserve_size, tsc); |
| 172 | *from = (const char*)lttng_param_data; |
| 173 | lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data); |
| 174 | |
| 175 | /* Flush pending memcpy */ |
| 176 | if (*len != 0) { |
| 177 | memcpy(buffer+*to_base+*to, *from, *len); |
| 178 | *to += *len; |
| 179 | *len = 0; |
| 180 | } |
| 181 | |
| 182 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 183 | |
| 184 | } |
| 185 | |
| 186 | end: |
| 187 | trace->nesting--; |
| 188 | } |
| 189 | #endif //LTT_TRACE |
| 190 | #endif //LTT_TRACE_FAST |
| 191 | |
| 192 | /* Event string_pointer structures */ |
| 193 | static inline void lttng_write_string_user_generic_string_pointer_string( |
| 194 | char *buffer, |
| 195 | size_t *to_base, |
| 196 | size_t *to, |
| 197 | const char **from, |
| 198 | size_t *len, |
| 199 | const char * obj) |
| 200 | { |
| 201 | size_t size; |
| 202 | size_t align; |
| 203 | |
| 204 | /* Flush pending memcpy */ |
| 205 | if (*len != 0) { |
| 206 | if (buffer != NULL) |
| 207 | memcpy(buffer+*to_base+*to, *from, *len); |
| 208 | } |
| 209 | *to += *len; |
| 210 | *len = 0; |
| 211 | |
| 212 | align = sizeof(char); |
| 213 | |
| 214 | if (*len == 0) { |
| 215 | *to += ltt_align(*to, align); /* align output */ |
| 216 | } else { |
| 217 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 218 | } |
| 219 | |
| 220 | /* Contains variable sized fields : must explode the structure */ |
| 221 | |
| 222 | size = strlen(obj) + 1; /* Include final NULL char. */ |
| 223 | if (buffer != NULL) |
| 224 | memcpy(buffer+*to_base+*to, obj, size); |
| 225 | *to += size; |
| 226 | |
| 227 | /* Realign the *to_base on arch size, set *to to 0 */ |
| 228 | *to += ltt_align(*to, sizeof(void *)); |
| 229 | *to_base = *to_base+*to; |
| 230 | *to = 0; |
| 231 | |
| 232 | /* Put source *from just after the C string */ |
| 233 | *from += size; |
| 234 | } |
| 235 | |
| 236 | |
| 237 | /* Event string_pointer logging function */ |
| 238 | static inline int trace_user_generic_string_pointer( |
| 239 | const char * lttng_param_string, |
| 240 | const void * lttng_param_pointer); |
| 241 | |
| 242 | #ifndef LTT_TRACE_FAST |
| 243 | static inline int trace_user_generic_string_pointer( |
| 244 | const char * lttng_param_string, |
| 245 | const void * lttng_param_pointer) |
| 246 | #ifndef LTT_TRACE |
| 247 | { |
| 248 | } |
| 249 | #else |
| 250 | { |
| 251 | int ret = 0; |
| 252 | char *buffer = NULL; |
| 253 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 254 | size_t *to_base = &real_to_base; |
| 255 | size_t real_to = 0; |
| 256 | size_t *to = &real_to; |
| 257 | size_t real_len = 0; |
| 258 | size_t *len = &real_len; |
| 259 | size_t reserve_size; |
| 260 | size_t slot_size; |
| 261 | size_t align; |
| 262 | const char *real_from; |
| 263 | const char **from = &real_from; |
| 264 | /* For each field, calculate the field size. */ |
| 265 | /* size = *to_base + *to + *len */ |
| 266 | /* Assume that the padding for alignment starts at a |
| 267 | * sizeof(void *) address. */ |
| 268 | |
| 269 | *from = (const char*)lttng_param_string; |
| 270 | lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string); |
| 271 | |
| 272 | *from = (const char*)<tng_param_pointer; |
| 273 | align = sizeof(const void *); |
| 274 | |
| 275 | if (*len == 0) { |
| 276 | *to += ltt_align(*to, align); /* align output */ |
| 277 | } else { |
| 278 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 279 | } |
| 280 | |
| 281 | *len += sizeof(const void *); |
| 282 | |
| 283 | reserve_size = *to_base + *to + *len; |
| 284 | { |
| 285 | char stack_buffer[reserve_size]; |
| 286 | buffer = stack_buffer; |
| 287 | |
| 288 | *to_base = *to = *len = 0; |
| 289 | |
| 290 | *from = (const char*)lttng_param_string; |
| 291 | lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string); |
| 292 | |
| 293 | /* Flush pending memcpy */ |
| 294 | if (*len != 0) { |
| 295 | memcpy(buffer+*to_base+*to, *from, *len); |
| 296 | *to += *len; |
| 297 | *len = 0; |
| 298 | } |
| 299 | |
| 300 | *from = (const char*)<tng_param_pointer; |
| 301 | align = sizeof(const void *); |
| 302 | |
| 303 | if (*len == 0) { |
| 304 | *to += ltt_align(*to, align); /* align output */ |
| 305 | } else { |
| 306 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 307 | } |
| 308 | |
| 309 | *len += sizeof(const void *); |
| 310 | |
| 311 | /* Flush pending memcpy */ |
| 312 | if (*len != 0) { |
| 313 | memcpy(buffer+*to_base+*to, *from, *len); |
| 314 | *to += *len; |
| 315 | *len = 0; |
| 316 | } |
| 317 | |
| 318 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_string_pointer, buffer, reserve_size, LTT_BLOCKING, 0); |
| 319 | } |
| 320 | |
| 321 | return ret; |
| 322 | |
| 323 | } |
| 324 | #endif //LTT_TRACE |
| 325 | #endif //!LTT_TRACE_FAST |
| 326 | |
| 327 | #ifdef LTT_TRACE_FAST |
| 328 | static inline int trace_user_generic_string_pointer( |
| 329 | const char * lttng_param_string, |
| 330 | const void * lttng_param_pointer) |
| 331 | #ifndef LTT_TRACE |
| 332 | { |
| 333 | } |
| 334 | #else |
| 335 | { |
| 336 | unsigned int index; |
| 337 | struct ltt_trace_info *trace = thread_trace_info; |
| 338 | struct ltt_buf *ltt_buf; |
| 339 | char *buffer = NULL; |
| 340 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 341 | size_t *to_base = &real_to_base; |
| 342 | size_t real_to = 0; |
| 343 | size_t *to = &real_to; |
| 344 | size_t real_len = 0; |
| 345 | size_t *len = &real_len; |
| 346 | size_t reserve_size; |
| 347 | size_t slot_size; |
| 348 | size_t align; |
| 349 | const char *real_from; |
| 350 | const char **from = &real_from; |
| 351 | uint64_t tsc; |
| 352 | if (!trace) { |
| 353 | ltt_thread_init(); |
| 354 | trace = thread_trace_info; |
| 355 | } |
| 356 | |
| 357 | |
| 358 | /* For each field, calculate the field size. */ |
| 359 | /* size = *to_base + *to + *len */ |
| 360 | /* Assume that the padding for alignment starts at a |
| 361 | * sizeof(void *) address. */ |
| 362 | |
| 363 | *from = (const char*)lttng_param_string; |
| 364 | lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string); |
| 365 | |
| 366 | *from = (const char*)<tng_param_pointer; |
| 367 | align = sizeof(const void *); |
| 368 | |
| 369 | if (*len == 0) { |
| 370 | *to += ltt_align(*to, align); /* align output */ |
| 371 | } else { |
| 372 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 373 | } |
| 374 | |
| 375 | *len += sizeof(const void *); |
| 376 | |
| 377 | reserve_size = *to_base + *to + *len; |
| 378 | trace->nesting++; |
| 379 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 380 | event_user_generic_string_pointer); |
| 381 | |
| 382 | { |
| 383 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 384 | slot_size = 0; |
| 385 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 386 | reserve_size, &slot_size, &tsc); |
| 387 | if (!buffer) |
| 388 | goto end; /* buffer full */ |
| 389 | |
| 390 | *to_base = *to = *len = 0; |
| 391 | |
| 392 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 393 | ltt_facility_user_generic_B1865E44, event_user_generic_string_pointer, |
| 394 | reserve_size, tsc); |
| 395 | *from = (const char*)lttng_param_string; |
| 396 | lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string); |
| 397 | |
| 398 | /* Flush pending memcpy */ |
| 399 | if (*len != 0) { |
| 400 | memcpy(buffer+*to_base+*to, *from, *len); |
| 401 | *to += *len; |
| 402 | *len = 0; |
| 403 | } |
| 404 | |
| 405 | *from = (const char*)<tng_param_pointer; |
| 406 | align = sizeof(const void *); |
| 407 | |
| 408 | if (*len == 0) { |
| 409 | *to += ltt_align(*to, align); /* align output */ |
| 410 | } else { |
| 411 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 412 | } |
| 413 | |
| 414 | *len += sizeof(const void *); |
| 415 | |
| 416 | /* Flush pending memcpy */ |
| 417 | if (*len != 0) { |
| 418 | memcpy(buffer+*to_base+*to, *from, *len); |
| 419 | *to += *len; |
| 420 | *len = 0; |
| 421 | } |
| 422 | |
| 423 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 424 | |
| 425 | } |
| 426 | |
| 427 | end: |
| 428 | trace->nesting--; |
| 429 | } |
| 430 | #endif //LTT_TRACE |
| 431 | #endif //LTT_TRACE_FAST |
| 432 | |
| 433 | /* Event slow_printf structures */ |
| 434 | static inline void lttng_write_string_user_generic_slow_printf_string( |
| 435 | char *buffer, |
| 436 | size_t *to_base, |
| 437 | size_t *to, |
| 438 | const char **from, |
| 439 | size_t *len, |
| 440 | const char * obj) |
| 441 | { |
| 442 | size_t size; |
| 443 | size_t align; |
| 444 | |
| 445 | /* Flush pending memcpy */ |
| 446 | if (*len != 0) { |
| 447 | if (buffer != NULL) |
| 448 | memcpy(buffer+*to_base+*to, *from, *len); |
| 449 | } |
| 450 | *to += *len; |
| 451 | *len = 0; |
| 452 | |
| 453 | align = sizeof(char); |
| 454 | |
| 455 | if (*len == 0) { |
| 456 | *to += ltt_align(*to, align); /* align output */ |
| 457 | } else { |
| 458 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 459 | } |
| 460 | |
| 461 | /* Contains variable sized fields : must explode the structure */ |
| 462 | |
| 463 | size = strlen(obj) + 1; /* Include final NULL char. */ |
| 464 | if (buffer != NULL) |
| 465 | memcpy(buffer+*to_base+*to, obj, size); |
| 466 | *to += size; |
| 467 | |
| 468 | /* Realign the *to_base on arch size, set *to to 0 */ |
| 469 | *to += ltt_align(*to, sizeof(void *)); |
| 470 | *to_base = *to_base+*to; |
| 471 | *to = 0; |
| 472 | |
| 473 | /* Put source *from just after the C string */ |
| 474 | *from += size; |
| 475 | } |
| 476 | |
| 477 | |
| 478 | /* Event slow_printf logging function */ |
| 479 | static inline int trace_user_generic_slow_printf_param_buffer( |
| 480 | char *buffer, |
| 481 | size_t reserve_size); |
| 482 | |
| 483 | #ifndef LTT_TRACE_FAST |
| 484 | static inline int trace_user_generic_slow_printf_param_buffer( |
| 485 | char *buffer, |
| 486 | size_t reserve_size) |
| 487 | #ifndef LTT_TRACE |
| 488 | { |
| 489 | } |
| 490 | #else |
| 491 | { |
| 492 | int ret = 0; |
| 493 | { |
| 494 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_slow_printf, buffer, reserve_size, LTT_BLOCKING, 0); |
| 495 | } |
| 496 | |
| 497 | return ret; |
| 498 | |
| 499 | } |
| 500 | #endif //LTT_TRACE |
| 501 | #endif //!LTT_TRACE_FAST |
| 502 | |
| 503 | #ifdef LTT_TRACE_FAST |
| 504 | static inline int trace_user_generic_slow_printf( |
| 505 | const char * lttng_param_string) |
| 506 | #ifndef LTT_TRACE |
| 507 | { |
| 508 | } |
| 509 | #else |
| 510 | { |
| 511 | unsigned int index; |
| 512 | struct ltt_trace_info *trace = thread_trace_info; |
| 513 | struct ltt_buf *ltt_buf; |
| 514 | char *buffer = NULL; |
| 515 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 516 | size_t *to_base = &real_to_base; |
| 517 | size_t real_to = 0; |
| 518 | size_t *to = &real_to; |
| 519 | size_t real_len = 0; |
| 520 | size_t *len = &real_len; |
| 521 | size_t reserve_size; |
| 522 | size_t slot_size; |
| 523 | const char *real_from; |
| 524 | const char **from = &real_from; |
| 525 | uint64_t tsc; |
| 526 | if (!trace) { |
| 527 | ltt_thread_init(); |
| 528 | trace = thread_trace_info; |
| 529 | } |
| 530 | |
| 531 | |
| 532 | /* For each field, calculate the field size. */ |
| 533 | /* size = *to_base + *to + *len */ |
| 534 | /* Assume that the padding for alignment starts at a |
| 535 | * sizeof(void *) address. */ |
| 536 | |
| 537 | *from = (const char*)lttng_param_string; |
| 538 | lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string); |
| 539 | |
| 540 | reserve_size = *to_base + *to + *len; |
| 541 | trace->nesting++; |
| 542 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 543 | event_user_generic_slow_printf); |
| 544 | |
| 545 | { |
| 546 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 547 | slot_size = 0; |
| 548 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 549 | reserve_size, &slot_size, &tsc); |
| 550 | if (!buffer) |
| 551 | goto end; /* buffer full */ |
| 552 | |
| 553 | *to_base = *to = *len = 0; |
| 554 | |
| 555 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 556 | ltt_facility_user_generic_B1865E44, event_user_generic_slow_printf, |
| 557 | reserve_size, tsc); |
| 558 | *from = (const char*)lttng_param_string; |
| 559 | lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string); |
| 560 | |
| 561 | /* Flush pending memcpy */ |
| 562 | if (*len != 0) { |
| 563 | memcpy(buffer+*to_base+*to, *from, *len); |
| 564 | *to += *len; |
| 565 | *len = 0; |
| 566 | } |
| 567 | |
| 568 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 569 | |
| 570 | } |
| 571 | |
| 572 | end: |
| 573 | trace->nesting--; |
| 574 | } |
| 575 | #endif //LTT_TRACE |
| 576 | #endif //LTT_TRACE_FAST |
| 577 | |
| 578 | /* Event function_entry structures */ |
| 579 | |
| 580 | /* Event function_entry logging function */ |
| 581 | static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry( |
| 582 | const void * lttng_param_this_fn, |
| 583 | const void * lttng_param_call_site); |
| 584 | |
| 585 | #ifndef LTT_TRACE_FAST |
| 586 | static inline int trace_user_generic_function_entry( |
| 587 | const void * lttng_param_this_fn, |
| 588 | const void * lttng_param_call_site) |
| 589 | #ifndef LTT_TRACE |
| 590 | { |
| 591 | } |
| 592 | #else |
| 593 | { |
| 594 | int ret = 0; |
| 595 | char *buffer = NULL; |
| 596 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 597 | size_t *to_base = &real_to_base; |
| 598 | size_t real_to = 0; |
| 599 | size_t *to = &real_to; |
| 600 | size_t real_len = 0; |
| 601 | size_t *len = &real_len; |
| 602 | size_t reserve_size; |
| 603 | size_t slot_size; |
| 604 | size_t align; |
| 605 | const char *real_from; |
| 606 | const char **from = &real_from; |
| 607 | /* For each field, calculate the field size. */ |
| 608 | /* size = *to_base + *to + *len */ |
| 609 | /* Assume that the padding for alignment starts at a |
| 610 | * sizeof(void *) address. */ |
| 611 | |
| 612 | *from = (const char*)<tng_param_this_fn; |
| 613 | align = sizeof(const void *); |
| 614 | |
| 615 | if (*len == 0) { |
| 616 | *to += ltt_align(*to, align); /* align output */ |
| 617 | } else { |
| 618 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 619 | } |
| 620 | |
| 621 | *len += sizeof(const void *); |
| 622 | |
| 623 | *from = (const char*)<tng_param_call_site; |
| 624 | align = sizeof(const void *); |
| 625 | |
| 626 | if (*len == 0) { |
| 627 | *to += ltt_align(*to, align); /* align output */ |
| 628 | } else { |
| 629 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 630 | } |
| 631 | |
| 632 | *len += sizeof(const void *); |
| 633 | |
| 634 | reserve_size = *to_base + *to + *len; |
| 635 | { |
| 636 | char stack_buffer[reserve_size]; |
| 637 | buffer = stack_buffer; |
| 638 | |
| 639 | *to_base = *to = *len = 0; |
| 640 | |
| 641 | *from = (const char*)<tng_param_this_fn; |
| 642 | align = sizeof(const void *); |
| 643 | |
| 644 | if (*len == 0) { |
| 645 | *to += ltt_align(*to, align); /* align output */ |
| 646 | } else { |
| 647 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 648 | } |
| 649 | |
| 650 | *len += sizeof(const void *); |
| 651 | |
| 652 | /* Flush pending memcpy */ |
| 653 | if (*len != 0) { |
| 654 | memcpy(buffer+*to_base+*to, *from, *len); |
| 655 | *to += *len; |
| 656 | *len = 0; |
| 657 | } |
| 658 | |
| 659 | *from = (const char*)<tng_param_call_site; |
| 660 | align = sizeof(const void *); |
| 661 | |
| 662 | if (*len == 0) { |
| 663 | *to += ltt_align(*to, align); /* align output */ |
| 664 | } else { |
| 665 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 666 | } |
| 667 | |
| 668 | *len += sizeof(const void *); |
| 669 | |
| 670 | /* Flush pending memcpy */ |
| 671 | if (*len != 0) { |
| 672 | memcpy(buffer+*to_base+*to, *from, *len); |
| 673 | *to += *len; |
| 674 | *len = 0; |
| 675 | } |
| 676 | |
| 677 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_function_entry, buffer, reserve_size, LTT_BLOCKING, 0); |
| 678 | } |
| 679 | |
| 680 | return ret; |
| 681 | |
| 682 | } |
| 683 | #endif //LTT_TRACE |
| 684 | #endif //!LTT_TRACE_FAST |
| 685 | |
| 686 | #ifdef LTT_TRACE_FAST |
| 687 | static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry( |
| 688 | const void * lttng_param_this_fn, |
| 689 | const void * lttng_param_call_site) |
| 690 | #ifndef LTT_TRACE |
| 691 | { |
| 692 | } |
| 693 | #else |
| 694 | { |
| 695 | unsigned int index; |
| 696 | struct ltt_trace_info *trace = thread_trace_info; |
| 697 | struct ltt_buf *ltt_buf; |
| 698 | char *buffer = NULL; |
| 699 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 700 | size_t *to_base = &real_to_base; |
| 701 | size_t real_to = 0; |
| 702 | size_t *to = &real_to; |
| 703 | size_t real_len = 0; |
| 704 | size_t *len = &real_len; |
| 705 | size_t reserve_size; |
| 706 | size_t slot_size; |
| 707 | size_t align; |
| 708 | const char *real_from; |
| 709 | const char **from = &real_from; |
| 710 | uint64_t tsc; |
| 711 | if (!trace) { |
| 712 | ltt_thread_init(); |
| 713 | trace = thread_trace_info; |
| 714 | } |
| 715 | |
| 716 | |
| 717 | /* For each field, calculate the field size. */ |
| 718 | /* size = *to_base + *to + *len */ |
| 719 | /* Assume that the padding for alignment starts at a |
| 720 | * sizeof(void *) address. */ |
| 721 | |
| 722 | *from = (const char*)<tng_param_this_fn; |
| 723 | align = sizeof(const void *); |
| 724 | |
| 725 | if (*len == 0) { |
| 726 | *to += ltt_align(*to, align); /* align output */ |
| 727 | } else { |
| 728 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 729 | } |
| 730 | |
| 731 | *len += sizeof(const void *); |
| 732 | |
| 733 | *from = (const char*)<tng_param_call_site; |
| 734 | align = sizeof(const void *); |
| 735 | |
| 736 | if (*len == 0) { |
| 737 | *to += ltt_align(*to, align); /* align output */ |
| 738 | } else { |
| 739 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 740 | } |
| 741 | |
| 742 | *len += sizeof(const void *); |
| 743 | |
| 744 | reserve_size = *to_base + *to + *len; |
| 745 | trace->nesting++; |
| 746 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 747 | event_user_generic_function_entry); |
| 748 | |
| 749 | { |
| 750 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 751 | slot_size = 0; |
| 752 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 753 | reserve_size, &slot_size, &tsc); |
| 754 | if (!buffer) |
| 755 | goto end; /* buffer full */ |
| 756 | |
| 757 | *to_base = *to = *len = 0; |
| 758 | |
| 759 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 760 | ltt_facility_user_generic_B1865E44, event_user_generic_function_entry, |
| 761 | reserve_size, tsc); |
| 762 | *from = (const char*)<tng_param_this_fn; |
| 763 | align = sizeof(const void *); |
| 764 | |
| 765 | if (*len == 0) { |
| 766 | *to += ltt_align(*to, align); /* align output */ |
| 767 | } else { |
| 768 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 769 | } |
| 770 | |
| 771 | *len += sizeof(const void *); |
| 772 | |
| 773 | /* Flush pending memcpy */ |
| 774 | if (*len != 0) { |
| 775 | memcpy(buffer+*to_base+*to, *from, *len); |
| 776 | *to += *len; |
| 777 | *len = 0; |
| 778 | } |
| 779 | |
| 780 | *from = (const char*)<tng_param_call_site; |
| 781 | align = sizeof(const void *); |
| 782 | |
| 783 | if (*len == 0) { |
| 784 | *to += ltt_align(*to, align); /* align output */ |
| 785 | } else { |
| 786 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 787 | } |
| 788 | |
| 789 | *len += sizeof(const void *); |
| 790 | |
| 791 | /* Flush pending memcpy */ |
| 792 | if (*len != 0) { |
| 793 | memcpy(buffer+*to_base+*to, *from, *len); |
| 794 | *to += *len; |
| 795 | *len = 0; |
| 796 | } |
| 797 | |
| 798 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 799 | |
| 800 | } |
| 801 | |
| 802 | end: |
| 803 | trace->nesting--; |
| 804 | } |
| 805 | #endif //LTT_TRACE |
| 806 | #endif //LTT_TRACE_FAST |
| 807 | |
| 808 | /* Event function_exit structures */ |
| 809 | |
| 810 | /* Event function_exit logging function */ |
| 811 | static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit( |
| 812 | const void * lttng_param_this_fn, |
| 813 | const void * lttng_param_call_site); |
| 814 | |
| 815 | #ifndef LTT_TRACE_FAST |
| 816 | static inline int trace_user_generic_function_exit( |
| 817 | const void * lttng_param_this_fn, |
| 818 | const void * lttng_param_call_site) |
| 819 | #ifndef LTT_TRACE |
| 820 | { |
| 821 | } |
| 822 | #else |
| 823 | { |
| 824 | int ret = 0; |
| 825 | char *buffer = NULL; |
| 826 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 827 | size_t *to_base = &real_to_base; |
| 828 | size_t real_to = 0; |
| 829 | size_t *to = &real_to; |
| 830 | size_t real_len = 0; |
| 831 | size_t *len = &real_len; |
| 832 | size_t reserve_size; |
| 833 | size_t slot_size; |
| 834 | size_t align; |
| 835 | const char *real_from; |
| 836 | const char **from = &real_from; |
| 837 | /* For each field, calculate the field size. */ |
| 838 | /* size = *to_base + *to + *len */ |
| 839 | /* Assume that the padding for alignment starts at a |
| 840 | * sizeof(void *) address. */ |
| 841 | |
| 842 | *from = (const char*)<tng_param_this_fn; |
| 843 | align = sizeof(const void *); |
| 844 | |
| 845 | if (*len == 0) { |
| 846 | *to += ltt_align(*to, align); /* align output */ |
| 847 | } else { |
| 848 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 849 | } |
| 850 | |
| 851 | *len += sizeof(const void *); |
| 852 | |
| 853 | *from = (const char*)<tng_param_call_site; |
| 854 | align = sizeof(const void *); |
| 855 | |
| 856 | if (*len == 0) { |
| 857 | *to += ltt_align(*to, align); /* align output */ |
| 858 | } else { |
| 859 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 860 | } |
| 861 | |
| 862 | *len += sizeof(const void *); |
| 863 | |
| 864 | reserve_size = *to_base + *to + *len; |
| 865 | { |
| 866 | char stack_buffer[reserve_size]; |
| 867 | buffer = stack_buffer; |
| 868 | |
| 869 | *to_base = *to = *len = 0; |
| 870 | |
| 871 | *from = (const char*)<tng_param_this_fn; |
| 872 | align = sizeof(const void *); |
| 873 | |
| 874 | if (*len == 0) { |
| 875 | *to += ltt_align(*to, align); /* align output */ |
| 876 | } else { |
| 877 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 878 | } |
| 879 | |
| 880 | *len += sizeof(const void *); |
| 881 | |
| 882 | /* Flush pending memcpy */ |
| 883 | if (*len != 0) { |
| 884 | memcpy(buffer+*to_base+*to, *from, *len); |
| 885 | *to += *len; |
| 886 | *len = 0; |
| 887 | } |
| 888 | |
| 889 | *from = (const char*)<tng_param_call_site; |
| 890 | align = sizeof(const void *); |
| 891 | |
| 892 | if (*len == 0) { |
| 893 | *to += ltt_align(*to, align); /* align output */ |
| 894 | } else { |
| 895 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 896 | } |
| 897 | |
| 898 | *len += sizeof(const void *); |
| 899 | |
| 900 | /* Flush pending memcpy */ |
| 901 | if (*len != 0) { |
| 902 | memcpy(buffer+*to_base+*to, *from, *len); |
| 903 | *to += *len; |
| 904 | *len = 0; |
| 905 | } |
| 906 | |
| 907 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_function_exit, buffer, reserve_size, LTT_BLOCKING, 0); |
| 908 | } |
| 909 | |
| 910 | return ret; |
| 911 | |
| 912 | } |
| 913 | #endif //LTT_TRACE |
| 914 | #endif //!LTT_TRACE_FAST |
| 915 | |
| 916 | #ifdef LTT_TRACE_FAST |
| 917 | static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit( |
| 918 | const void * lttng_param_this_fn, |
| 919 | const void * lttng_param_call_site) |
| 920 | #ifndef LTT_TRACE |
| 921 | { |
| 922 | } |
| 923 | #else |
| 924 | { |
| 925 | unsigned int index; |
| 926 | struct ltt_trace_info *trace = thread_trace_info; |
| 927 | struct ltt_buf *ltt_buf; |
| 928 | char *buffer = NULL; |
| 929 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 930 | size_t *to_base = &real_to_base; |
| 931 | size_t real_to = 0; |
| 932 | size_t *to = &real_to; |
| 933 | size_t real_len = 0; |
| 934 | size_t *len = &real_len; |
| 935 | size_t reserve_size; |
| 936 | size_t slot_size; |
| 937 | size_t align; |
| 938 | const char *real_from; |
| 939 | const char **from = &real_from; |
| 940 | uint64_t tsc; |
| 941 | if (!trace) { |
| 942 | ltt_thread_init(); |
| 943 | trace = thread_trace_info; |
| 944 | } |
| 945 | |
| 946 | |
| 947 | /* For each field, calculate the field size. */ |
| 948 | /* size = *to_base + *to + *len */ |
| 949 | /* Assume that the padding for alignment starts at a |
| 950 | * sizeof(void *) address. */ |
| 951 | |
| 952 | *from = (const char*)<tng_param_this_fn; |
| 953 | align = sizeof(const void *); |
| 954 | |
| 955 | if (*len == 0) { |
| 956 | *to += ltt_align(*to, align); /* align output */ |
| 957 | } else { |
| 958 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 959 | } |
| 960 | |
| 961 | *len += sizeof(const void *); |
| 962 | |
| 963 | *from = (const char*)<tng_param_call_site; |
| 964 | align = sizeof(const void *); |
| 965 | |
| 966 | if (*len == 0) { |
| 967 | *to += ltt_align(*to, align); /* align output */ |
| 968 | } else { |
| 969 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 970 | } |
| 971 | |
| 972 | *len += sizeof(const void *); |
| 973 | |
| 974 | reserve_size = *to_base + *to + *len; |
| 975 | trace->nesting++; |
| 976 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 977 | event_user_generic_function_exit); |
| 978 | |
| 979 | { |
| 980 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 981 | slot_size = 0; |
| 982 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 983 | reserve_size, &slot_size, &tsc); |
| 984 | if (!buffer) |
| 985 | goto end; /* buffer full */ |
| 986 | |
| 987 | *to_base = *to = *len = 0; |
| 988 | |
| 989 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 990 | ltt_facility_user_generic_B1865E44, event_user_generic_function_exit, |
| 991 | reserve_size, tsc); |
| 992 | *from = (const char*)<tng_param_this_fn; |
| 993 | align = sizeof(const void *); |
| 994 | |
| 995 | if (*len == 0) { |
| 996 | *to += ltt_align(*to, align); /* align output */ |
| 997 | } else { |
| 998 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 999 | } |
| 1000 | |
| 1001 | *len += sizeof(const void *); |
| 1002 | |
| 1003 | /* Flush pending memcpy */ |
| 1004 | if (*len != 0) { |
| 1005 | memcpy(buffer+*to_base+*to, *from, *len); |
| 1006 | *to += *len; |
| 1007 | *len = 0; |
| 1008 | } |
| 1009 | |
| 1010 | *from = (const char*)<tng_param_call_site; |
| 1011 | align = sizeof(const void *); |
| 1012 | |
| 1013 | if (*len == 0) { |
| 1014 | *to += ltt_align(*to, align); /* align output */ |
| 1015 | } else { |
| 1016 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 1017 | } |
| 1018 | |
| 1019 | *len += sizeof(const void *); |
| 1020 | |
| 1021 | /* Flush pending memcpy */ |
| 1022 | if (*len != 0) { |
| 1023 | memcpy(buffer+*to_base+*to, *from, *len); |
| 1024 | *to += *len; |
| 1025 | *len = 0; |
| 1026 | } |
| 1027 | |
| 1028 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 1029 | |
| 1030 | } |
| 1031 | |
| 1032 | end: |
| 1033 | trace->nesting--; |
| 1034 | } |
| 1035 | #endif //LTT_TRACE |
| 1036 | #endif //LTT_TRACE_FAST |
| 1037 | |
| 1038 | /* Event thread_brand structures */ |
| 1039 | static inline void lttng_write_string_user_generic_thread_brand_name( |
| 1040 | char *buffer, |
| 1041 | size_t *to_base, |
| 1042 | size_t *to, |
| 1043 | const char **from, |
| 1044 | size_t *len, |
| 1045 | const char * obj) |
| 1046 | { |
| 1047 | size_t size; |
| 1048 | size_t align; |
| 1049 | |
| 1050 | /* Flush pending memcpy */ |
| 1051 | if (*len != 0) { |
| 1052 | if (buffer != NULL) |
| 1053 | memcpy(buffer+*to_base+*to, *from, *len); |
| 1054 | } |
| 1055 | *to += *len; |
| 1056 | *len = 0; |
| 1057 | |
| 1058 | align = sizeof(char); |
| 1059 | |
| 1060 | if (*len == 0) { |
| 1061 | *to += ltt_align(*to, align); /* align output */ |
| 1062 | } else { |
| 1063 | *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */ |
| 1064 | } |
| 1065 | |
| 1066 | /* Contains variable sized fields : must explode the structure */ |
| 1067 | |
| 1068 | size = strlen(obj) + 1; /* Include final NULL char. */ |
| 1069 | if (buffer != NULL) |
| 1070 | memcpy(buffer+*to_base+*to, obj, size); |
| 1071 | *to += size; |
| 1072 | |
| 1073 | /* Realign the *to_base on arch size, set *to to 0 */ |
| 1074 | *to += ltt_align(*to, sizeof(void *)); |
| 1075 | *to_base = *to_base+*to; |
| 1076 | *to = 0; |
| 1077 | |
| 1078 | /* Put source *from just after the C string */ |
| 1079 | *from += size; |
| 1080 | } |
| 1081 | |
| 1082 | |
| 1083 | /* Event thread_brand logging function */ |
| 1084 | static inline int trace_user_generic_thread_brand( |
| 1085 | const char * lttng_param_name); |
| 1086 | |
| 1087 | #ifndef LTT_TRACE_FAST |
| 1088 | static inline int trace_user_generic_thread_brand( |
| 1089 | const char * lttng_param_name) |
| 1090 | #ifndef LTT_TRACE |
| 1091 | { |
| 1092 | } |
| 1093 | #else |
| 1094 | { |
| 1095 | int ret = 0; |
| 1096 | char *buffer = NULL; |
| 1097 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 1098 | size_t *to_base = &real_to_base; |
| 1099 | size_t real_to = 0; |
| 1100 | size_t *to = &real_to; |
| 1101 | size_t real_len = 0; |
| 1102 | size_t *len = &real_len; |
| 1103 | size_t reserve_size; |
| 1104 | size_t slot_size; |
| 1105 | const char *real_from; |
| 1106 | const char **from = &real_from; |
| 1107 | /* For each field, calculate the field size. */ |
| 1108 | /* size = *to_base + *to + *len */ |
| 1109 | /* Assume that the padding for alignment starts at a |
| 1110 | * sizeof(void *) address. */ |
| 1111 | |
| 1112 | *from = (const char*)lttng_param_name; |
| 1113 | lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name); |
| 1114 | |
| 1115 | reserve_size = *to_base + *to + *len; |
| 1116 | { |
| 1117 | char stack_buffer[reserve_size]; |
| 1118 | buffer = stack_buffer; |
| 1119 | |
| 1120 | *to_base = *to = *len = 0; |
| 1121 | |
| 1122 | *from = (const char*)lttng_param_name; |
| 1123 | lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name); |
| 1124 | |
| 1125 | /* Flush pending memcpy */ |
| 1126 | if (*len != 0) { |
| 1127 | memcpy(buffer+*to_base+*to, *from, *len); |
| 1128 | *to += *len; |
| 1129 | *len = 0; |
| 1130 | } |
| 1131 | |
| 1132 | ret = ltt_trace_generic(ltt_facility_user_generic_B1865E44, event_user_generic_thread_brand, buffer, reserve_size, LTT_BLOCKING, 1); |
| 1133 | } |
| 1134 | |
| 1135 | return ret; |
| 1136 | |
| 1137 | } |
| 1138 | #endif //LTT_TRACE |
| 1139 | #endif //!LTT_TRACE_FAST |
| 1140 | |
| 1141 | #ifdef LTT_TRACE_FAST |
| 1142 | static inline int trace_user_generic_thread_brand( |
| 1143 | const char * lttng_param_name) |
| 1144 | #ifndef LTT_TRACE |
| 1145 | { |
| 1146 | } |
| 1147 | #else |
| 1148 | { |
| 1149 | unsigned int index; |
| 1150 | struct ltt_trace_info *trace = thread_trace_info; |
| 1151 | struct ltt_buf *ltt_buf; |
| 1152 | char *buffer = NULL; |
| 1153 | size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */ |
| 1154 | size_t *to_base = &real_to_base; |
| 1155 | size_t real_to = 0; |
| 1156 | size_t *to = &real_to; |
| 1157 | size_t real_len = 0; |
| 1158 | size_t *len = &real_len; |
| 1159 | size_t reserve_size; |
| 1160 | size_t slot_size; |
| 1161 | const char *real_from; |
| 1162 | const char **from = &real_from; |
| 1163 | uint64_t tsc; |
| 1164 | if (!trace) { |
| 1165 | ltt_thread_init(); |
| 1166 | trace = thread_trace_info; |
| 1167 | } |
| 1168 | |
| 1169 | |
| 1170 | /* For each field, calculate the field size. */ |
| 1171 | /* size = *to_base + *to + *len */ |
| 1172 | /* Assume that the padding for alignment starts at a |
| 1173 | * sizeof(void *) address. */ |
| 1174 | |
| 1175 | *from = (const char*)lttng_param_name; |
| 1176 | lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name); |
| 1177 | |
| 1178 | reserve_size = *to_base + *to + *len; |
| 1179 | trace->nesting++; |
| 1180 | index = ltt_get_index_from_facility(ltt_facility_user_generic_B1865E44, |
| 1181 | event_user_generic_thread_brand); |
| 1182 | |
| 1183 | { |
| 1184 | ltt_buf = ltt_get_channel_from_index(trace, index); |
| 1185 | slot_size = 0; |
| 1186 | buffer = ltt_reserve_slot(trace, ltt_buf, |
| 1187 | reserve_size, &slot_size, &tsc); |
| 1188 | if (!buffer) |
| 1189 | goto end; /* buffer full */ |
| 1190 | |
| 1191 | *to_base = *to = *len = 0; |
| 1192 | |
| 1193 | buffer = ltt_write_event_header(trace, ltt_buf, buffer, |
| 1194 | ltt_facility_user_generic_B1865E44, event_user_generic_thread_brand, |
| 1195 | reserve_size, tsc); |
| 1196 | *from = (const char*)lttng_param_name; |
| 1197 | lttng_write_string_user_generic_thread_brand_name(buffer, to_base, to, from, len, lttng_param_name); |
| 1198 | |
| 1199 | /* Flush pending memcpy */ |
| 1200 | if (*len != 0) { |
| 1201 | memcpy(buffer+*to_base+*to, *from, *len); |
| 1202 | *to += *len; |
| 1203 | *len = 0; |
| 1204 | } |
| 1205 | |
| 1206 | ltt_commit_slot(ltt_buf, buffer, slot_size); |
| 1207 | |
| 1208 | } |
| 1209 | |
| 1210 | end: |
| 1211 | trace->nesting--; |
| 1212 | } |
| 1213 | #endif //LTT_TRACE |
| 1214 | #endif //LTT_TRACE_FAST |
| 1215 | |
| 1216 | #ifdef __cplusplus |
| 1217 | } /* end of extern "C" */ |
| 1218 | #endif |
| 1219 | |
| 1220 | #endif //_LTT_FACILITY_USER_GENERIC_H_ |