int lttng_ust_trace_clock_set_description_cb(const char *(*description)(void)) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; user_tc.description = description; return 0; }
int lttng_ust_trace_clock_set_name_cb(const char *(*name)(void)) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; user_tc.name = name; return 0; }
int lttng_ust_trace_clock_set_uuid_cb(int (*uuid)(char *uuid)) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; user_tc.uuid = uuid; return 0; }
int lttng_ust_trace_clock_set_freq_cb(uint64_t (*freq)(void)) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; user_tc.freq = freq; return 0; }
int lttng_ust_trace_clock_set_read64_cb(uint64_t (*read64)(void)) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; user_tc.read64 = read64; return 0; }
static inline pid_t wrapper_getvpid(void) { pid_t vpid; vpid = CMM_LOAD_SHARED(cached_vpid); if (caa_unlikely(!vpid)) { vpid = getpid(); CMM_STORE_SHARED(cached_vpid, vpid); } return vpid; }
static void *output_thread_fct(void *data) { DBG("In user output thread."); rcu_register_thread(); /* Read keys typed by the user */ while (!CMM_LOAD_SHARED(exit_program)) { if (!CMM_LOAD_SHARED(hide_output)) { pthread_mutex_lock(&print_output_mutex); DBG("Refresh screen."); do_print_output(); fflush(stdout); pthread_mutex_unlock(&print_output_mutex); } sleep(URCU_GAME_REFRESH_PERIOD); } rcu_unregister_thread(); DBG("User output thread exiting."); return NULL; }
int lttng_ust_enable_trace_clock_override(void) { if (CMM_LOAD_SHARED(lttng_trace_clock)) return -EBUSY; if (!user_tc.read64) return -EINVAL; if (!user_tc.freq) return -EINVAL; if (!user_tc.name) return -EINVAL; if (!user_tc.description) return -EINVAL; /* Use default uuid cb when NULL */ cmm_smp_mb(); /* Store callbacks before trace clock */ CMM_STORE_SHARED(lttng_trace_clock, &user_tc); return 0; }