Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7a8e1fc6
Commit
7a8e1fc6
authored
May 16, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Different way of measuring render time.
parent
7a1718d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
34 deletions
+21
-34
drawpanel_gal.cpp
common/drawpanel_gal.cpp
+17
-0
view.cpp
common/view/view.cpp
+4
-34
No files found.
common/drawpanel_gal.cpp
View file @
7a8e1fc6
...
...
@@ -39,6 +39,10 @@
#include <gal/opengl/opengl_gal.h>
#include <gal/cairo/cairo_gal.h>
#ifdef __WXDEBUG__
#include <profile.h>
#endif
/* __WXDEBUG__ */
#define METRIC_UNIT_LENGTH (1e9)
...
...
@@ -116,6 +120,12 @@ void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent )
void
EDA_DRAW_PANEL_GAL
::
Refresh
(
bool
eraseBackground
,
const
wxRect
*
rect
)
{
#ifdef __WXDEBUG__
prof_counter
time
;
prof_start
(
&
time
,
false
);
#endif
/* __WXDEBUG__ */
m_gal
->
BeginDrawing
();
m_gal
->
SetBackgroundColor
(
KiGfx
::
COLOR4D
(
0
,
0
,
0
,
1.0
)
);
m_gal
->
ClearScreen
();
...
...
@@ -129,6 +139,13 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect )
m_view
->
Redraw
();
m_gal
->
EndDrawing
();
#ifdef __WXDEBUG__
prof_end
(
&
time
);
wxLogDebug
(
wxT
(
"EDA_DRAW_PANEL_GAL::Refresh: %.0f ms (%.0f fps)"
),
static_cast
<
double
>
(
time
.
value
)
/
1000.0
,
1000000.0
/
static_cast
<
double
>
(
time
.
value
)
);
#endif
/* __WXDEBUG__ */
}
...
...
common/view/view.cpp
View file @
7a8e1fc6
...
...
@@ -33,7 +33,9 @@
#include <gal/graphics_abstraction_layer.h>
#include <painter.h>
#ifdef __WXDEBUG__
#include <profile.h>
#endif
/* __WXDEBUG__ */
using
namespace
KiGfx
;
...
...
@@ -359,14 +361,12 @@ void VIEW::EnableTopLayer( bool aEnable )
struct
VIEW
::
drawItem
{
drawItem
(
VIEW
*
aView
,
int
aCurrentLayer
)
:
c
ount
(
0
),
countCached
(
0
),
currentLayer
(
aCurrentLayer
),
time
(
0
),
view
(
aView
)
c
urrentLayer
(
aCurrentLayer
),
view
(
aView
)
{
}
void
operator
()(
VIEW_ITEM
*
aItem
)
{
BOX2I
tmp
;
uint64_t
ts
=
rdtsc
();
GAL
*
gal
=
view
->
GetGAL
();
if
(
view
->
m_useGroups
)
...
...
@@ -376,7 +376,6 @@ struct VIEW::drawItem
if
(
group
>=
0
&&
aItem
->
ViewIsVisible
()
)
{
gal
->
DrawGroup
(
group
);
countCached
++
;
}
else
{
...
...
@@ -390,30 +389,15 @@ struct VIEW::drawItem
{
view
->
m_painter
->
Draw
(
static_cast
<
EDA_ITEM
*>
(
aItem
),
currentLayer
);
}
time
+=
rdtsc
()
-
ts
;
count
++
;
}
int
count
;
int
countCached
;
int
currentLayer
;
uint64_t
time
;
VIEW
*
view
;
};
void
VIEW
::
redrawRect
(
const
BOX2I
&
aRect
)
{
int
totalItems
=
0
,
totalCached
=
0
;
uint64_t
totalDrawTime
=
0
;
#ifdef __WXDEBUG__
prof_counter
totalCycles
,
totalRealTime
;
prof_start
(
&
totalRealTime
,
false
);
prof_start
(
&
totalCycles
,
true
);
#endif
/* __WXDEBUG__ */
BOOST_FOREACH
(
VIEW_LAYER
*
l
,
m_orderedLayers
)
{
if
(
l
->
enabled
)
...
...
@@ -421,25 +405,11 @@ void VIEW::redrawRect( const BOX2I& aRect )
drawItem
drawFunc
(
this
,
l
->
id
);
if
(
!
m_useGroups
)
m_gal
->
SetLayerDepth
(
(
double
)
l
->
renderingOrder
);
m_gal
->
SetLayerDepth
(
static_cast
<
double
>
(
l
->
renderingOrder
)
);
l
->
items
->
Query
(
aRect
,
drawFunc
);
l
->
isDirty
=
false
;
totalItems
+=
drawFunc
.
count
;
totalDrawTime
+=
drawFunc
.
time
;
totalCached
+=
drawFunc
.
countCached
;
}
}
#ifdef __WXDEBUG__
prof_end
(
&
totalCycles
);
prof_end
(
&
totalRealTime
);
wxLogDebug
(
wxT
(
"Redraw::items %d (%d cached), %.1f ms/frame (%.0f FPS), draw/geometry ratio: %.1f%%"
),
totalItems
,
totalCached
,
(
double
)
totalRealTime
.
value
/
1000.0
,
1000000.0
/
(
double
)
totalRealTime
.
value
,
(
double
)
totalDrawTime
/
(
double
)
totalCycles
.
value
*
100.0
);
#endif
/* __WXDEBUG__ */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment