tracetools.h
Go to the documentation of this file.
1 
11 #ifndef __TRACETOOLS_TRACETOOLS_H_
12 #define __TRACETOOLS_TRACETOOLS_H_
13 
14 #include <boost/shared_ptr.hpp>
15 #include <boost/function.hpp>
16 #include <boost/version.hpp>
17 #include <stdint.h>
18 #include <string>
19 #include <typeinfo>
20 
21 //#include "ros/callback_queue_interface.h"
22 
23 namespace ros {
24 namespace trace {
25  template<class P>
26  const void* get_ptr(const boost::function<void (P)>& func_ptr) {
27 #if BOOST_VERSION < 106200
28  return reinterpret_cast<void*>(func_ptr.functor.func_ptr);
29 #else
30  return reinterpret_cast<void*>(func_ptr.functor.members.func_ptr);
31 #endif
32  }
33 
35 bool compile_status() throw();
36 
40 void task_init(const char *task_name, const char *owner = NULL);
41 // emit a tracepoint giving the node name and its version
43 void node_init(const char *node_name, unsigned int roscpp_version);
44 
45 void timer_added(const void *fun_ptr, const char *type_info, int period_sec,
46  int period_nsec);
51 void fn_name_info(const void *fun_ptr, const void *ref);
52 
57 template <typename T>
58 void callback_wrapper(const void *func_ptr, const boost::shared_ptr<T> &helper) {
59  fn_name_info(func_ptr, helper.get());
60 }
61 
62 /*** Trace methods for callback queue processing */
63 
85 void message_processed(const char *message_name, const void *callback_ref,
86  const uint32_t receipt_time_sec,
87  const uint32_t receipt_time_nsec);
88 
107 void call_start(const void *ptr_ref, const void *data, const uint64_t trace_id);
113 void call_end(const void *ptr_ref, const void *data, const uint64_t trace_id);
115 void queue_delay(const char *queue_name, const void *ptr_ref, const void *data,
116  const uint32_t entry_time_sec, const uint32_t entry_time_nsec);
117 
118 /******* Trace methods for subscription queue processing. ******/
119 
138 void subscriber_call_start(const std::string &topic, const void *queue_ref,
139  const void *callback_ref, const void *message_ref,
140  int receipt_time_sec, int receipt_time_nsec);
141 
145 void subscriber_call_end(const std::string &topic, const void *queue_ref,
146  const void *callback_ref, const void *message_ref,
147  int receipt_time_sec, int receipt_time_nsec);
148 
149 /***** Timer-related tracing *****/
150 
156 void timer_scheduled(const void *callback_ref, const void *timer_ref);
157 void time_sleep(const void *callback_ref, int sleep_sec, int sleep_nsec);
158 
159 /****** Network-related tracing ******/
160 
162 void new_connection(const char *local_hostport_arg,
163  const char *remote_hostport_arg,
164  const void *channel_ref_arg, const char *channel_type_arg,
165  const char *name_arg, const char *data_type_arg);
167 void publisher_link_handle_message(const void *channel_ref_arg,
168  const void *buffer_ref_arg);
170 void subscriber_callback_added(const void *queue_ref_arg,
171  const void *callback_ref_arg,
172  const char *type_info_arg,
173  const char *data_type_arg,
174  const char *source_name_arg, int queue_size_arg);
175 
177 void publisher_message_queued(const char *topic_arg,
178  const void *buffer_ref_arg);
179 void publisher_message_queued(const std::string &topic_arg,
180  const void *buffer_ref_arg);
182 void subscriber_link_message_write(const void *message_ref_arg,
183  const void *channel_ref_arg);
185 void subscriber_link_message_dropped(const void *message_ref_arg);
187 void subscription_message_queued(const char *topic_arg,
188  const void *buffer_ref_arg,
189  const void *queue_ref_arg,
190  const void *callback_ref_arg,
191  const void *message_ref_arg,
192  int receipt_time_sec_arg,
193  int receipt_time_nsec_arg);
194 void subscription_message_dropped(const char *topic_arg, const void *buffer_arg,
195  const void *queue_ref_arg,
196  const void *callback_ref_arg,
197  const void *message_ref_arg,
198  int receipt_time_sec, int receipt_time_nsec);
199 
214 void link_step(const char *element_name, const void *caller_name,
215  const void *in_data_ref, const void *out_data_ref,
216  const uint64_t trace_id);
217 
218 // some helpers, not for public consumption
219 namespace impl {
221 template <typename T>
222 const void *getCallbackFunction(const boost::shared_ptr<T> &cb) {
223  return cb.get();
224 }
225 
227 std::string getCallbackInfo(const void *func_ptr, const char *name);
228 
229 template <typename T>
230 std::string getCallbackInfo(const boost::shared_ptr<T> &cb) {
231  return getCallbackInfo(cb.get(), typeid(*cb).name());
232 }
233 std::string get_backtrace(int index = -1);
234 std::string get_symbol(void *funptr);
235 }
236 }
237 }
238 
239 #endif /* __TRACETOOLS_TRACETOOLS_H_ */
void subscriber_call_end(const std::string &topic, const void *queue_ref, const void *callback_ref, const void *message_ref, int receipt_time_sec, int receipt_time_nsec)
Marks the end of the call, same arguments as above.
Definition: tracetools.cpp:229
void callback_wrapper(const void *func_ptr, const boost::shared_ptr< T > &helper)
Legacy compatibility function for above which takes a wrapper function directly.
Definition: tracetools.h:58
std::string getCallbackInfo(const void *func_ptr, const char *name)
try to get a name for the function inside the CallbackInterfacePtr
Definition: tracetools.cpp:287
void subscriber_callback_added(const void *queue_ref_arg, const void *callback_ref_arg, const char *type_info_arg, const char *data_type_arg, const char *source_name_arg, int queue_size_arg)
Trace metadata on a new subscription callback.
Definition: tracetools.cpp:210
std::string get_backtrace(int index=-1)
Definition: tracetools.cpp:247
void timer_added(const void *fun_ptr, const char *type_info, int period_sec, int period_nsec)
Definition: tracetools.cpp:107
void node_init(const char *node_name, unsigned int roscpp_version)
also set&#39;s procname, but be aware that&#39;s limited to 16 chars
Definition: tracetools.cpp:61
void fn_name_info(const void *fun_ptr, const void *ref)
Emit tracing information linking the function ptr&#39;s name to the given reference pointer.
Definition: tracetools.cpp:88
std::string get_symbol(void *funptr)
Definition: tracetools.cpp:277
void publisher_link_handle_message(const void *channel_ref_arg, const void *buffer_ref_arg)
Trace metadata on creation of a publisher link (incoming topic connection)
Definition: tracetools.cpp:152
void publisher_message_queued(const char *topic_arg, const void *buffer_ref_arg)
Trace a message being queue for publishing.
Definition: tracetools.cpp:160
void new_connection(const char *local_hostport_arg, const char *remote_hostport_arg, const void *channel_ref_arg, const char *channel_type_arg, const char *name_arg, const char *data_type_arg)
Trace metadata on creation of a new connection.
Definition: tracetools.cpp:143
void subscriber_link_message_dropped(const void *message_ref_arg)
Trac on an incoming message being dropped (queue full, etc.)
Definition: tracetools.cpp:180
void call_end(const void *ptr_ref, const void *data, const uint64_t trace_id)
Trace the end of a user-callback invocation.
Definition: tracetools.cpp:73
void time_sleep(const void *callback_ref, int sleep_sec, int sleep_nsec)
Definition: tracetools.cpp:122
void task_init(const char *task_name, const char *owner=NULL)
emit a tracepoint specifying a name for this thread.
Definition: tracetools.cpp:36
void subscription_message_queued(const char *topic_arg, const void *buffer_ref_arg, const void *queue_ref_arg, const void *callback_ref_arg, const void *message_ref_arg, int receipt_time_sec_arg, int receipt_time_nsec_arg)
Trace on a message having been received and queued.
Definition: tracetools.cpp:186
const void * get_ptr(const boost::function< void(P)> &func_ptr)
Definition: tracetools.h:26
bool compile_status()
report whether tracing is compiled in
Definition: tracetools.cpp:29
void queue_delay(const char *queue_name, const void *ptr_ref, const void *data, const uint32_t entry_time_sec, const uint32_t entry_time_nsec)
Trace queue delay experienced by the given function pointer.
Definition: tracetools.cpp:238
void message_processed(const char *message_name, const void *callback_ref, const uint32_t receipt_time_sec, const uint32_t receipt_time_nsec)
Mark the processing of a given "message".
Definition: tracetools.cpp:79
tracing_tools.hpp
Definition: tracetools.h:23
void subscription_message_dropped(const char *topic_arg, const void *buffer_arg, const void *queue_ref_arg, const void *callback_ref_arg, const void *message_ref_arg, int receipt_time_sec, int receipt_time_nsec)
Definition: tracetools.cpp:196
const void * getCallbackFunction(const boost::shared_ptr< T > &cb)
get the function being pointed to by the CallbackInterfacePtr
Definition: tracetools.h:222
void subscriber_call_start(const std::string &topic, const void *queue_ref, const void *callback_ref, const void *message_ref, int receipt_time_sec, int receipt_time_nsec)
Trace the invocation of a previously queued subscriber call.
Definition: tracetools.cpp:221
void call_start(const void *ptr_ref, const void *data, const uint64_t trace_id)
Trace the start of a function call through a function pointer.
Definition: tracetools.cpp:67
void timer_scheduled(const void *callback_ref, const void *timer_ref)
Emit tracing information that the timer identified by &#39;timer_ref&#39; has been scheduled for invocation o...
Definition: tracetools.cpp:116
void subscriber_link_message_write(const void *message_ref_arg, const void *channel_ref_arg)
Trace on a message being written to the socket.
Definition: tracetools.cpp:173
void link_step(const char *element_name, const void *caller_name, const void *in_data_ref, const void *out_data_ref, const uint64_t trace_id)
Emit a trace message for a link in a processing chain.
Definition: tracetools.cpp:128


tracetools
Author(s): Ingo Luetkebohle
autogenerated on Wed Dec 18 2019 03:54:24