perf_counter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
5 #ifndef UAVCAN_TRANSPORT_PERF_COUNTER_HPP_INCLUDED
6 #define UAVCAN_TRANSPORT_PERF_COUNTER_HPP_INCLUDED
7 
8 #include <uavcan/std.hpp>
11 
12 namespace uavcan
13 {
14 
15 #if UAVCAN_TINY
16 
17 class UAVCAN_EXPORT TransferPerfCounter : Noncopyable
18 {
19 public:
20  void addTxTransfer() { }
21  void addRxTransfer() { }
22  void addError() { }
23  void addErrors(unsigned) { }
24  uint64_t getTxTransferCount() const { return 0; }
25  uint64_t getRxTransferCount() const { return 0; }
26  uint64_t getErrorCount() const { return 0; }
27 };
28 
29 #else
30 
37 {
41 
42 public:
44  : transfers_tx_(0)
45  , transfers_rx_(0)
46  , errors_(0)
47  { }
48 
49  void addTxTransfer() { transfers_tx_++; }
50  void addRxTransfer() { transfers_rx_++; }
51 
52  void addError() { errors_++; }
53 
54  void addErrors(unsigned errors)
55  {
56  errors_ += errors;
57  }
58 
63  const uint64_t& getTxTransferCount() const { return transfers_tx_; }
64  const uint64_t& getRxTransferCount() const { return transfers_rx_; }
65  const uint64_t& getErrorCount() const { return errors_; }
66 };
67 
68 #endif
69 
70 }
71 
72 #endif // UAVCAN_TRANSPORT_PERF_COUNTER_HPP_INCLUDED
const uint64_t & getErrorCount() const
const uint64_t & getTxTransferCount() const
std::uint64_t uint64_t
Definition: std.hpp:27
const uint64_t & getRxTransferCount() const
void addErrors(unsigned errors)


uavcan_communicator
Author(s):
autogenerated on Wed Jan 11 2023 03:59:39