libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
traceanalyzer.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2013 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QITYPE_TRACEANALYZER_HPP_
8 #define _QITYPE_TRACEANALYZER_HPP_
9 
10 #include <boost/utility.hpp>
11 #include <memory>
13 
14 
15 namespace qi
16 {
17  class TraceAnalyzerImpl;
18 
19  class QI_API TraceAnalyzer: public boost::noncopyable
20  {
21  public:
22  TraceAnalyzer();
23  ~TraceAnalyzer();
25  void clear();
27  void clear(const qi::os::timeval& limit);
29  void addTrace(const qi::EventTrace& e, unsigned int objectId);
30  struct FlowLink
31  {
32  FlowLink(unsigned int srcObj, unsigned int srcFun, unsigned int dstObj, unsigned int dstFun, bool sync)
33  : srcObj(srcObj), srcFun(srcFun), dstObj(dstObj), dstFun(dstFun), sync(sync) {}
34  unsigned int srcObj, srcFun, dstObj, dstFun;
35  bool sync;
36  };
38  void analyze(std::set<FlowLink>& links);
40  void dumpTraces(std::ostream& o);
41  std::string dumpTraces();
42  protected:
43  std::unique_ptr<TraceAnalyzerImpl> _p;
44  };
45 }
46 
47 
48 namespace qi
49 {
51  {
52  #define _qi_FIELD(f) if (a.f != b.f) return a.f < b.f
53  _qi_FIELD(srcObj);
54  _qi_FIELD(srcFun);
55  _qi_FIELD(dstObj);
56  _qi_FIELD(dstFun);
57  _qi_FIELD(sync);
58  return false;
59  #undef _qi_FIELD
60  }
61 }
62 
63 #endif
#define QI_API
Definition: api.hpp:33
std::unique_ptr< TraceAnalyzerImpl > _p
#define _qi_FIELD(f)
struct similar to POSIX timeval
Definition: os.hpp:293
bool operator<(const AnyReference &a, const AnyReference &b)