X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=doc%2Fexamples%2Feasy-ust%2Fsample_component_provider.h;h=39d748e7cb43da1b0b7f2c5383e6fdbf6ffea945;hb=3202f63a4d5e599bf22d6711828614b58c7efcba;hp=d63ff5a8a5a162f38ad418609c9191bc8c86eb9b;hpb=7ccf75d384dd852f7aa51b44663546dd3c6baa83;p=lttng-ust.git diff --git a/doc/examples/easy-ust/sample_component_provider.h b/doc/examples/easy-ust/sample_component_provider.h index d63ff5a8..39d748e7 100644 --- a/doc/examples/easy-ust/sample_component_provider.h +++ b/doc/examples/easy-ust/sample_component_provider.h @@ -1,19 +1,12 @@ /* - * Copyright (C) 2011-2012 Mathieu Desnoyers - * Copyright (C) 2011-2012 Matthew Khouzam + * SPDX-License-Identifier: MIT * - * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED - * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. - * - * Permission is hereby granted to use or copy this program for any - * purpose, provided the above notices are retained on all copies. - * Permission to modify the code and to distribute modified code is - * granted, provided the above notices are retained, and a notice that - * the code was modified is included with the above copyright notice. + * Copyright (C) 2011-2012 Mathieu Desnoyers + * Copyright (C) 2011-2012 Matthew Khouzam */ - + /* - * Sample lttng-ust tracepoint provider. + * Sample lttng-ust tracepoint provider. */ /* @@ -21,8 +14,8 @@ * We undef a macro before defining it as it can be used in several files. */ -/* - * Must be included before include tracepoint provider +/* + * Must be included before include tracepoint provider * ex.: project_event * ex.: project_component_event * @@ -32,111 +25,97 @@ * In this example, "sample" is the project, and "component" is the * component. */ -#undef TRACEPOINT_PROVIDER -#define TRACEPOINT_PROVIDER sample_component +#undef LTTNG_UST_TRACEPOINT_PROVIDER +#define LTTNG_UST_TRACEPOINT_PROVIDER sample_component /* * include file (this files's name) */ -#undef TRACEPOINT_INCLUDE_FILE -#define TRACEPOINT_INCLUDE_FILE ./sample_component_provider.h - -/* - * Add this macro and its matching element to make sure the program - * works in c++. - */ -#ifdef __cplusplus -#extern "C"{ -#endif /*__cplusplus */ +#undef LTTNG_UST_TRACEPOINT_INCLUDE +#define LTTNG_UST_TRACEPOINT_INCLUDE "./sample_component_provider.h" /* * Add this precompiler conditionals to ensure the tracepoint event generation * can include this file more than once. */ -#if !defined(_SAMPLE_COMPONENT_PROVIDER_H) || defined(TRACEPOINT_HEADER_MULTI_READ) +#if !defined(_SAMPLE_COMPONENT_PROVIDER_H) || defined(LTTNG_UST_TRACEPOINT_HEADER_MULTI_READ) #define _SAMPLE_COMPONENT_PROVIDER_H /* * Add this to allow programs to call "tracepoint(...): - */ -#include + */ +#include /* * The following tracepoint event writes a message (c string) into the * field message of the trace event message in the provider * sample_component in other words: * - * sample_component:message:message = text. + * sample_component:message:message = text. */ -TRACEPOINT_EVENT( +LTTNG_UST_TRACEPOINT_EVENT( /* * provider name, not a variable but a string starting with a letter - * and containing either letters, numbers or underscores. - * Needs to be the same as TRACEPOINT_PROVIDER + * and containing either letters, numbers or underscores. + * Needs to be the same as LTTNG_UST_TRACEPOINT_PROVIDER */ sample_component, /* - * tracepoint name, same format as sample provider. Does not need to be - * declared before. in this case the name is "message" + * tracepoint name, same format as sample provider. Does not need to be + * declared before. in this case the name is "message" */ message, /* - * TP_ARGS macro contains the arguments passed for the tracepoint + * LTTNG_UST_TP_ARGS macro contains the arguments passed for the tracepoint * it is in the following format - * TP_ARGS( type1, name1, type2, name2, ... type10, name10) - * where there can be from zero to ten elements. - * typeN is the datatype, such as int, struct or double **. - * name is the variable name (in "int myInt" the name would be myint) - * TP_ARGS() is valid to mean no arguments - * TP_ARGS( void ) is valid too - */ - TP_ARGS(char *, text), + * LTTNG_UST_TP_ARGS( type1, name1, type2, name2, ... type10, name10) + * where there can be from zero to ten elements. + * typeN is the datatype, such as int, struct or double **. + * name is the variable name (in "int myInt" the name would be myint) + * LTTNG_UST_TP_ARGS() is valid to mean no arguments + * LTTNG_UST_TP_ARGS( void ) is valid too + */ + LTTNG_UST_TP_ARGS(const char *, text), /* - * TP_FIELDS describes how to write the fields of the trace event. + * LTTNG_UST_TP_FIELDS describes how to write the fields of the trace event. * You can use the args here */ - TP_FIELDS( + LTTNG_UST_TP_FIELDS( /* - * The ctf_string macro takes a c string and writes it into a field - * named "message" - */ - ctf_string(message, text) + * The lttng_ust_field_string macro takes a c string and writes it into a field + * named "message" + */ + lttng_ust_field_string(message, text) ) ) /* - * Trace loglevel, shows the level of the trace event. It can be TRACE_EMERG, - * TRACE_ALERT, TRACE_CRIT, TRACE_ERR, TRACE_WARNING, TRACE_INFO or others. - * If this is not set, TRACE_DEFAULT is assumed. - * The first two arguments identify the tracepoint - * See details in line 347 + * Trace loglevel, shows the level of the trace event. It can be + * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG, LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT, + * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT, LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR, + * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO or + * others. If this is not set, LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT is + * assumed. The first two arguments identify the tracepoint See details in + * line 347 */ -TRACEPOINT_LOGLEVEL( +LTTNG_UST_TRACEPOINT_LOGLEVEL( /* - * The provider name, must be the same as the provider name in the - * TRACEPOINT_EVENT and as TRACEPOINT_PROVIDER above. + * The provider name, must be the same as the provider name in the + * LTTNG_UST_TRACEPOINT_EVENT and as LTTNG_UST_TRACEPOINT_PROVIDER above. */ - sample_component, - /* - * The tracepoint name, must be the same as the tracepoint name in the - * TRACEPOINT_EVENT + sample_component, + /* + * The tracepoint name, must be the same as the tracepoint name in the + * LTTNG_UST_TRACEPOINT_EVENT */ - message, + message, /* * The tracepoint loglevel. Warning, some levels are abbreviated and * others are not, please see */ - TRACE_WARNING) + LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING) #endif /* _SAMPLE_COMPONENT_PROVIDER_H */ /* - * Add this after defining the tracepoint events to expand the macros. - */ -#include - -/* - * Add this macro and its matching element to make sure the program - * works in c++. + * Add this after defining the tracepoint events to expand the macros. */ -#ifdef __cplusplus -} -#endif /*__cplusplus */ +#include