blob: 3a216cacb05cd5407d23ab112278d2870ca4dffe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
//------------------------------------------------------------------------------
// Author: Andrey Kuznetsov
// Description: Representer of statistics
// Copyright (c) 2015 EPAM Systems
//------------------------------------------------------------------------------
/*
This file is part of Nfstrace.
Nfstrace is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 2 of the License.
Nfstrace is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Nfstrace. If not, see <http://www.gnu.org/licenses/>.
*/
//------------------------------------------------------------------------------
#ifndef REPRESENTER_H
#define REPRESENTER_H
//------------------------------------------------------------------------------
#include <memory>
#include <ostream>
#include "commandrepresenter.h"
#include "breakdowncounter.h"
#include "statistics.h"
//------------------------------------------------------------------------------
namespace NST
{
namespace breakdown
{
/*! \class Represents statistics and sends it to screen
*/
class Representer
{
std::ostream& out;
std::unique_ptr<CommandRepresenter> cmd_representer;
size_t space_for_cmd_name;
void store_per_session(std::ostream& file,
const Statistics& statistics,
const Session& session,
const std::string& ssession) const;
void print_per_session(const Statistics& statistics, const Session& session, const std::string& ssession) const;
protected:
/**
* @brief handler of one procedure output event
* @param o - stream
* @param breakdown - current counter
* @param procedure - procedure ID
*/
virtual void onProcedureInfoPrinted(std::ostream& o, const BreakdownCounter& breakdown, unsigned procedure) const;
public:
/**
* @brief Representer's constructor
* @param o - output stream
* @param cmd_representer - command representer
* @param space_for_cmd_name - spaces amount in output table (column's wifth)
*/
Representer(std::ostream& o, CommandRepresenter* cmd_representer, size_t space_for_cmd_name = 12);
/*!
* \brief flush_statistics outs statistics on screen
* \param statistics - statistics data
*/
void flush_statistics(const Statistics& statistics);
};
} // namespace breakdown
} // namespace NST
//------------------------------------------------------------------------------
#endif//REPRESENTER_H
//------------------------------------------------------------------------------
|