16#define X(id, str) {.name = str, .type = (int)YAC_INSTR_##id},
19 {.
name =
"total number of instrumented regions",
23#define CHECK_REGION_ID(id) \
25 (int)(id) >= 0 && (int)(id) < YAC_INSTR_REGION_COUNT, \
26 "invalid instrumentation region id %d", (int)(id))
86#define INSTR_IS_ACTIVE() (yac_free_frame != NULL)
87#define INSTR_DEPTH() (int)(yac_free_frame - yac_region_open)
88#define INSTR_HAS_OPEN() (yac_free_frame != yac_region_open)
89#define INSTR_INNERMOST_OPEN() (yac_free_frame - 1)
110 "Cannot change callbacks while regions are active — region '%s', "
111 "started at %s:%d, was never stopped.",
132 (start_cb || stop_cb) ||
133 (!create_cb && !destroy_cb && !
user_data),
134 "At least one of start_cb or stop_cb must be provided, otherwise "
135 "instrumentation is disabled and all other callbacks/user_data must be "
166 "invalid instrumentation region id %d",
id)
193 "Region '%s' started at %s:%d while already active at depth %d "
194 "(opened at %s:%d) — recursive nesting of the same region is not "
195 "allowed, and a missing YAC_INSTRUMENT_STOP for the earlier call is a "
227 "Region '%s' stopped at %s:%d while not active — instrumentation is "
237 "Region '%s' stopped at %s:%d, but the innermost open region is '%s' "
238 "(opened at %s:%d) — a YAC_INSTRUMENT_STOP for it was skipped.",
#define YAC_ASSERT(exp, msg)
char const * yac_name_type_pair_get_name(struct yac_name_type_pair const *pairs, size_t count, int type)
#define INSTR_IS_ACTIVE()
static yac_instrument_create_cb yac_create_cb
static void * yac_user_data
void yac_instrument_stop_impl(yac_instrument_region_id id, char const *file, int line)
Stop an instrumented region. Do not call directly — use the YAC_INSTRUMENT_STOP macro below,...
static yac_instrument_stop_cb yac_stop_cb
#define INSTR_INNERMOST_OPEN()
static yac_region_state yac_region[YAC_INSTR_REGION_COUNT]
const char * yac_instrument_region_name_f2c(int id)
void yac_instrument_set_callbacks(yac_instrument_create_cb create_cb, yac_instrument_start_cb start_cb, yac_instrument_stop_cb stop_cb, yac_instrument_destroy_cb destroy_cb, void *user_data)
static yac_instrument_start_cb yac_start_cb
static struct yac_name_type_pair const yac_region_name_type_pair[]
void yac_instrument_start_impl(yac_instrument_region_id id, char const *file, int line)
Start an instrumented region. Do not call directly — use the YAC_INSTRUMENT_START macro below,...
#define CHECK_REGION_ID(id)
static char const * yac_region_name(yac_instrument_region_id id)
static yac_region_open_frame * yac_free_frame
void yac_instrument_clear_callbacks(void)
const char * yac_instrument_region_name(yac_instrument_region_id id)
static yac_region_open_frame yac_region_open[YAC_INSTR_REGION_COUNT]
static void yac_instrument_open_frame_reset(yac_region_open_frame *frame)
static yac_instrument_destroy_cb yac_destroy_cb
void(* yac_instrument_start_cb)(int id, void *region_handle, int depth, void *user_data)
void *(* yac_instrument_create_cb)(int id, void *user_data)
void(* yac_instrument_stop_cb)(int id, void *region_handle, int depth, void *user_data)
void(* yac_instrument_destroy_cb)(int id, void *region_handle, void *user_data)
#define YAC_INSTRUMENT_REGION_TABLE
const char * name
String name (e.g., "true")
Frame of an open instrumented region.
yac_instrument_region_id id
State of a single instrumented region ID.
#define YAC_ASSERT_F(exp, format,...)