00001
00011 #ifndef __TRACETOOLS_TRACETOOLS_H_
00012 #define __TRACETOOLS_TRACETOOLS_H_
00013
00014 #include <boost/shared_ptr.hpp>
00015 #include <boost/function.hpp>
00016 #include <boost/version.hpp>
00017 #include <stdint.h>
00018 #include <string>
00019 #include <typeinfo>
00020
00021
00022
00023 namespace ros {
00024 namespace trace {
00025 template<class P>
00026 const void* get_ptr(const boost::function<void (P)>& func_ptr) {
00027 #if BOOST_VERSION < 106200
00028 return reinterpret_cast<void*>(func_ptr.functor.func_ptr);
00029 #else
00030 return reinterpret_cast<void*>(func_ptr.functor.members.func_ptr);
00031 #endif
00032 }
00033
00035 bool compile_status() throw();
00036
00040 void task_init(const char *task_name, const char *owner = NULL);
00041
00043 void node_init(const char *node_name, unsigned int roscpp_version);
00044
00045 void timer_added(const void *fun_ptr, const char *type_info, int period_sec,
00046 int period_nsec);
00051 void fn_name_info(const void *fun_ptr, const void *ref);
00052
00057 template <typename T>
00058 void callback_wrapper(const void *func_ptr, const boost::shared_ptr<T> &helper) {
00059 fn_name_info(func_ptr, helper.get());
00060 }
00061
00062
00063
00085 void message_processed(const char *message_name, const void *callback_ref,
00086 const uint32_t receipt_time_sec,
00087 const uint32_t receipt_time_nsec);
00088
00107 void call_start(const void *ptr_ref, const void *data, const uint64_t trace_id);
00113 void call_end(const void *ptr_ref, const void *data, const uint64_t trace_id);
00115 void queue_delay(const char *queue_name, const void *ptr_ref, const void *data,
00116 const uint32_t entry_time_sec, const uint32_t entry_time_nsec);
00117
00118
00119
00138 void subscriber_call_start(const std::string &topic, const void *queue_ref,
00139 const void *callback_ref, const void *message_ref,
00140 int receipt_time_sec, int receipt_time_nsec);
00141
00145 void subscriber_call_end(const std::string &topic, const void *queue_ref,
00146 const void *callback_ref, const void *message_ref,
00147 int receipt_time_sec, int receipt_time_nsec);
00148
00149
00150
00156 void timer_scheduled(const void *callback_ref, const void *timer_ref);
00157 void time_sleep(const void *callback_ref, int sleep_sec, int sleep_nsec);
00158
00159
00160
00162 void new_connection(const char *local_hostport_arg,
00163 const char *remote_hostport_arg,
00164 const void *channel_ref_arg, const char *channel_type_arg,
00165 const char *name_arg, const char *data_type_arg);
00167 void publisher_link_handle_message(const void *channel_ref_arg,
00168 const void *buffer_ref_arg);
00170 void subscriber_callback_added(const void *queue_ref_arg,
00171 const void *callback_ref_arg,
00172 const char *type_info_arg,
00173 const char *data_type_arg,
00174 const char *source_name_arg, int queue_size_arg);
00175
00177 void publisher_message_queued(const char *topic_arg,
00178 const void *buffer_ref_arg);
00179 void publisher_message_queued(const std::string &topic_arg,
00180 const void *buffer_ref_arg);
00182 void subscriber_link_message_write(const void *message_ref_arg,
00183 const void *channel_ref_arg);
00185 void subscriber_link_message_dropped(const void *message_ref_arg);
00187 void subscription_message_queued(const char *topic_arg,
00188 const void *buffer_ref_arg,
00189 const void *queue_ref_arg,
00190 const void *callback_ref_arg,
00191 const void *message_ref_arg,
00192 int receipt_time_sec_arg,
00193 int receipt_time_nsec_arg);
00194 void subscription_message_dropped(const char *topic_arg, const void *buffer_arg,
00195 const void *queue_ref_arg,
00196 const void *callback_ref_arg,
00197 const void *message_ref_arg,
00198 int receipt_time_sec, int receipt_time_nsec);
00199
00214 void link_step(const char *element_name, const void *caller_name,
00215 const void *in_data_ref, const void *out_data_ref,
00216 const uint64_t trace_id);
00217
00218
00219 namespace impl {
00221 template <typename T>
00222 const void *getCallbackFunction(const boost::shared_ptr<T> &cb) {
00223 return cb.get();
00224 }
00225
00227 std::string getCallbackInfo(const void *func_ptr, const char *name);
00228
00229 template <typename T>
00230 std::string getCallbackInfo(const boost::shared_ptr<T> &cb) {
00231 return getCallbackInfo(cb.get(), typeid(*cb).name());
00232 }
00233 std::string get_backtrace(int index = -1);
00234 std::string get_symbol(void *funptr);
00235 }
00236 }
00237 }
00238
00239 #endif