Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
194258b4
Commit
194258b4
authored
13 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
Add different automatic profiler graph drawing style for relative-ish plots
parent
fa416e71
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/game.cpp
+24
-4
24 additions, 4 deletions
src/game.cpp
with
24 additions
and
4 deletions
src/game.cpp
+
24
−
4
View file @
194258b4
...
@@ -724,6 +724,11 @@ class ProfilerGraph
...
@@ -724,6 +724,11 @@ class ProfilerGraph
core
::
rect
<
s32
>
(
textx
,
y
-
graphh
/
2
-
texth
/
2
,
core
::
rect
<
s32
>
(
textx
,
y
-
graphh
/
2
-
texth
/
2
,
textx2
,
y
-
graphh
/
2
+
texth
/
2
),
textx2
,
y
-
graphh
/
2
+
texth
/
2
),
meta
.
color
);
meta
.
color
);
s32
graph1y
=
y
;
s32
graph1h
=
graphh
;
bool
relativegraph
=
(
show_min
!=
0
&&
show_min
!=
show_max
);
float
lastscaledvalue
=
0.0
;
bool
lastscaledvalue_exists
=
false
;
for
(
std
::
list
<
Piece
>::
const_iterator
j
=
m_log
.
begin
();
for
(
std
::
list
<
Piece
>::
const_iterator
j
=
m_log
.
begin
();
j
!=
m_log
.
end
();
j
++
)
j
!=
m_log
.
end
();
j
++
)
{
{
...
@@ -738,6 +743,7 @@ class ProfilerGraph
...
@@ -738,6 +743,7 @@ class ProfilerGraph
}
}
if
(
!
value_exists
){
if
(
!
value_exists
){
x
++
;
x
++
;
lastscaledvalue_exists
=
false
;
continue
;
continue
;
}
}
float
scaledvalue
=
1.0
;
float
scaledvalue
=
1.0
;
...
@@ -745,12 +751,23 @@ class ProfilerGraph
...
@@ -745,12 +751,23 @@ class ProfilerGraph
scaledvalue
=
(
value
-
show_min
)
/
(
show_max
-
show_min
);
scaledvalue
=
(
value
-
show_min
)
/
(
show_max
-
show_min
);
if
(
scaledvalue
==
1.0
&&
value
==
0
){
if
(
scaledvalue
==
1.0
&&
value
==
0
){
x
++
;
x
++
;
lastscaledvalue_exists
=
false
;
continue
;
continue
;
}
}
s32
ivalue
=
scaledvalue
*
graphh
;
if
(
relativegraph
){
driver
->
draw2DLine
(
v2s32
(
x
,
y
),
if
(
lastscaledvalue_exists
){
v2s32
(
x
,
y
-
ivalue
),
s32
ivalue1
=
lastscaledvalue
*
graph1h
;
meta
.
color
);
s32
ivalue2
=
scaledvalue
*
graph1h
;
driver
->
draw2DLine
(
v2s32
(
x
-
1
,
graph1y
-
ivalue1
),
v2s32
(
x
,
graph1y
-
ivalue2
),
meta
.
color
);
}
lastscaledvalue
=
scaledvalue
;
lastscaledvalue_exists
=
true
;
}
else
{
s32
ivalue
=
scaledvalue
*
graph1h
;
driver
->
draw2DLine
(
v2s32
(
x
,
graph1y
),
v2s32
(
x
,
graph1y
-
ivalue
),
meta
.
color
);
}
x
++
;
x
++
;
}
}
meta_i
++
;
meta_i
++
;
...
@@ -1102,6 +1119,9 @@ void the_game(
...
@@ -1102,6 +1119,9 @@ void the_game(
float
recent_turn_speed
=
0.0
;
float
recent_turn_speed
=
0.0
;
ProfilerGraph
graph
;
ProfilerGraph
graph
;
// Initially clear the profiler
Profiler
::
GraphValues
dummyvalues
;
g_profiler
->
graphGet
(
dummyvalues
);
float
nodig_delay_timer
=
0.0
;
float
nodig_delay_timer
=
0.0
;
float
dig_time
=
0.0
;
float
dig_time
=
0.0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment