diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | Pull requests | README | LICENSE

diary-tp.h (4163B)


      1 // LTTng 2.13 prepends the lttng_ust_ and LTTNG_UST_ prefix to all names
      2 // to offer a consistent API namespace. Prefer the pre 2.13 behavior (API v0).
      3 #define LTTNG_UST_COMPAT_API_VERSION 0
      4 
      5 #undef TRACEPOINT_PROVIDER
      6 #define TRACEPOINT_PROVIDER diary
      7 
      8 #undef TRACEPOINT_INCLUDE
      9 #define TRACEPOINT_INCLUDE "diary-tp.h"
     10 
     11 #if !defined(_DIARY_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
     12 #define _DIARY_TP_H
     13 
     14 #include <time.h>
     15 #include <lttng/tracepoint.h>
     16 
     17 // Instrument a C user application
     18 // https://lttng.org/docs/v2.13/#doc-c-application
     19 
     20 TRACEPOINT_EVENT(
     21     diary,
     22     error,
     23     TP_ARGS(
     24         char*, msg_arg
     25     ),
     26     TP_FIELDS(
     27         ctf_string(msg, msg_arg)
     28     )
     29 )
     30 
     31 TRACEPOINT_EVENT(
     32     diary,
     33     error_string,
     34     TP_ARGS(
     35         char*, msg_arg,
     36         const char*, arg1
     37     ),
     38     TP_FIELDS(
     39         ctf_string(msg, msg_arg)
     40         ctf_string(arg1, arg1)
     41     )
     42 )
     43 
     44 TRACEPOINT_EVENT(
     45     diary,
     46     error_date,
     47     TP_ARGS(
     48         char*, msg_arg,
     49         const struct tm*, date_arg
     50     ),
     51     TP_FIELDS(
     52         ctf_string(msg, msg_arg)
     53         ctf_string(date_arg, asctime(date_arg))
     54     )
     55 )
     56 
     57 TRACEPOINT_EVENT(
     58     diary,
     59     error_int_long,
     60     TP_ARGS(
     61         char*, msg_arg,
     62         int, n_arg,
     63         long, m_arg
     64     ),
     65     TP_FIELDS(
     66         ctf_string(msg, msg_arg)
     67         ctf_integer(int, n, n_arg)
     68         ctf_integer(long, m, m_arg)
     69     )
     70 )
     71 
     72 TRACEPOINT_EVENT(
     73     diary,
     74     debug,
     75     TP_ARGS(
     76         char*, msg_arg
     77     ),
     78     TP_FIELDS(
     79         ctf_string(msg, msg_arg)
     80     )
     81 )
     82 
     83 TRACEPOINT_EVENT(
     84     diary,
     85     debug_string,
     86     TP_ARGS(
     87         char*, msg_arg,
     88         char*, arg1
     89     ),
     90     TP_FIELDS(
     91         ctf_string(msg, msg_arg)
     92         ctf_string(arg1, arg1)
     93     )
     94 )
     95 
     96 TRACEPOINT_EVENT(
     97     diary,
     98     debug_int,
     99     TP_ARGS(
    100         char*, msg_arg,
    101         int, n_arg
    102     ),
    103     TP_FIELDS(
    104         ctf_string(msg, msg_arg)
    105         ctf_integer(int, n, n_arg)
    106     )
    107 )
    108 
    109 TRACEPOINT_EVENT(
    110     diary,
    111     debug_double,
    112     TP_ARGS(
    113         char*, msg_arg,
    114         double, n_arg
    115     ),
    116     TP_FIELDS(
    117         ctf_string(msg, msg_arg)
    118         ctf_integer(double, n, n_arg)
    119     )
    120 )
    121 
    122 TRACEPOINT_EVENT(
    123     diary,
    124     debug_long,
    125     TP_ARGS(
    126         char*, msg_arg,
    127         long, n_arg
    128     ),
    129     TP_FIELDS(
    130         ctf_string(msg, msg_arg)
    131         ctf_integer(long, n, n_arg)
    132     )
    133 )
    134 
    135 TRACEPOINT_EVENT(
    136     diary,
    137     debug_sizet,
    138     TP_ARGS(
    139         char*, msg_arg,
    140         size_t, n_arg
    141     ),
    142     TP_FIELDS(
    143         ctf_string(msg, msg_arg)
    144         ctf_integer(size_t, n, n_arg)
    145     )
    146 )
    147 
    148 TRACEPOINT_EVENT(
    149     diary,
    150     debug_tm,
    151     TP_ARGS(
    152         char*, msg_arg,
    153         const struct tm*, date
    154     ),
    155     TP_FIELDS(
    156         ctf_string(msg, msg_arg)
    157         ctf_integer(int, tm_sec,   date->tm_sec)
    158         ctf_integer(int, tm_min,   date->tm_min)
    159         ctf_integer(int, tm_hour,  date->tm_hour)
    160         ctf_integer(int, tm_mday,  date->tm_mday)
    161         ctf_integer(int, tm_mon,   date->tm_mon)
    162         ctf_integer(int, tm_year,  date->tm_year)
    163         ctf_integer(int, tm_wday,  date->tm_wday)
    164         ctf_integer(int, tm_yday,  date->tm_yday)
    165         ctf_integer(int, tm_isdst, date->tm_isdst)
    166     )
    167 )
    168 
    169 TRACEPOINT_EVENT(
    170     diary,
    171     warning_string,
    172     TP_ARGS(
    173         char*, msg_arg,
    174         char*, arg1
    175     ),
    176     TP_FIELDS(
    177         ctf_string(msg, msg_arg)
    178         ctf_string(arg1, arg1)
    179     )
    180 )
    181 
    182 /* Log level assignment                     */
    183 // TRACE_ERR
    184 // TRACE_WARNING
    185 // TRACE_INFO
    186 // TRACE_DEBUG_LINE (default)
    187 TRACEPOINT_LOGLEVEL(diary, error, TRACE_ERR)
    188 TRACEPOINT_LOGLEVEL(diary, error_string, TRACE_ERR)
    189 TRACEPOINT_LOGLEVEL(diary, error_date, TRACE_ERR)
    190 TRACEPOINT_LOGLEVEL(diary, error_int_long, TRACE_ERR)
    191 TRACEPOINT_LOGLEVEL(diary, debug, TRACE_DEBUG)
    192 TRACEPOINT_LOGLEVEL(diary, debug_string, TRACE_DEBUG)
    193 TRACEPOINT_LOGLEVEL(diary, debug_int, TRACE_DEBUG)
    194 TRACEPOINT_LOGLEVEL(diary, debug_double, TRACE_DEBUG)
    195 TRACEPOINT_LOGLEVEL(diary, debug_long, TRACE_DEBUG)
    196 TRACEPOINT_LOGLEVEL(diary, debug_sizet, TRACE_DEBUG)
    197 TRACEPOINT_LOGLEVEL(diary, debug_tm, TRACE_DEBUG)
    198 TRACEPOINT_LOGLEVEL(diary, warning_string, TRACE_WARNING)
    199 
    200 #endif /* _DIARY_TP_H */
    201 
    202 #include <lttng/tracepoint-event.h>