| 1 | //------------------------------------------------------------------------------ |
| 2 | // Author: Andrey Kuznetsov |
| 3 | // Description: Statistics counter |
| 4 | // Copyright (c) 2015 EPAM Systems |
| 5 | //------------------------------------------------------------------------------ |
| 6 | /* |
| 7 | This file is part of Nfstrace. |
| 8 | |
| 9 | Nfstrace is free software: you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation, version 2 of the License. |
| 12 | |
| 13 | Nfstrace is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with Nfstrace. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | //------------------------------------------------------------------------------ |
| 22 | #ifndef BREAKDOWNCOUNTER_H |
| 23 | #define BREAKDOWNCOUNTER_H |
| 24 | //------------------------------------------------------------------------------ |
| 25 | #include <cinttypes> |
| 26 | #include <vector> |
| 27 | |
| 28 | #include "latencies.h" |
| 29 | //------------------------------------------------------------------------------ |
| 30 | /*! Counts and keeps breakdown statistics for session |
| 31 | */ |
| 32 | class BreakdownCounter |
| 33 | { |
| 34 | public: |
| 35 | BreakdownCounter(std::size_t count); |
| 36 | ~BreakdownCounter(); |
| 37 | |
| 38 | /*! |
| 39 | * \brief operator [] returns statistics by index (command number) |
| 40 | * \param index - command number |
| 41 | * \return statistics |
| 42 | */ |
| 43 | const NST::breakdown::Latencies operator[](int index) const; |
| 44 | |
| 45 | /*! |
| 46 | * \brief operator [] returns statistics by index (command number) |
| 47 | * \param index - command number |
| 48 | * \return statistics |
| 49 | */ |
| 50 | NST::breakdown::Latencies& operator[](int index); |
| 51 | |
| 52 | /*! |
| 53 | * \brief get_total_count returns total amount of commands |
| 54 | * \return commands count |
| 55 | */ |
| 56 | uint64_t get_total_count() const; |
| 57 | |
| 58 | private: |
| 59 | void operator=(const BreakdownCounter&) = delete; |
| 60 | std::vector<NST::breakdown::Latencies> latencies; |
| 61 | }; |
| 62 | //------------------------------------------------------------------------------ |
| 63 | #endif //BREAKDOWNCOUNTER_H |
| 64 | //------------------------------------------------------------------------------ |