Line data Source code
1 :
2 : /* Copyright (c) 2009-2017, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQ_FABRIC_STATISTIC_H
19 : #define EQ_FABRIC_STATISTIC_H
20 :
21 : #include <eq/fabric/api.h>
22 : #include <eq/fabric/event.h> // base class
23 : #include <eq/fabric/types.h>
24 : #include <iostream>
25 : #include <lunchbox/bitOperation.h> // inline template specialization
26 :
27 : namespace eq
28 : {
29 : namespace fabric
30 : {
31 : /**
32 : * A statistics event.
33 : *
34 : * Statistics are events generated by various Equalizer entities, typically
35 : * using StatisticSampler. They are used by the server for load-balancing and to
36 : * render the statistics overlay.
37 : *
38 : * @sa Channel::drawStatistics
39 : */
40 41 : struct Statistic : public Event
41 : {
42 : /** The type of the statistics event. */
43 : enum Type // Also update string and color table in statistic.cpp
44 : {
45 : NONE = 0,
46 : CHANNEL_CLEAR, //!< Sampling of Channel::frameClear
47 : CHANNEL_DRAW, //!< Sampling of Channel::frameDraw
48 : CHANNEL_DRAW_FINISH, //!< Sampling of Channel::frameDrawFinish
49 : CHANNEL_ASSEMBLE, //!< Sampling of Channel::frameAssemble
50 : CHANNEL_FRAME_WAIT_READY, //!< Sampling of Frame::waitReady
51 : CHANNEL_READBACK, //!< Sampling of Channel::frameReadback
52 : CHANNEL_ASYNC_READBACK, //!< Sampling of async readback
53 : CHANNEL_VIEW_FINISH, //!< Sampling of Channel::frameViewFinish
54 : CHANNEL_FRAME_TRANSMIT, //!< Sampling of frame transmission
55 : CHANNEL_FRAME_COMPRESS, //!< Sampling of frame compression
56 : /** Sampling of waiting for a send token from the receiver */
57 : CHANNEL_FRAME_WAIT_SENDTOKEN,
58 : WINDOW_FINISH, //!< Sampling of Window::finish before a swap barrier
59 : /** Sampling of throttling of framerate_equalizer */
60 : WINDOW_THROTTLE_FRAMERATE,
61 : WINDOW_SWAP_BARRIER, //!< Sampling of swap barrier block
62 : WINDOW_SWAP, //!< Sampling of Window::swapBuffers
63 : WINDOW_FPS, //!< Framerate sampling
64 : PIPE_IDLE, //!< Pipe thread idle ratio
65 : NODE_FRAME_DECOMPRESS, //!< Sampling of frame decompression
66 : CONFIG_START_FRAME, //!< Sampling of Config::startFrame
67 : CONFIG_FINISH_FRAME, //!< Sampling of Config::finishFrame
68 : /** Sampling of synchronization time during Config::finishFrame */
69 : CONFIG_WAIT_FINISH_FRAME,
70 : ALL // must be last
71 : };
72 :
73 : Type type; //!< The type of statistic
74 : uint32_t frameNumber; //!< The frame during when the sampling happened
75 : uint32_t task; //!< @internal
76 : uint32_t plugins[2]; //!< color,depth plugins (readback, compression)
77 :
78 : int64_t startTime; //!< Absolute start time of the operation
79 : int64_t endTime; //!< Absolute end time of the operation
80 : int64_t idleTime; //!< Absolute idle time of PIPE_IDLE
81 : int64_t totalTime; //!< Total time of a pipe frame (PIPE_IDLE)
82 :
83 : float ratio; //!< compression ratio (transfer, compression)
84 : float currentFPS; //!< FPS of last frame (WINDOW_FPS)
85 : float averageFPS; //!< Weighted sum averaging of FPS (WINDOW_FPS)
86 : float pad; //!< @internal
87 :
88 : char resourceName[32]; //!< A non-unique name of the originator
89 :
90 : /** Translate the Type to a string representation. @version 1.0 */
91 : EQFABRIC_API static const std::string& getName(const Type type);
92 : /** Translate the Type to a color value. @version 1.0 */
93 : EQFABRIC_API static const Vector3f& getColor(const Type type);
94 : };
95 :
96 : /** Output the statistic type to an std::ostream. @version 1.0 */
97 : EQFABRIC_API std::ostream& operator<<(std::ostream&, const Statistic::Type&);
98 :
99 : /** Output the statistic to an std::ostream. @version 1.0 */
100 : EQFABRIC_API std::ostream& operator<<(std::ostream&, const Statistic&);
101 : }
102 : }
103 :
104 : #endif // EQ_FABRIC_STATISTIC_H
|