Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
profilergraph.h
Go to the documentation of this file.
1/*
2Minetest
3Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 2.1 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public License along
16with this program; if not, write to the Free Software Foundation, Inc.,
1751 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20#pragma once
21
22#include <SColor.h>
23#include <deque>
24#include <utility>
25#include <IGUIFont.h>
26#include <IVideoDriver.h>
27#include "profiler.h"
28
29/* Profiler display */
31{
32private:
33 struct Piece
34 {
35 Piece(Profiler::GraphValues v) : values(std::move(v)) {}
37 };
38 struct Meta
39 {
40 float min;
41 float max;
42 video::SColor color;
43 Meta(float initial = 0,
44 video::SColor color = video::SColor(255, 255, 255, 255)) :
45 min(initial),
46 max(initial), color(color)
47 {
48 }
49 };
50 std::deque<Piece> m_log;
51
52public:
53 u32 m_log_max_size = 200;
54
55 ProfilerGraph() = default;
56
57 void put(const Profiler::GraphValues &values);
58
59 void draw(s32 x_left, s32 y_bottom, video::IVideoDriver *driver,
60 gui::IGUIFont *font) const;
61};
Definition: profilergraph.h:31
void put(const Profiler::GraphValues &values)
Definition: profilergraph.cpp:25
std::deque< Piece > m_log
Definition: profilergraph.h:50
ProfilerGraph()=default
void draw(s32 x_left, s32 y_bottom, video::IVideoDriver *driver, gui::IGUIFont *font) const
Definition: profilergraph.cpp:33
u32 m_log_max_size
Definition: profilergraph.h:53
std::map< std::string, float > GraphValues
Definition: profiler.h:54
Definition: profilergraph.h:39
Meta(float initial=0, video::SColor color=video::SColor(255, 255, 255, 255))
Definition: profilergraph.h:43
float min
Definition: profilergraph.h:40
float max
Definition: profilergraph.h:41
video::SColor color
Definition: profilergraph.h:42
Definition: profilergraph.h:34
Profiler::GraphValues values
Definition: profilergraph.h:36
Piece(Profiler::GraphValues v)
Definition: profilergraph.h:35