Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
030d9acd
Commit
030d9acd
authored
May 06, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move performance test helper get_time() to utils.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
fd8b78aa
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
37 deletions
+20
-37
testconvcode.cc
src/testconvcode.cc
+2
-12
testlimiter.cc
src/testlimiter.cc
+2
-12
testrandom.cc
src/testrandom.cc
+2
-13
utils.cc
src/utils.cc
+12
-0
utils.hh
src/utils.hh
+2
-0
No files found.
src/testconvcode.cc
View file @
030d9acd
...
...
@@ -21,20 +21,10 @@
#include <random>
#include <assert.h>
#include <sys/time.h>
using
std
::
vector
;
using
std
::
string
;
static
double
gettime
()
{
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
tv
.
tv_sec
+
tv
.
tv_usec
/
1000000.0
;
}
vector
<
int
>
generate_error_vector
(
size_t
n
,
int
errors
)
{
...
...
@@ -210,14 +200,14 @@ main (int argc, char **argv)
while
(
in_bits
.
size
()
!=
128
)
in_bits
.
push_back
(
rand
()
&
1
);
const
double
start_t
=
gettime
();
const
double
start_t
=
get
_
time
();
const
size_t
runs
=
20
;
for
(
size_t
i
=
0
;
i
<
runs
;
i
++
)
{
vector
<
int
>
out_bits
=
conv_decode_hard
(
block_type
,
conv_encode
(
block_type
,
in_bits
));
assert
(
out_bits
==
in_bits
);
}
printf
(
"%.1f ms/block
\n
"
,
(
gettime
()
-
start_t
)
/
runs
*
1000.0
);
printf
(
"%.1f ms/block
\n
"
,
(
get
_
time
()
-
start_t
)
/
runs
*
1000.0
);
}
if
(
argc
==
3
&&
string
(
argv
[
2
])
==
"table"
)
conv_print_table
(
block_type
);
...
...
src/testlimiter.cc
View file @
030d9acd
...
...
@@ -21,7 +21,6 @@
#include <assert.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>
#include "sfinputstream.hh"
#include "sfoutputstream.hh"
...
...
@@ -33,15 +32,6 @@ using std::vector;
using
std
::
max
;
using
std
::
min
;
static
double
gettime
()
{
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
tv
.
tv_sec
+
tv
.
tv_usec
/
1000000.0
;
}
int
perf
()
{
...
...
@@ -52,13 +42,13 @@ perf()
vector
<
float
>
samples
(
2
*
1024
);
int
n_frames
=
0
;
double
start
=
gettime
();
double
start
=
get
_
time
();
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
n_frames
+=
samples
.
size
()
/
2
;
vector
<
float
>
out_samples
=
limiter
.
process
(
samples
);
}
double
end
=
gettime
();
double
end
=
get
_
time
();
printf
(
"%f ns/frame
\n
"
,
(
end
-
start
)
*
1000
*
1000
*
1000
/
n_frames
);
return
0
;
}
...
...
src/testrandom.cc
View file @
030d9acd
...
...
@@ -18,20 +18,9 @@
#include "utils.hh"
#include "random.hh"
#include <sys/time.h>
using
std
::
vector
;
using
std
::
string
;
static
double
gettime
()
{
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
tv
.
tv_sec
+
tv
.
tv_usec
/
1000000.0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -43,13 +32,13 @@ main (int argc, char **argv)
}
uint64_t
s
=
0
;
double
t_start
=
gettime
();
double
t_start
=
get
_
time
();
size_t
runs
=
25000000
;
for
(
size_t
i
=
0
;
i
<
runs
;
i
++
)
{
s
+=
rng
();
}
double
t_end
=
gettime
();
double
t_end
=
get
_
time
();
printf
(
"s=%016lx
\n\n
"
,
s
);
printf
(
"%f Mvalues/sec
\n
"
,
runs
/
(
t_end
-
t_start
)
/
1000000
);
...
...
src/utils.cc
View file @
030d9acd
...
...
@@ -18,9 +18,21 @@
#include "utils.hh"
#include "stdarg.h"
#include <sys/time.h>
using
std
::
vector
;
using
std
::
string
;
double
get_time
()
{
/* return timestamp in seconds as double */
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
tv
.
tv_sec
+
tv
.
tv_usec
/
1000000.0
;
}
static
unsigned
char
from_hex_nibble
(
char
c
)
{
...
...
src/utils.hh
View file @
030d9acd
...
...
@@ -27,6 +27,8 @@ std::string bit_vec_to_str (const std::vector<int>& bit_vec);
std
::
vector
<
unsigned
char
>
hex_str_to_vec
(
const
std
::
string
&
str
);
std
::
string
vec_to_hex_str
(
const
std
::
vector
<
unsigned
char
>&
vec
);
double
get_time
();
template
<
typename
T
>
inline
const
T
&
bound
(
const
T
&
min_value
,
const
T
&
value
,
const
T
&
max_value
)
...
...
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