Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
d004b718
Commit
d004b718
authored
8 years ago
by
René Heß
Browse files
Options
Downloads
Patches
Plain Diff
Update opcounter
parent
fdf488bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/perftool/common/opcounter.hh
+61
-1
61 additions, 1 deletion
dune/perftool/common/opcounter.hh
with
61 additions
and
1 deletion
dune/perftool/common/opcounter.hh
+
61
−
1
View file @
d004b718
...
...
@@ -126,6 +126,7 @@ namespace oc {
size_type
sin_count
;
size_type
sqrt_count
;
size_type
comparison_count
;
size_type
blend_count
;
Counters
()
:
addition_count
(
0
)
...
...
@@ -136,6 +137,7 @@ namespace oc {
,
sin_count
(
0
)
,
sqrt_count
(
0
)
,
comparison_count
(
0
)
,
blend_count
(
0
)
{}
void
reset
()
...
...
@@ -148,10 +150,11 @@ namespace oc {
sin_count
=
0
;
sqrt_count
=
0
;
comparison_count
=
0
;
blend_count
=
0
;
}
template
<
typename
Stream
>
void
reportOperations
(
Stream
&
os
,
std
::
string
exec
,
std
::
string
kernel
,
bool
doReset
=
false
)
void
reportOperations
(
Stream
&
os
,
bool
doReset
=
false
)
{
auto
total
=
addition_count
+
multiplication_count
+
division_count
+
exp_count
+
pow_count
+
sin_count
+
sqrt_count
+
comparison_count
;
if
(
total
==
0
)
...
...
@@ -164,6 +167,7 @@ namespace oc {
<<
exec
<<
" "
<<
kernel
<<
" sin "
<<
sin_count
<<
std
::
endl
<<
exec
<<
" "
<<
kernel
<<
" sqrt "
<<
sqrt_count
<<
std
::
endl
<<
exec
<<
" "
<<
kernel
<<
" comparisons "
<<
comparison_count
<<
std
::
endl
<<
exec
<<
" "
<<
kernel
<<
" blends "
<<
blend_count
<<
std
::
endl
<<
exec
<<
" "
<<
kernel
<<
" totalops "
<<
total
<<
std
::
endl
;
if
(
doReset
)
...
...
@@ -180,6 +184,7 @@ namespace oc {
sin_count
+=
rhs
.
sin_count
;
sqrt_count
+=
rhs
.
sqrt_count
;
comparison_count
+=
rhs
.
comparison_count
;
blend_count
+=
rhs
.
blend_count
;
return
*
this
;
}
...
...
@@ -194,6 +199,7 @@ namespace oc {
r
.
sin_count
=
sin_count
-
rhs
.
sin_count
;
r
.
sqrt_count
=
sqrt_count
-
rhs
.
sqrt_count
;
r
.
comparison_count
=
comparison_count
-
rhs
.
comparison_count
;
r
.
blend_count
=
blend_count
-
rhs
.
blend_count
;
return
r
;
}
...
...
@@ -214,6 +220,16 @@ namespace oc {
counters
.
division_count
+=
n
;
}
static
void
comparisons
(
std
::
size_t
n
)
{
counters
.
comparison_count
+=
n
;
}
static
void
blends
(
std
::
size_t
n
)
{
counters
.
blend_count
+=
n
;
}
static
void
reset
()
{
counters
.
reset
();
...
...
@@ -876,6 +892,50 @@ namespace oc {
return
{
std
::
abs
(
a
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
max
(
const
OpCounter
<
F
>&
a
,
const
OpCounter
<
F
>&
b
)
{
++
OpCounter
<
F
>::
counters
.
comparison_count
;
using
std
::
max
;
return
{
max
(
a
.
_v
,
b
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
min
(
const
OpCounter
<
F
>&
a
,
const
OpCounter
<
F
>&
b
)
{
++
OpCounter
<
F
>::
counters
.
comparison_count
;
using
std
::
min
;
return
{
min
(
a
.
_v
,
b
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
round
(
const
OpCounter
<
F
>&
a
)
{
using
std
::
round
;
return
{
round
(
a
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
trunc
(
const
OpCounter
<
F
>&
a
)
{
using
std
::
trunc
;
return
{
trunc
(
a
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
ceil
(
const
OpCounter
<
F
>&
a
)
{
using
std
::
ceil
;
return
{
ceil
(
a
.
_v
)};
}
template
<
typename
F
>
OpCounter
<
F
>
floor
(
const
OpCounter
<
F
>&
a
)
{
using
std
::
floor
;
return
{
floor
(
a
.
_v
)};
}
}
#endif // __OPCOUNTER__
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