tracers-codegen 0.1.0

Contains the compile-time code generation logic which powers the `probe` and `tracers` macros. Do not use this crate directly; see "tracers" for more information.
Documentation
/** This file automatically generated by {{env!("CARGO_PKG_NAME")}} {{env!("CARGO_PKG_VERSION")}}.  Do not edit
 * this file.
 *
 * This file contains native wrappers for the probes defined in trait {{spec.ident()}}.
 *
 * The source code for that trait is:
 *
 * ```rust
 * {{spec.token_stream().to_string()}}
 * ```
 */

#include "{{spec.name_with_hash()}}_provider.h"

extern "C" {
/* The C-callable wrapper functions which the Rust bindings will invoke in order to fire the probes */
{% for probe_spec in spec.probes() %}
    {% let args = self.get_probe_args(probe_spec) %}

    /* A C function which fires the {{spec.name()}} probe {{probe_spec.name}} */
    void {{spec.name_with_hash()}}_{{probe_spec.name}}(
	{%for arg in args %}{{ arg.arg_type_info().get_c_type_str() }} {{ arg.name() }}{% if !loop.last %}, {% endif %}{%endfor%}
    ) {
	//Fire the probe with LTTng
	//Note we use the `do_tracepoint` macro because we know the Rust code will have already tested `tracepoint_enabled`
	do_tracepoint(
	    {{ spec.name() }},
	    {{ probe_spec.name }}
	    {% for arg in args %}, {{ arg.name() }}{%endfor%}
	);
    }

    /* A C function which tests if  the {{spec.name()}} probe {{probe_spec.name}} is enabled */
    bool {{spec.name()}}_{{probe_spec.name}}_enabled() {
	return tracepoint_enabled(
	    {{ spec.name() }},
	    {{ probe_spec.name }}
	);
    }

{% endfor %}

}